Skip to content

fix(cli): verdicts reach the exit code — am verify no longer exits 0 on FAIL (v0.3.0) - #3

Merged
bhyi4 merged 1 commit into
mainfrom
fix/verdict-exit-codes
Aug 14, 2026
Merged

fix(cli): verdicts reach the exit code — am verify no longer exits 0 on FAIL (v0.3.0)#3
bhyi4 merged 1 commit into
mainfrom
fix/verdict-exit-codes

Conversation

@bhyi4

@bhyi4 bhyi4 commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

What

Every CLI path exited 0 regardless of verdict. am verify && deploy proceeded on a tampered ledger — the 🔴 FAIL existed only in stdout.

Found live, not hypothetically: a commit↔ledger binding tool trusted the exit code, and its own tamper demo (a byte-flipped ledger) came back green while am verify's output plainly said "seal mismatch — content modified". The verdict machinery was correct end to end; the last inch to the caller was missing.

Changes

command before after
verify, verify-peer, verify-sig always 0 1 on FAIL, 0 on OK/WARN
attest always 0 0 only on ATTESTED; 1 on CONTENT-MISMATCH / NOT-FOUND
record, history, witness, cross, keygen always 0 unchanged (no verdict to carry)

report() now returns the worst level it printed; _cli() returns an int (the [project.scripts] wrapper already sys.exits it, and __main__ now raises SystemExit).

Compatibility

Scripts that parse the output are unaffected. Scripts that trusted the exit code were reading a constant — any change is strictly more information. Minor bump to 0.3.0 because observable CLI behaviour changes.

Verification

  • tests/ 50/50, including 7 new subprocess-level exit-code checks — one is the exact tampered-ledger case the defect shipped.

Merge is triage-owned — this session stops at PR submission.

🤖 Generated with Claude Code

…on FAIL (v0.3.0)

Every CLI path exited 0, so `am verify && …` proceeded on a tampered ledger;
the printed 🔴 FAIL was the only signal. Found live: a commit-binding tool
trusted the exit code and its tamper demo (byte-flipped ledger) came back
green while the output plainly said "seal mismatch — content modified".

verify / verify-peer / verify-sig → exit 1 on FAIL (0 on OK/WARN);
attest → 0 only on ATTESTED (1 on CONTENT-MISMATCH and NOT-FOUND);
record / history / witness / cross / keygen keep exiting 0.

tests 50/50 (7 new subprocess-level exit-code checks, including the exact
tampered-ledger case the defect shipped).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@bhyi4

bhyi4 commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator Author

머지: 대장님 건별 승인(4건 일괄, 순서 머지). CI 그린·MERGEABLE 재확인. 트리아지=B였고 사람 결정으로 머지.

@bhyi4
bhyi4 merged commit d59ea1d into main Aug 14, 2026
4 checks passed
@bhyi4
bhyi4 deleted the fix/verdict-exit-codes branch August 14, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant