Categorize Code Quality "not enabled" upload failure as user-error#3972
Open
henrymercer wants to merge 2 commits into
Open
Categorize Code Quality "not enabled" upload failure as user-error#3972henrymercer wants to merge 2 commits into
henrymercer wants to merge 2 commits into
Conversation
When a repository requests Code Quality analysis but it is not enabled, the SARIF upload to `PUT /repos/:owner/:repo/code-quality/analysis` returns a 403 with the message "Code quality is not enabled for this repository...". `isEnablementError` did not recognize this wording, so `wrapApiConfigurationError` left it as a plain Error and the analyze job was reported with `status=failure` instead of `user-error`. Add a `/Code Quality is not enabled/i` pattern so the error becomes a ConfigurationError and `getActionsStatus` categorizes it as `user-error`. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Warning
- Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.
Pull request overview
Updates the CodeQL Action’s API error classification so that “Code Quality not enabled” SARIF upload failures are treated as configuration/user errors (rather than action failures), aligning telemetry status with the actual root cause.
Changes:
- Extend
isEnablementErrordetection to match the Code Quality enablement 403 message. - Extend the existing
wrapApiConfigurationErrorenablement-error unit test to include the Code Quality wording (and casing variants).
Show a summary per file
| File | Description |
|---|---|
| src/api-client.ts | Adds a new enablement-error regex so Code Quality “not enabled” 403s wrap as ConfigurationError. |
| src/api-client.test.ts | Expands enablement-error test cases to include the Code Quality message (including casing transforms). |
| lib/entry-points.js | Generated artifact update (content excluded from diff; not reviewed). |
Copilot's findings
Files excluded by content exclusion policy (1)
- lib/entry-points.js
- Files reviewed: 2/3 changed files
- Comments generated: 0
mbg
approved these changes
Jun 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a repository requests Code Quality analysis but it is not enabled, the analyze/
finishjob fails and is reported withstatus=failure, when it should beuser-error: this is a customer configuration problem, not a CodeQL Action bug. We saw a burst of ~290 such failures from a single org, all surfacing this miscategorization.The root cause is the code-quality SARIF upload (
PUT /repos/:owner/:repo/code-quality/analysis). On a 403 it returns the messageCode quality is not enabled for this repository. Please enable code quality in the repository settings..wrapApiConfigurationErroronly converts a 403 into aConfigurationErrorwhenisEnablementErrormatches a known pattern, and none of the existing patterns covered the Code Quality wording. So the error stayed a plainError, andgetActionsStatusmapped it tofailure.This change adds a
/Code Quality is not enabled/ipattern toisEnablementError, mirroring the existing/Code Scanning is not enabled/ientry. The error now becomes aConfigurationErrorand is correctly categorized asuser-error. The case-insensitive flag tolerates the observed lowercase wording. The existing enablement-error unit test insrc/api-client.test.tsis extended with the Code Quality message. The change is intentionally surgical, with no broader error-handling refactor.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-quality.Environments:
github.comand/or GitHub Enterprise Cloud with Data Residency.How did/will you validate this change?
.test.tsfiles). The existing enablement-error test is extended with the Code Quality message.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?
report_status.statusfor these Code Quality enablement failures should move fromfailuretouser-error.Are there any special considerations for merging or releasing this change?
Merge / deployment checklist