Repository navigation
board-api suite hygiene: rc exit-status helper + BOARD_RUN_TOKEN hermeticity - #78
Merged
Merged
Conversation
…(dp#77) t/nt read the combined output and tolerate any exit status, so an exit code that drifts — a refusal from 2 to 1, a die decaying to success — passes them silently. Exit codes are pinned contract for the read verbs, and this epic hand-confirmed them live twice; `rc <expected> <label> <cmd…>` retires that manual pass. Same capture idiom as t/nt (combined output, herestring, no pipe), same ok/FAIL lines, same counter; it asserts the status alone. Thirteen rc drills in test-agent-grade-reads.sh pin what the reviews checked by hand: every board-search refusal arm at 2 (no argv, flags without a query, empty query, whitespace query, unknown flag, second positional, empty --states value, the gh arm's --states refusal), the claim-gate die at 1, and the served paths at 0 (populated search, empty result, gh delegate, board-show's run-context degrade). Adoption is opportunistic — existing t/nt drills stay. Two mutations confirm they discriminate where t/nt cannot: flipping the gh arm's --states refusal to exit 1, and swallowing the API arm's status with `|| true` before the verb's trailing `exit 0`. Both leave every t/nt drill green and fail only the rc drill. The suites also were not hermetic against an ambient BOARD_RUN_TOKEN: the client legitimately branches on it (claim-gate guard, board-show degrade), so an operator holding one turned ~17 pre-existing drills red. helpers.sh now unsets it at load. No drill anywhere reads an ambient value — every run context is opted into on the invocation itself (an env prefix, an `env VAR=` in a subshell, or the assignment written into a `bash -c` string), and the two sites that depend on its ABSENCE (test-edge-verbs' human-principal routes, test-client-core's "no BOARD_RUN_TOKEN" die) are what the unset guarantees.
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.
Closes #77 — both halves, tests-only (no plugin runtime touched, no version bump).
rc helper
rc <expected-code> <label> <cmd…>besidet/ntintests/claude-code/board-api/helpers.sh: asserts the exit STATUS and nothing else, same capture idiom (no pipes — the suite's known SIGPIPE trap), same counters and ok/FAIL format. 13 newrcdrills intest-agent-grade-reads.shretire the exit-code paths the PR #76 reviews confirmed by hand: usage/refusals exit 2 (no/empty query, unknown flag, dup positional, gh--states, empty--statesvalue), claim-gate die exit 1, degrade and happy paths exit 0.Discrimination proven by mutation: flipping the gh-arm refusal
exit 2 → 1and swallowing the API arm's status each left every existingt/ntdrill green and failed only thercdrill — exactly the silent-regression class the issue named. Both mutations reverted; the commit touches nothing underskills/.BOARD_RUN_TOKEN hermeticity
One
unset BOARD_RUN_TOKENathelpers.shload. The client legitimately branches on the variable (claim-gate guard, board-show degrade), so an ambient token changed what the suites were testing —test-read-verbs.shandtest-client-core.shfailed outright underBOARD_RUN_TOKEN=sneakybefore; all 14 mock suites pass under it now. A repo-wide grep shows no drill reads an ambient value: every run-context drill sets the bearer on its own invocation (inline prefix,envin a subshell, or inside itsbash -cstring), and the two drills that depend on the variable's absence are now guaranteed it.Verification
54 drills green in
test-agent-grade-reads.sh(41 + 13), also green on/bin/bash3.2.57;BOARD_RUN_TOKEN=sneakyacross all 14 board-api mock suites 14/14; full runner 18 passed / 0 failed / 8 ARKHO_DIR-gated skips; shellcheck clean.