FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Refactor a few things out of `util.ts` by mbg · Pull Request #4251 · github/codeql-action · GitHub

Repository navigation

Refactor a few things out of util.ts - #4251

Merged
mbg merged 15 commits into
mainfrom
mbg/refactor-util/errors
Nov 2, 2026
Merged

mbg merged 15 commits into
mainfrom
mbg/refactor-util/errors

Conversation

mbg commented Oct 16, 2026

Copy link
Copy Markdown
Member

Groundwork for other things. This is a pure refactoring PR that moves various things out of util.ts because util.ts is large and unfocused, and easily creates dependency cycles for other files that depend on it.

Copilot AI max review requested due to automatic review settings October 16, 2026 21:55
mbg requested a review from a team as a code owner October 16, 2026 21:55
github-actions Bot added the size/L May be hard to review label Oct 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

🟡 Changes recommended

The new CodeQL stub silently ignores supplied version-check overrides.

1 open issue 1 file not reviewed What changed in this PR

Refactors shared helpers out of util.ts to reduce coupling and dependency cycles in the CodeQL Action.

Changes:

  • Extracts error helpers and GitHub types into focused modules.
  • Moves environment initialization onto Env.
  • Moves CLI version comparison onto CodeQL and updates callers and tests.
File Description
src/​util.ts Removes relocated helpers and preserves compatibility exports.
src/​upload-sarif-action.ts Initializes the action environment through Env.
src/​upload-lib.test.ts Updates environment initialization.
src/​tools-download.test.ts Spies on the relocated error helper.
src/​setup/​repository.ts Imports InstanceURL from its owning module.
src/​setup/​repository.test.ts Updates environment initialization.
src/​setup-codeql.test.ts Updates environment initialization.
src/​setup-codeql-action.ts Initializes through the action environment.
src/​init-action.ts Uses the new initialization and version methods.
src/​github.ts Houses GitHub variant and version types.
src/​feature-flags/​offline-features.test.ts Updates environment initialization.
src/​feature-flags.ts Uses the CodeQL version method.
src/​feature-flags.test.ts Updates environment initialization.
src/​errors/​index.ts Centralizes error helpers and classes.
src/​environment.ts Adds initialization and simplifies environment types.
src/​database-upload.test.ts Updates environment initialization.
src/​config-utils.ts Uses the CodeQL version method.
src/​codeql.ts Adds version comparison and stub wiring.
src/​codeql.test.ts Updates environment initialization.
src/​autobuild-action.ts Passes the environment into status reporting.
src/​api-client.test.ts Updates environment initialization.
src/​analyze-action.ts Initializes through the action environment.
src/​actions-util.test.ts Tests initialization through Env.

Review effort: Max

Comment thread src/codeql.ts Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

🔵 Needs a closer look

The stub version check can disagree with its reported version, affecting version-gated tests.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Make stub isVersionAtLeast use its returned getVersion

src/​codeql.ts:434

Could this default implementation call the returned stub's getVersion(), as the real implementation does? createStubCodeQL({}).isVersionAtLeast("1.0.0") returns false even though getVersion() reports "1.0.0". It also ignores replacements of getVersion on the returned stub because it reads partialCodeql instead. Version-gated tests can therefore take a different branch from the one implied by the stub's reported version, unlike the previous helper.

1 resolved since last review 1 file not reviewed

Review effort: Max

mbg force-pushed the mbg/refactor-util/errors branch from eaaa622 to 5c1005e Compare October 21, 2026 15:58
mario-campos previously approved these changes Oct 29, 2026

mario-campos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM! It would also be nice to have withTmpDir and withTmpFile moved to testing-utils.ts, as they are only used for testing IIRC.

mbg requested a review from mario-campos November 2, 2026 14:29
mbg added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit b35c6c6 Nov 2, 2026
230 checks passed
mbg deleted the mbg/refactor-util/errors branch November 2, 2026 16:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L May be hard to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL