-
Notifications
You must be signed in to change notification settings - Fork 434
Include base database OIDs when bundling database #3404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 pull request adds support for including the base database OIDs file when bundling databases, which is required for computing changed files and performing overlay analysis.
Changes:
- Moved
getBaseDatabaseOidsFilePathfunction fromoverlay-database-utils.tstoutil.tsand made it exported to allow reuse across multiple modules - Added
BundleSupportsIncludeOptionfeature flag to conditionally enable the new--includeoption for thecodeql database bundlecommand - Extended the
databaseBundlemethod signature to accept additional files to include in the bundle, with backward compatibility via feature flag checking
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/util.ts | Added constant for base database OIDs filename, exported getBaseDatabaseOidsFilePath function, and updated bundleDb to copy and include the base database OIDs file in the bundle |
| src/tools-features.ts | Added BundleSupportsIncludeOption feature flag enum value |
| src/overlay-database-utils.ts | Removed local getBaseDatabaseOidsFilePath function and imported it from util.ts |
| src/codeql.ts | Updated databaseBundle method signature to accept tryAlsoIncludeRelativePaths parameter and conditionally pass --include flags to the CLI |
| package-lock.json | Automated npm lock file updates adding peer dependency markers |
| lib/*.js | Auto-generated JavaScript files from TypeScript compilation |
| baseDatabaseOidsFilePath, | ||
| path.join(databasePath, BASE_DATABASE_OIDS_FILE_NAME), | ||
| ); | ||
| additionalFiles.push(BASE_DATABASE_OIDS_FILE_NAME); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for reference: we also do this elsewhere
mbg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few minor questions, otherwise this looks reasonable.
src/codeql.ts
Outdated
| databasePath: string, | ||
| outputFilePath: string, | ||
| dbName: string, | ||
| tryAlsoIncludeRelativePaths: string[], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the name start with try because of the feature check? If so, we should probably just call this includeRelativePaths (or extraPathsToInclude).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could do that, and perform the feature check in the caller. I don't have a strong opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, keep the feature check here. My point was that the feature check is essentially a FF check to stop us from trying to use a feature that is not yet supported by the CLI. Our expectation would be that eventually this will always happen. In general, we don't name things try[...] if they are only used if a FF is enabled that we eventually expect to always be true.
src/util.ts
Outdated
| await fs.promises.rm(databaseBundlePath, { force: true }); | ||
| } | ||
| await codeql.databaseBundle(databasePath, databaseBundlePath, dbName); | ||
| // Copy the base database OIDs file into the database location if it exists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment could be improved: right now, it is not super obvious what the difference between databasePath here and config.dbLocation is, and why the file has to be copied from the latter to the former.
mbg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! The changes made in response to my comments look good 👍🏻
Include the base database OIDs file when bundling the database since this file is required to compute the set of changed files and perform an overlay analysis.
Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
Workflow types:
dynamicworkflows (Default Setup, CCR, ...).Products:
analysis-kinds: code-scanning.Environments:
github.comand/or GitHub Enterprise Cloud with Data Residency.How did/will you validate this change?
If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist