Skip to content

Conversation

@henrymercer
Copy link
Contributor

The database bundle command does not currently include a critical overlay database metadata file. Support is being added in conjunction with the bundleSupportsOverlay tools feature. This PR only uploads overlay DBs when using a CLI with that tool feature.

Risk assessment

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

  • Low risk: Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.

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.

Environments:

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

How did/will you validate this change?

  • 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?

  • Feature flags - All new or changed code paths can be fully disabled with corresponding feature flags.

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?

  • Special considerations - This change should only be merged once certain preconditions are met. Please provide details of those or link to this PR from an internal issue.

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.

@henrymercer henrymercer requested a review from a team as a code owner December 17, 2025 16:10
Copilot AI review requested due to automatic review settings December 17, 2025 16:10
@github-actions github-actions bot added the size/XS Should be very easy to review label Dec 17, 2025
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 adds a tools feature requirement to ensure overlay databases are only uploaded when using a CodeQL CLI that supports the bundleSupportsOverlay feature. This prevents uploading overlay databases with CLI versions that don't include a critical metadata file in the database bundle command.

Key changes:

  • Adds BundleSupportsOverlay tools feature enum value
  • Associates the feature flag UploadOverlayDbToApi with the new tools feature requirement
  • Refactors variable scoping to include database size in error reports

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

File Description
src/tools-features.ts Adds new BundleSupportsOverlay enum value to the ToolsFeature enum
src/feature-flags.ts Associates the UploadOverlayDbToApi feature flag with the BundleSupportsOverlay tools feature
src/database-upload.ts Refactors bundledDbSize variable scope to capture size earlier and include it in error reports
lib/*.js Auto-generated JavaScript files reflecting the TypeScript source changes

mbg
mbg previously approved these changes Dec 17, 2025
Copy link
Member

@mbg mbg left a comment

Choose a reason for hiding this comment

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

One question, otherwise this looks reasonable.

reports.push({
language,
error: util.getErrorMessage(e),
...(bundledDbSize ? { zipped_upload_size_bytes: bundledDbSize } : {}),
Copy link
Member

Choose a reason for hiding this comment

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

Is using the truthiness of bundledDbSize a problem here? E.g. do we care that this would be false if bundledDbSize was 0 rather than undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It shouldn't be 0, but worth correcting 👍

Comment on lines +148 to +150
...(bundledDbSize !== undefined
? { zipped_upload_size_bytes: bundledDbSize }
: {}),
Copy link
Member

Choose a reason for hiding this comment

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

Is this not equivalent to just

Suggested change
...(bundledDbSize !== undefined
? { zipped_upload_size_bytes: bundledDbSize }
: {}),
zipped_upload_size_bytes: bundledDbSize

Copy link
Contributor Author

Choose a reason for hiding this comment

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

➜  ~ node
Welcome to Node.js v25.2.1.
Type ".help" for more information.
> let x = {}
undefined
> x["a"] = undefined
undefined
> x
{ a: undefined }

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, but practically speaking there is not typically a difference in using an object with a key that has undefined as value vs a key that is absent. Asking for the value of the key gives undefined in both cases. The question is whether we care about the distinction that the key itself exists or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's fair. I'd prefer to leave this to the future and address it across the codebase.

@henrymercer henrymercer requested a review from mbg December 18, 2025 12:36
Copy link
Member

@mbg mbg left a comment

Choose a reason for hiding this comment

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

No strong feelings about the above conversation, so happy to approve.

@henrymercer henrymercer merged commit eb823a7 into main Dec 18, 2025
241 checks passed
@henrymercer henrymercer deleted the henrymercer/overlay-upload-tools-feature branch December 18, 2025 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Should be very easy to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants