Repository navigation
Description
Problem or Motivation
Part 1 of #1006. A command reports a DevOpsCLIError in four ways, and some commands do not report it at all (checked at origin/main 08d70ca, 2026-10-28):
OTelTyper(exit_on=<class>)(src/devops_cli/core/cli.py) reports one error class for each app. 14 apps pass it:gh(10),pr(2),openspecandvalkey.- 40
with exit_on_error(<class>):blocks in 15 command modules report one class for one block. - 21
except <class> as exc: ... raise typer.Exit(exc.exit_code)sites write the report by hand:commands/cloudflare.py(9),commands/valkey.py(9),commands/sandbox.py,commands/telemetry.pyandcommands/scan.py. commands/config.pybuilds a plaintyper.Typer, so its commands do not pass through theOTelTyper.commandwrapper.
A DevOpsCLIError that no block catches leaves the command, _delegate (src/devops_cli/main.py) logs it with a traceback and re-raises it, and the process ends with status 1 instead of the error's exit_code.
Proposed Solution & Architectural Design
- The wrapper in
OTelTyper.commandreports everyDevOpsCLIErrorthat a command raises:print_error(exc.message, safe=True), thentyper.Exit(exc.exit_code), with no traceback. An app callback that runs as a command (invoke_without_command=True) gets the same report. exit_on=, theexit_on_errorblocks in commands and the hand-rolled sites are deleted.exit_on_errorstays only as the wrapper's implementation.commands/config.pybuilds its app withnew_typer().- An exception that is not a
DevOpsCLIErrorpropagates as it does today.
Target Subsystem
src/devops_cli/core/cli.py and src/devops_cli/commands/.
Existing Tool Considered
Click owns the exit: typer.Exit carries the status, and Click's standalone mode ends the process with it. The seam is one except in the wrapper that every command already passes through. A click.ClickException subclass for DevOpsCLIError was considered: Click prints it with an "Error:" prefix and its own format, which would change every error line, and the error classes would depend on Click.
Acceptance criteria
- A command registered on
new_typer()that raises aDevOpsCLIErrorsubclass with Rich markup in its message exits with that class'sexit_code, prints one error line with the markup escaped, and prints no traceback. - The same holds for an app callback with
invoke_without_command=True. - No module under
src/devops_cli/commands/passesexit_on=, usesexit_on_error, or raisestyper.Exit(exc.exit_code)from anexceptof aDevOpsCLIError. - A test walks the registered apps and finds no plain
typer.Typer. - The exit status of each command stays the same for each error class.
- The tests run offline.
Related
Parent: #1006. Sibling: the exception classes declare their codes as class data. Related: #1372.
Source: #1006
Activity
dan-petty commentedon Oct 28, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
The change consolidates four error-reporting patterns into one wrapper without altering user-facing exit codes or messages.It removes a class of silent-failure bugs but does not block a release or fix a critical defect.It eliminates inconsistent error reporting across 15 command modules and prevents future commands from missing the report.It touches the core wrapper, 15 command modules, and requires new and updated tests, but each change is mechanical.Both work on the DevOpsCLIError exception system, but #1877 changes what exceptions domain code raises while this candidate changes how the CLI boundary catches and reports them.chore(main): release 0.11.0 (#2501)