Unify not_found CLI exit code to 2 across commands #49
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Two merged/in-flight slices give the same error class different CLI exit codes:
life item get <unknown>(#9)not_foundlife operation get <unknown>(#6)not_foundThe two issue specs disagreed: #9's acceptance criteria said "
not_found(HTTP 404, CLI exit 1)", #6's said "If 404: exit 2 with error codenot_found".Resolution
docs/technical/cli-api.mddefines exit 2 as "Invalid input/configuration" and exit 1 as "Other failure, including authentication/authorization". A caller naming an ID that does not exist is a caller input error, not an infrastructure failure, so exit 2 is correct andlife item get's exit 1 is the outlier.What to build
not_foundresolve to exit 2 consistently. The cleanest cut is at the source:ApiFailure::not_foundcurrently setsexit_code: GENERAL_ERROR; it should carryINVALID_INPUTso every route agrees, with the CLI's per-command override inlife operation get(operation_exit_code) removed once it is redundant.not_found, unchanged envelope shape.not_foundso the mapping is uniform.Acceptance criteria
life item get <unknown-id> --jsonexits 2 (was 1), HTTP 404,error.code == "not_found".life operation get <unknown-id> --jsonstill exits 2.Notes
preparedoperation state was only asserted at the HTTP envelope and never throughlife operation get, leaving the CLI state matrix unpinned for exactly the mapping the override had protected. Fixed by extending the existingseed_prepared_createfixture with a real CLI invocation (tests/crash_recovery_tests.rs::operation_get_exits_six_for_a_durably_prepared_operation); re-review approved at head89551bf.POST /v1/replansanswers HTTP 200status: partialwitherror.code: not_found, and because the status is the semantic outcome it decides before the error code, that envelope exits 6 rather than 2.not_found(items, operations, proposals, lifecycle, update, plans, context add/search, scoped preflight, router fallback); all now exit 2. Two furthernot_foundstrings (CalendarError::error_code(),HindsightError::NotFound) were checked and are not response surfaces.test resultlines (41 test binaries plus lib/main/doc result lines).Blocked by
None — small, self-contained; can ride with the next slice that touches
src/api/mod.rsorsrc/cli.rs.