-
Notifications
You must be signed in to change notification settings - Fork 457
fix(USE-001): add standardized error codes to pr_review_buffer and set_issue_type handlers #41692
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ const { isStagedMode, checkRequiredFilter } = require("./safe_output_helpers.cjs | |
| const { createAuthenticatedGitHubClient } = require("./handler_auth.cjs"); | ||
| const { resolveSafeOutputIssueTarget } = require("./temporary_id.cjs"); | ||
| const { hasIssueIntentsRuntimeFeature, normalizeIssueIntentMetadata } = require("./issue_intents.cjs"); | ||
| const { ERR_VALIDATION } = require("./error_codes.cjs"); | ||
|
|
||
| /** @type {string} Safe output type handled by this module */ | ||
| const HANDLER_TYPE = "set_issue_type"; | ||
|
|
@@ -108,7 +109,7 @@ function toRestIssueIntentMetadata(intentMetadata) { | |
| restMetadata.confidence = "high"; | ||
| break; | ||
| default: | ||
| throw new Error(`Invalid confidence ${JSON.stringify(intentMetadata.confidence)}. Expected one of: LOW, MEDIUM, HIGH.`); | ||
| throw new Error(`${ERR_VALIDATION}: Invalid confidence ${JSON.stringify(intentMetadata.confidence)}. Expected one of: LOW, MEDIUM, HIGH.`); | ||
|
Contributor
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. [/tdd] This fixed error path has no regression test — a future refactor could silently drop the 💡 Suggested testit("throws ERR_VALIDATION for an unrecognised confidence value", () => {
const intentMetadata = { confidence: "UNKNOWN" };
expect(() => toRestIssueIntentMetadata(intentMetadata))
.toThrow(/^ERR_VALIDATION:/);
});This keeps the conformance guarantee self-verifying and avoids another USE-001 regression. |
||
| } | ||
| } | ||
| return restMetadata; | ||
|
|
||
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.
[/tdd] The non-transient error branch (the one just fixed) isn't exercised by any test in
pr_review_buffer.test.cjs— so theERR_API:prefix could regress silently.💡 Suggested test
Pairs naturally with the existing transient-error path test to give full branch coverage.