chore(#5056): gate evidence is typed and the exit code follows the verdict — Phase 8
Author: trek-eCreated Oct 1, 2026Updated Oct 1, 2026
Labelsarea: coreneeds-triagetype: chore
Pre-submission checklist
- This does not change user-facing behavior (commands, output, file formats, config)
- I have searched existing issues — this has not already been filed
Scope note on the first checkbox: gate payloads stay byte-identical. The one class of behavior change is stated in ADR-5057 §4 and #4686: a gate verb's exit status is now a function of its verdict, so a failing verdict no longer exits 0. It ships with a
Fixedchangeset.
What is the maintenance task?
Phase 8 of epic #5056 (ADR-5057 §4, third and fourth bullets): gate evidence is a typed result read through the document seams, and a gate verb's exit code is derived from its GateVerdict through the process exit contract (src/cli-exit.cts, ADR-3889). Depends on Phase 6 (merged in #5144).
Type of maintenance
Refactoring / code quality
Current state
Evidence<T> = found | none | unreadabledoes not exist. Gate return paths cannot tell "nothing there" from "could not read", so an unreadable input can produce a passing verdict.- Gates parse structured plan and document content with per-gate regexes instead of the Frontmatter Module,
markdown-sectionizer,markdown-tableandPlanningDoc. emitGateResultinsrc/check-command-router.ctsprints a verdict's payload and never sets an exit status;phase uat-passedandverify artifactsexit 0 while their JSON reports failure (#4686).
Proposed work
- Census per-gate regex parsers of structured content, gate return paths that cannot distinguish
nonefromunreadable, and gate verbs whose exit code is chosen per verb; publish the counts in the PR and drive them to zero. - Add
Evidence<T> = { kind: 'found', value: T } | { kind: 'none' } | { kind: 'unreadable', reason, span? }; a gate cannot produce a passing verdict fromunreadable. - Read structured content through the document seams; delete the per-gate regexes.
- Derive every gate verb's exit status from its
GateVerdictthroughcli-exit; no verb chooses its own. - Failing-first regression cases for #4562, #4541, #4259, #4686, #4031, #4176.
Done when
- Census published in the PR and driven to zero
-
Evidence<T>exists and does not admit a passing verdict onunreadable(type or property test, with a positive control) - Gates read structured content only through the document seams; per-gate regex parsers deleted
- Gate verbs obtain their exit code only through
cli-exit; a shell caller ofphase uat-passed --require-verificationandverify.artifactsgets a non-zero status whenever the verdict fails - A drift guard fails on a gate verb choosing its own exit code, with a positive control
- Tests pass under
gsd-test
Area affected
Multiple areas
Additional context
Epic: #5056. Design lock: ADR-5057 §4 and Phase 8. Evidence (Refs, all closed): #4562, #4541, #4259, #4686, #4031, #4176.
Source: open-gsd/gsd-core