-
Notifications
You must be signed in to change notification settings - Fork 451
Fall back to non-overlay analysis when diff-informed analysis is unavailable #3791
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,8 @@ import { | |
| import { | ||
| getDiffInformedAnalysisBranches, | ||
| getPullRequestEditedDiffRanges, | ||
| hasDiffRangesJsonFile, | ||
| shouldPerformDiffInformedAnalysis, | ||
| writeDiffRangesJsonFile, | ||
| } from "./diff-informed-analysis-utils"; | ||
| import { EnvVar } from "./environment"; | ||
|
|
@@ -438,6 +440,30 @@ async function run(startedAt: Date) { | |
| return; | ||
| } | ||
|
|
||
| // If overlay is enabled and diff-informed analysis should have run but | ||
| // failed to produce output, revert to non-overlay analysis. Overlay | ||
| // without diff-informed is an untested combination that can produce | ||
| // inaccurate results. | ||
| try { | ||
| if ( | ||
| config.overlayDatabaseMode === OverlayDatabaseMode.Overlay && | ||
| (await shouldPerformDiffInformedAnalysis(codeql, features, logger)) && | ||
| !hasDiffRangesJsonFile() | ||
| ) { | ||
| logger.warning( | ||
| "Diff-informed analysis is not available for this pull request. " + | ||
| `Reverting overlay database mode to ${OverlayDatabaseMode.None}.`, | ||
| ); | ||
| config.overlayDatabaseMode = OverlayDatabaseMode.None; | ||
| } | ||
| } catch (e) { | ||
| logger.warning( | ||
| `Failed to determine diff-informed analysis availability, ` + | ||
| `reverting overlay database mode to ${OverlayDatabaseMode.None}: ${getErrorMessage(e)}`, | ||
| ); | ||
| config.overlayDatabaseMode = OverlayDatabaseMode.None; | ||
| } | ||
|
|
||
|
Comment on lines
+443
to
+466
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be good to move this out of There's already a bunch of logic around overlay enablement there, so spreading that out across different locations isn't good. We also have some frameworks for tests/diagnostics/telemetry there that this could factor into. In any case, this should have test coverage. |
||
| let overlayBaseDatabaseStats: OverlayBaseDatabaseDownloadStats | undefined; | ||
| let dependencyCachingStatus: DependencyCacheRestoreStatusReport | undefined; | ||
| try { | ||
|
|
||
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.
Minor: Adding a JSDoc comment here would be nice.