Skip to content

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

Open
mbg wants to merge 10 commits into
mainfrom
mbg/refactor-util/errors
Open

mbg wants to merge 10 commits into
mainfrom
mbg/refactor-util/errors

Conversation

@mbg

@mbg 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
mbg requested a review from a team as a code owner October 16, 2026 21:55
@github-actions 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.

🟡 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
})),
isVersionAtLeast: resolveFunction(
partialCodeql,
"codeQlVersionAtLeast",

This branch has not been deployed

No deployments
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.

2 participants