Skip to content

Conversation

@mbg
Copy link
Member

@mbg mbg commented Feb 12, 2026

This PR accomplishes two things:

  1. A refactoring of Features into OfflineFeatures and Features:
    • OfflineFeatures implements the FeatureEnablement interface and handles implements all feature checking that does not involve the GitHub API.
    • Features extends OfflineFeatures and combines the logic from OfflineFeatures with a GitHubFeatureFlags instance to query the GitHub API.
  2. Abstracting over the concrete FeatureEnablement implementation with initFeatures:
    • OfflineFeatures and Features are no longer exported and instead initFeatures must be used.
    • By default, initFeatures instantiates a Features instance.
    • For CCR, it instantiates an OfflineFeatures instance instead.

Risk assessment

For internal use only. Please select the risk level of this change:

  • High risk: Changes are not fully under feature flags, have limited visibility and/or cannot be tested outside of production.

Which use cases does this change impact?

Workflow types:

  • Advanced setup - Impacts users who have custom CodeQL workflows.
  • Managed - Impacts users with dynamic workflows (Default Setup, CCR, ...).

Products:

  • Code Scanning - The changes impact analyses when analysis-kinds: code-scanning.
  • Code Quality - The changes impact analyses when analysis-kinds: code-quality.
  • CCR - The changes impact analyses for Copilot Code Reviews.
  • Third-party analyses - The changes affect the upload-sarif action.

Environments:

  • Dotcom - Impacts CodeQL workflows on github.com and/or GitHub Enterprise Cloud with Data Residency.

How did/will you validate this change?

  • Test repository - This change will be tested on a test repository before merging.
  • Unit tests - I am depending on unit test coverage (i.e. tests in .test.ts files).
  • End-to-end tests - I am depending on PR checks (i.e. tests in pr-checks).

If something goes wrong after this change is released, what are the mitigation and rollback strategies?

  • Rollback - Change can only be disabled by rolling back the release or releasing a new version with a fix.

How will you know if something goes wrong after this change is released?

  • Telemetry - I rely on existing telemetry or have made changes to the telemetry.
    • Dashboards - I will watch relevant dashboards for issues after the release. Consider whether this requires this change to be released at a particular time rather than as part of a regular release.
    • Alerts - New or existing monitors will trip if something goes wrong with this change.

Are there any special considerations for merging or releasing this change?

  • No special considerations - This change can be merged at any time.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Consider adding a changelog entry for this change.
  • Confirm the readme and docs have been updated if necessary.

mbg added 2 commits February 12, 2026 17:39
It doesn't need to be in there since it doesn't depend on the API itself and call `getDefaultCliVersionFromFlags` directly
@mbg mbg requested a review from henrymercer February 12, 2026 18:07
@mbg mbg self-assigned this Feb 12, 2026
@mbg mbg requested a review from a team as a code owner February 12, 2026 18:07
Copilot AI review requested due to automatic review settings February 12, 2026 18:07
@github-actions github-actions bot added the size/M Should be of average difficulty to review label Feb 12, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors feature-flag evaluation to support CCR by splitting feature checks into an offline-only implementation and an API-backed implementation, and updating actions/tests to initialize feature flags via a new initFeatures factory.

Changes:

  • Refactor Features into OfflineFeatures (local checks only) and Features (local + GitHub API), and introduce initFeatures to select the implementation at runtime (CCR vs non-CCR).
  • Update action entrypoints to call initFeatures instead of directly constructing Features, and type some usages against FeatureEnablement.
  • Add unit tests covering initFeatures selection behavior and update existing tests to use the factory.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/feature-flags.ts Introduces OfflineFeatures, changes Features to extend it, and adds initFeatures factory for CCR-aware initialization.
src/upload-sarif-action.ts Switches feature-flag initialization from new Features(...) to initFeatures(...).
src/start-proxy-action.ts Switches to initFeatures(...) and types features as FeatureEnablement.
src/setup-codeql-action.ts Switches feature-flag initialization to initFeatures(...).
src/init-action.ts Switches to initFeatures(...) and types features as FeatureEnablement.
src/init-action-post.ts Switches feature-flag initialization to initFeatures(...).
src/analyze-action.ts Switches feature-flag initialization to initFeatures(...).
src/autobuild.ts Switches feature-flag initialization to initFeatures(...) for the C++ autobuild feature check.
src/feature-flags.test.ts Adds tests for initFeatures and updates setup helper to use the factory.
src/diff-informed-analysis-utils.test.ts Updates test to construct features via initFeatures(...).
lib/upload-sarif-action.js Generated JS updated to reflect TS refactor and new initFeatures.
lib/start-proxy-action.js Generated JS updated to reflect TS refactor and new initFeatures.
lib/setup-codeql-action.js Generated JS updated to reflect TS refactor and new initFeatures.
lib/init-action.js Generated JS updated to reflect TS refactor and new initFeatures.
lib/init-action-post.js Generated JS updated to reflect TS refactor and new initFeatures.
lib/autobuild-action.js Generated JS updated to reflect TS refactor and new initFeatures.
lib/analyze-action.js Generated JS updated to reflect TS refactor and new initFeatures.

@github-actions github-actions bot added size/L May be hard to review and removed size/M Should be of average difficulty to review labels Feb 12, 2026
@mbg mbg force-pushed the mbg/features/offline-features branch from a956059 to ff5f7af Compare February 12, 2026 19:53
@mbg mbg force-pushed the mbg/features/offline-features branch from ff5f7af to 7c91acf Compare February 12, 2026 20:01
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.

1 participant