fix(cli): emit ok:false envelope for failed history commands - #562
Open
pasmud wants to merge 2 commits into
Open
fix(cli): emit ok:false envelope for failed history commands#562pasmud wants to merge 2 commits into
pasmud wants to merge 2 commits into
Conversation
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.
Summary
A failed structured history command exited non-zero and reported an error on stderr, but still emitted an
ok: trueenvelope on stdout. This made automation that consumes structured stdout incorrectly classify failed commands as successful. This change makes the CLI emit anok: falseerror envelope on failure instead.Changes
In
sdk/typescript/src/cli.ts, thehistoryhelper previously caught workbench failures, wrote the error to stderr, set the exit code to 2, and returnedundefined. Because it returned normally, the Incur command framework produced a successful envelope withok: true. The helper now re-throws the error so the framework emits anok: falseenvelope. Thescans matchcatch block was updated the same way for consistency.Testing
sdk/typescript/tests-ts/cli.test.tscoveringscans show,scans list,scans compare, andscans matchwith--json: each asserts exit code 2, empty stdout (nook: true), and the error on stderr.bun test --timeout 30000 tests-ts/cli.test.ts: 140 pass, 0 fail.tsc --noEmit: clean.Risk and rollout
Low. The change only affects the structured envelope emitted for already-failing history commands; successful commands are unchanged. No schema or persisted-state changes.
Public disclosure review