Repository navigation
refactor(exceptions): each exception class declares its error_code and exit_code - #2558
Merged
Merged
Conversation
…d exit_code `DevOpsCLIError` declares `error_code` and `exit_code` as class attributes, and each subclass declares the one that differs from its base. An instance takes its class's codes. `exit_code=` stays as an override of one instance, for a failed subprocess's own status; `error_code=` goes, because no raise site set it. - 28 `__init__` methods go: the 17 that only passed their own arguments to their base, the 4 whose default message no caller used, and those of 7 classes that no code raises, catches or names. - The 46 `CONST_ERROR_CODE_*` constants, the 4 `CONST_GITHUB_*_ERROR_CODE` constants and the 10 `DEFAULT_*` attributes go. Tests compare with the code's string. - The error catalog generator reads the codes from each class. Its note on the exit status now says that every command exits with it, as it does since the one exit seam. - `docs/ERRORS.md` keeps every remaining code and exit status. `CONTRIBUTING.md` says how a class declares its codes.
Owner
Author
|
Test evidence:
Pending a person: review the diff in tuicr ( |
dan-petty
marked this pull request as ready for review
October 28, 2026 23:00
14 tasks
dan-petty
pushed a commit
that referenced
this pull request
Oct 29, 2026
🤖 I have created a release *beep* *boop* --- ## [0.12.0](v0.11.3...v0.12.0) (2026-10-29) ### Features * **ai:** constrain structured replies on the openai and claude providers ([#2550](#2550)) ([4f7390a](4f7390a)) * **argo:** retire the Helm release records of the charts that Argo CD renders ([#2568](#2568)) ([cabfcd4](cabfcd4)) * **k8s:** devops k8s tunnel keeps the cloudflared forward to k8s.<domain> running ([#2567](#2567)) ([f9493fa](f9493fa)), closes [#1641](#1641) * **monitoring:** alert when the otel collector fails to export spans, metric points or log records ([#2565](#2565)) ([4fc8ff7](4fc8ff7)) * **telemetry:** the roadmap Service counts its GitHub writes, budget holds, Firecrawl searches and own deliveries, and caps refine's comments on one item ([#2556](#2556)) ([9819877](9819877)), closes [#2475](#2475) ### Bug Fixes * **git:** report a worktree that a run in parallel removed as removed, not a failed reclaim ([#2557](#2557)) ([a556984](a556984)), closes [#2408](#2408) * **k8s:** the devops perimeter opens only the collector's OTLP/HTTP port, 4318 ([#2549](#2549)) ([d156ce7](d156ce7)) * **sandbox:** devops sandbox logs reads each line with its stream from a real engine ([#2546](#2546)) ([e7216d5](e7216d5)), closes [#2520](#2520) * **service:** the webhook route refuses an unsigned or oversized delivery before it reads the body, and a rate limit guards it ([#2553](#2553)) ([40efcd4](40efcd4)), closes [#2476](#2476) ### Performance Improvements * **ai:** price a request with one load of the settings ([#2555](#2555)) ([5d86538](5d86538)), closes [#1420](#1420) ### Code Refactoring * **config:** a default that backs a settings field is read only through the settings ([#2561](#2561)) ([0702d13](0702d13)) * **exceptions:** each exception class declares its error_code and exit_code ([#2558](#2558)) ([410dece](410dece)) * **review:** render the review report from one input, outside the orchestrator ([#2563](#2563)) ([9e73e6d](9e73e6d)), closes [#1008](#1008) * **security:** src has no unreviewed Bandit findings, and the gate scans src at low severity ([#2560](#2560)) ([45261dd](45261dd)), closes [#1538](#1538) * **security:** the scanners stop looking for mocks, and their tests run on the scanner fake ([#2551](#2551)) ([2b7f37a](2b7f37a)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
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.
Each exception class now declares its
error_codeandexit_codeas class attributes. Before, the codes were stated three ways: aCONST_ERROR_CODE_*constant, an__init__default, and a keyword that each subclass passed to its base again. Most__init__methods of the exception package only repeated their base for that reason.DevOpsCLIErrordeclareserror_code = "DEVOPS_CLI_ERROR"andexit_code = 1. Each subclass declares the one that differs from its base, and an instance takes its class's codes.exit_code=stays on the base and on the domain bases that took it, as an override for one instance.SubprocessError,ToolExecutionError,CosignError,CosignVerificationErrorand theerr_typeofcore/process.pyuse it for a failed subprocess's own status.error_code=goes, because no raise site set it.__init__methods go: the 17 that passed their own arguments to their base unchanged with their base's defaults, the 4 whose default message no caller used, and those of the 7 deleted classes. The 74 that stay add detail keys, build the message, or give an argument a default of its own.srcraises, catches or names go:ConstellationQuiesceError,ConstellationFailoverError,ConstellationResumeError,GitOpsSyncError,InsecureConfigError,SecretExposureErrorandInvalidVersionError, with their re-exports and the tests that only built them.CONST_ERROR_CODE_*constants, the 4CONST_GITHUB_*_ERROR_CODEconstants and the 10DEFAULT_*attributes go. The tests that read them compare with the code's string.docs/ERRORS.mdkeeps the code, exit status, domain and description of every remaining class, and loses the 7 rows of the deleted classes.CONTRIBUTING.mdsays how a class declares its codes, anddocs/SDLC.mdpoints to it.docs/ERRORS.md, an error built with no override to its class's codes, and every__init__to doing more than forwarding to its base.The source loses a net 495 lines. With the one exit seam, this completes #1006.
Closes #2490
Change:
openspec/changes/archive/2026-10-28-2490-exception-class-codes/