Repository navigation
fix(proof): harden the proof runner against the gaps review found - #92
Conversation
- Refuse a gate section without exactly one system-browser alternative; only --chromium runs noticed a missing one. - Recognize the browser suite as an invocation (`npm run e2e` as one shell command, after any NAME=value assignments), not a substring, so `echo npm run e2e` cannot stand in for it. - Read `git status -z`, so untracked names with spaces, quotes, or non-ASCII characters are hashed under their real names instead of git's quoted display text (which made changes to them invisible). - Treat SIGTERM like Ctrl-C for the run, so a cancelled CI job or stopped container still leaves an interrupted receipt; termination is ignored while the receipt is written and the previous handler restored. --self-test covers each, and reverting each fix fails it. Refs #80 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d5e85be59f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Local proof receipt: passed (
|
| Step | Seconds |
|---|---|
| guard | 0.0 |
| web check + build | 21.3 |
| fmt | 0.5 |
| clippy | 4.3 |
cargo test |
164.5 |
| build | 0.4 |
| browser suite (56) | 354.5 |
- Tree
d6861703bb34dc0799151abc1addc33ec076c821; unchanged during the run. receipt.jsonsha256cc6d6dec7a230c1e9b605ddd10cc95dfb61a01c4cac7cbb50f6962770754f9e9- The receipt marks the tree dirty for one reason:
scripts/__pycache__/proof.cpython-313.pycwas deleted locally. It is a bytecode file chore(proof): run the documented gates and leave a receipt #82 committed by mistake, its removal is in release: version the product as 0.1.0 with a traceable build identity #88, and it is not a gate input.
Generated by Claude Code
Splitting on && || ; by hand accepted `: # ; npm run e2e`, which sh reads as a comment. Lex with shlex (quotes and comments honored; an unreadable line is refused) and split commands only at &&, so any other operator stays inside its command and can never equal the marker. Refs #80 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 659cb56056
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A SIGTERM during a step terminated only the outer sh, so subshells, npx, or test servers could keep writing after the runner snapshotted the candidate. Each step now leads its own process group, which is sent SIGTERM and then SIGKILL before the receipt is written. git status reports a worktree rename of an intent-to-add file in the Y column; only X was checked, so its source path was parsed as a record and the next entry was swallowed as the source. Both columns are checked now. Self-test cases cover both; each fails against the previous code. Refs #80 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e14b05685
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f5b81243e5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The parser cannot prove a shell line reaches the suite: `exit 0 && npm run e2e` reads as an invocation and exits 0 without running anything. Rather than chase each shell construct, the runner now points CONSOLEBOOK_E2E_REPORT into the receipt directory, the Playwright config adds a JSON reporter when it is set, and the browser step passes only when that report exists with at least one expected test and no unexpected ones. The counts and report hash go into the receipt. Self-test: the unreachable-suite line, a zero-test report, and a passing report; disabling the check fails four cases. Refs #80 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc6fc91296
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| stats = json.loads(report.read_text())["stats"] | ||
| counts = {k: int(stats[k]) for k in ("expected", "unexpected", "flaky", "skipped")} | ||
| except (OSError, ValueError, KeyError, TypeError) as e: | ||
| return None, f"the browser suite's report is unreadable: {e}" | ||
| evidence = {"report": report.name, "sha256": sha256_file(report), **counts} | ||
| if counts["expected"] < 1: | ||
| return evidence, "the browser suite ran no tests" | ||
| if counts["unexpected"]: | ||
| return evidence, f"the browser suite reported {counts['unexpected']} unexpected results" |
There was a problem hiding this comment.
Prevent forged reports from passing the browser gate
A gate line such as printf '{"stats":{"expected":3,"unexpected":0,"flaky":0,"skipped":0}}' > "$CONSOLEBOOK_E2E_REPORT" && exit 0 && npm run e2e is recognized by runs_e2e, exits successfully before invoking Playwright, and is accepted here as a passing suite report. The new self-test at lines 595–605 explicitly reproduces this false pass, so an edited CONTRIBUTING.md can again produce a receipt claiming browser verification that was never run. Do not treat JSON at an environment-exposed, gate-writable path as evidence that the suite executed.
AGENTS.md reference: AGENTS.md:L93-L95
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not fixing this one; it's outside what a local runner can defend. The path you describe needs a gate line in CONTRIBUTING.md written to forge evidence. Anyone who can land that edit can also edit scripts/proof.py, web/playwright.config.ts, the e2e npm script or the specs. A child process the runner executes can always write whatever bytes the runner would accept, and no check of those bytes can authenticate them. The self-test at those lines is a fixture standing in for Playwright; it is not a demonstration of a gap.
The report check targets honest drift, which it does catch:
- a suite that finds zero tests (wrong
testDir, a stray--grep); - an
e2escript that no longer runs Playwright; - a failure masked by
|| true; - a line that never reaches the suite.
c36bf17 (pushed right after this reply) writes that threat model into the module docstring. It says what the runner trusts and that the receipt records CONTRIBUTING.md's hash, so review sees which definition ran. Future reviewers and agents can then weigh deliberate-forgery findings against it instead of growing the parser.
Generated by Claude Code
A second SIGTERM during stop_group's grace period raised out of it before the SIGKILL pass, so a TERM-ignoring child could outlive the receipt. The SIGKILL pass now runs in a finally with SIGINT and SIGTERM held until the group is reaped. A self-test case sends the runner two SIGTERMs from a TERM-ignoring step; the previous code fails it. The module docstring now says what the runner defends against (honest drift) and what it trusts (the reviewed gate definition and the code it runs), so a gate written to deceive the runner is not chased as a parser bug. Refs #80 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c36bf17c06
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Finalization ignored only SIGTERM, so a second Ctrl-C after an interrupted gate raised during candidate_state or artifact collection and left the receipt directory with only step logs. Both signals are now blocked while the receipt is finalized and delivered once it is written. A self-test case sends a second SIGINT from inside finalization; the previous code leaves no receipt. Refs #80 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e6502da5c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Masking signals inside stop_group left a few-instruction window between the grace-period wait and the mask in which a second Ctrl-C or SIGTERM could raise before the SIGKILL pass. Rather than narrow windows one at a time, the run's SIGINT and SIGTERM handler now raises once and absorbs repeats, so no repeat can preempt the cleanup the first one started. stop_group drops its own mask; the grace period becomes STOP_GRACE_S. Self-test: the handler raises once and absorbs the next call (removing the absorb fails it), both previous handlers are restored, and a TERM-ignoring step that signals the runner twice cannot write after the grace period. Refs #80 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
Brings #89's latest state (probe follows the bind, release workflow on every pull request, ADR 0023 for the installation lifecycle, and main through #92) into this branch. - release.yml: the upgrade step keeps both the backup warning check and the move to 127.0.0.2:7771. - The backup ADR becomes ADR 0024, since the installer ADR took 0023; every reference is renumbered, and ADR 0024 cites ADR 0023 for the unit's writable paths. - ADR 0023 now records --data-dir, --backup-dir, and the paths.conf drop-in this branch adds. Refs #90 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
Primary Issue
Refs #80 (closed by #82). This follow-up fixes the review findings on #82's final commit, plus the findings raised on this PR as it went.
Problem And Outcome
scripts/proof.pycould produce receipts that overstated what ran or what was checked. After this PR, each gap below fails closed or keeps its evidence.Changes
Parsing the gate sequence
CONSOLEBOOK_E2E_CHROMIUM=alternative is required, and it must invoke the suite.shlex, so quotes and#comments are honored and an unreadable line is refused. Lines split only at&&. A browser step must contain a command that is exactlynpm run e2e, soecho npm run e2e,| true,|| true,; trueand: # ; npm run e2eare refused.Runtime evidence for the browser suite
exit 0 && npm run e2e). So the runner pointsCONSOLEBOOK_E2E_REPORTinto the receipt directory, andweb/playwright.config.tsadds a JSON reporter when that variable is set.Candidate state
git status --porcelain=v1 -z, so non-ASCII names are hashed under their real names.Interruption
STOP_GRACE_S, so no child can write after the receipt is taken.Threat model, now in the module docstring: the runner catches honest drift. It trusts the reviewed gate definition and code; it cannot authenticate a gate written to deceive it, and the receipt records
CONTRIBUTING.md's hash.Correction rung: 2 (mechanical). Each fix has a
--self-testcontrol, and each control was mutation-checked by reverting its fix and watching it fail.Scope
scripts/proof.py, the reporter hook inweb/playwright.config.ts, and the receipt description in.agents/skills/consolebook-proof/SKILL.md.Verification
Candidate revision:
1e07ef5.b094731d7d1f, unchanged during the run. The browser suite reported 57 expected, 0 unexpected, report sha256346e70c8….receipt.jsonsha2568cea762982be3cde7e1d307a1210fda9ffb4b626030f74c7de258b792d6c77e8.interruptedreceipt, and no Playwright, Chromium or server processes survived.fmt-clippy-testpassed on1e07ef5.1e07ef5. One finding, a forged report written by a deceptive gate line, is declined under the threat model above and left open for the maintainer.Review And Merge Notes
stop_groupand_interrupt, and thee2e_evidencecontract with the Playwright config.🤖 Generated with Claude Code
https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
Generated by Claude Code