Conversation
There was a problem hiding this comment.
Pull request overview
This PR refines overlay-analysis disablement reporting by splitting previously broad disablement categories into more specific OverlayDisabledReason values, primarily to improve telemetry and diagnostics around why overlay analysis doesn’t run.
Changes:
- Expand
OverlayDisabledReasonto distinguish disk vs memory resource failures and feature-enablement sub-cases. - Refactor overlay enablement/resource checks to return a specific disablement reason (or
undefinedwhen enabled). - Update unit tests to expect the new disablement reasons.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/overlay/diagnostics.ts | Extends OverlayDisabledReason with more granular reason values used for telemetry. |
| src/config-utils.ts | Refactors overlay enablement/resource-check logic to return specific disablement reasons. |
| src/config-utils.test.ts | Updates overlay mode tests to assert the new disablement reasons. |
| lib/init-action.js | Generated output reflecting the TypeScript changes (not reviewed). |
mbg
left a comment
There was a problem hiding this comment.
Thanks for working on this -- getting a more detailed reason for why overlay is disabled is useful!
That said, I am not overly fond of some of the details of the changes here, sorry! See my comments for the details.
mbg
left a comment
There was a problem hiding this comment.
Thanks for iterating on the feedback! This looks better to me now, although the diff for b371ccd is a bit horrible to review -- it would have been good to commit some of those changes more incrementally.
Just some minor comments left which aren't blocking, so I am happy to approve!
src/config-utils.ts
Outdated
| codeScanningConfig: UserConfig, | ||
| ): Promise<OverlayDisabledReason | undefined> { | ||
| ): Promise< | ||
| { enabled: true } | { enabled: false; reason: OverlayDisabledReason } |
There was a problem hiding this comment.
Minor: Since this is used at least a couple of times in this file now, extract it into a type definition type OverlayEnabledResult = { enabled: true } | { enabled: false; reason: OverlayDisabledReason }.
We have similar-ish patterns elsewhere, so we could also move it to util as something like type EnablementResult<T> = { enabled: true } | { enabled: false; reason: T }, but this doesn't have to be done here.
Perhaps add helper definitions along the lines of const enabled = { enabled: true } and function disabled<T>(reason: T) { return { enabled: false; reason }; }
There was a problem hiding this comment.
I've decided to refactor this into a Result, since there's no need to repeat overlayDatabaseMode: OverlayDatabaseMode.None and useOverlayDatabaseCaching: false.
Break down the two most common categories to help us better understand why overlay isn't run.
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, Code Quality, ...).Products:
analysis-kinds: code-scanning.Environments:
github.comand/or GitHub Enterprise Cloud with Data Residency.How did/will you validate this change?
.test.tsfiles).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