Skip to content

ProofRun v0.1: local verification receipts for AI coding agents - #1

Merged
yebiguo merged 7 commits into
mainfrom
v0.1-dev
Aug 13, 2026
Merged

yebiguo merged 7 commits into
mainfrom
v0.1-dev

Conversation

@yebiguo

@yebiguo yebiguo commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

Full v0.1 per the project plan: bind a check command's exit code and duration to the exact git state (HEAD + working-tree diff fingerprint) it ran against, so a receipt goes STALE the moment code changes by even one byte.

  • proofrun init / run <name> -- <cmd> / status [--strict] / report [--json]
  • Core STALE-detection logic (internal/receipt.Evaluate) — only ever PASS/FAIL/STALE/NOT RUN, never inferred
  • Command runner with real process-tree timeout handling (a smoke test caught a real Windows bug: killing only the direct child left grandchildren holding stdout open, silently defeating --timeout; fixed with taskkill /T / process-group kill)
  • Cross-platform CI (ubuntu/macos/windows-latest) actually running go test, not just cross-compiling
  • goreleaser release pipeline, gated on tests, producing binaries for windows/amd64, linux/amd64+arm64, darwin/amd64+arm64
  • First release published and verified by actually downloading and running the binary: v0.1.0-alpha
  • Dogfooded on this repo itself (.proofrun.yml checked in): ran real go test/go build/go vet checks, confirmed all PASS, edited a tracked file and confirmed all three flipped to STALE, reverted and confirmed they returned to PASS
  • Self-reviewed (4-angle pass) before opening this PR; findings were release-pipeline robustness gaps (release now gates on tests, tag trigger tightened to semver-only) plus two minor README fixes — no correctness bugs in the core logic

Draft per the project's own collaboration workflow — opened for read-only review before merge.

Test plan

  • go test ./... passes (Windows locally; ubuntu/macos/windows via CI)
  • Manual + automated: run check -> PASS -> edit tracked file -> STALE -> status --strict exits 1
  • goreleaser cross-platform release published and the actual binary downloaded + run successfully
  • README + dogfooding on this repo

.goreleaser.yml cross-builds proofrun for windows/amd64, linux/amd64+arm64,
and darwin/amd64+arm64, ldflags-injecting version/commit/date into the
binary (rootCmd.Version, exposed as --version — a flag, not a new
subcommand, so the CLI surface stays at exactly the four planned
commands). .github/workflows/release.yml runs goreleaser via
goreleaser-action on any `v*` tag push and publishes to GitHub Releases.

Verified: `go build`/`go vet`/`go test -v` all pass on ubuntu-latest,
macos-latest, and windows-latest via the Day 5 CI workflow (this dev
machine can only execute tests on Windows directly). Local cross-compiles
for all four target platforms succeed.
README leads with the one-line pitch, an install/demo block, and the
"an agent saying tests pass is a claim, not a fact" framing, then the
CLI reference, .proofrun.yml format, explicit out-of-scope list, and how
the fingerprint is computed.

Checked in this repo's own .proofrun.yml (test: go test ./..., build:
go build ./..., vet: go vet ./...) and dogfooded it directly: ran all
three checks (all PASS), appended a comment to internal/git/git.go and
confirmed all three immediately flipped to STALE, then reverted the edit
and confirmed they returned to PASS — the fingerprint is content-addressed
against current git state, not an event log, so reverting to
byte-identical code makes the prior receipt valid again without a re-run.
goreleaser's default {{ .ProjectName }} resolves to the repo name's
actual casing (ProofRun), producing ProofRun_linux_amd64.tar.gz — but
the README's install command references lowercase proofrun_*.tar.gz,
which would 404. Caught this by actually checking the first release's
asset list instead of assuming the config was right.
Self-review (4-angle pass) on the Day 6-7 diff surfaced no correctness
bugs but several release-pipeline robustness gaps:

- release.yml now runs go build/go vet/go test before invoking goreleaser
  — previously a pushed tag would build and publish binaries from
  whatever commit it pointed at, without that commit necessarily having
  passed the main test.yml CI (a tag isn't required to point at a
  tested commit).
- Tag trigger tightened from `v*` to `v[0-9]+.[0-9]+.[0-9]+*` so a stray
  non-semver tag can't kick off a release that goreleaser then fails to
  parse.
- Removed `before.hooks: go mod tidy` from .goreleaser.yml — go.sum is
  already tidy, so the hook had no upside and a real downside: if it
  ever rewrote go.mod/go.sum mid-release, goreleaser's dirty-tree check
  would abort the release.
- README: fixed a lowercase/uppercase inconsistency in the install URL
  (github.com/yebiguo/ProofRun -> proofrun, matching the module path
  everywhere else — cosmetic since GitHub URLs are case-insensitive, but
  worth being consistent) and documented the --version flag.
…/macOS-blind release gate

External review (2 MUST FIX, 1 SHOULD FIX) verified against the actual
binary before fixing anything — all three reproduced exactly as reported:

MUST FIX 1 — receipt.Evaluate never checked that a stored result's actual
command matched what .proofrun.yml declares for that check, so
`proofrun run test -- true` recorded a real PASS for a check config
declares as `test: go test ./...`, and `status --strict` happily let it
through (verified: exit 0). Added EvaluateAgainstCommand: when a check is
declared in config with a specific command, a stored result for any other
command can never read as PASS or FAIL — only NOT RUN, with an
Evaluation.Note explaining the mismatch (not a fifth status; Note is
descriptive text alongside the existing four). Wired into status/report
via evaluateAll. Re-ran the exact exploit against the fixed binary: now
correctly NOT RUN, `--strict` exits 1. Added unit + integration
regression tests for both the forged-PASS and forged-FAIL directions.

MUST FIX 2 — the README's install curl command 404s. Root cause is
deeper than the reported /latest-vs-prerelease issue: this repo is
private (per the original plan: private until stable), so no
unauthenticated curl can fetch release assets at all right now,
regardless of URL casing or pinning — verified empirically (curl 404s
even against the exact browser_download_url from the API). Rewrote the
install section to lead with `gh release download` (verified working
end-to-end against the real release) and note both the privacy and the
prerelease/`/latest` caveats explicitly, with the plain curl form
included as a comment for once the repo goes public.

SHOULD FIX 3 — release.yml's test gate ran only on ubuntu-latest before
invoking goreleaser, so a tagged commit's Windows/macOS-specific behavior
(tree_windows.go / tree_unix.go) was never actually exercised by the
release pipeline itself. Split into a `test` job running the full
ubuntu/macos/windows matrix and a `goreleaser` job that `needs: test`.
@yebiguo

yebiguo commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

Review response

Verified all 3 findings myself before fixing anything (reproduced each one against the actual binary rather than trusting the report text):

MUST FIX 1 (command-forging) — confirmed exactly as reported: proofrun run test -- true against a config declaring test: go test ./... recorded PASS and status --strict exited 0. Fixed with receipt.EvaluateAgainstCommand: a check declared in .proofrun.yml with a specific command can now only read PASS/FAIL if the stored result's actual command matches exactly — any mismatch is NOT RUN with an explanatory note, never a 5th status. Re-verified against the corrected binary: same exploit now reports NOT RUN, --strict exits 1. Added unit + integration regression tests for both the forged-PASS and forged-FAIL directions.

MUST FIX 2 (install URL) — confirmed the 404, but the root cause was deeper than the /latest-vs-prerelease framing: this repo is private, so no unauthenticated curl can fetch release assets at all right now (verified empirically — even the exact browser_download_url from the API 404s anonymously). Since going public wasn't my call to make unilaterally (the project plan explicitly says private until stable), I rewrote the install section to lead with gh release download (verified working end-to-end) and documented both the privacy and prerelease caveats, with the plain curl form included for once the repo goes public.

SHOULD FIX 3 (Ubuntu-only release gate) — confirmed by inspection. Split release.yml into a test job running the full ubuntu/macos/windows matrix and a goreleaser job with needs: test.

All three fixes verified end-to-end against the actual re-published v0.1.0-alpha release (downloaded the real binary, re-ran the exploit, confirmed it's closed) — see commit a40e010. The originally-published release (built from the pre-fix commit) was deleted and re-cut from the fixed commit so the live artifact doesn't carry the gap.

Ready for another pass whenever convenient.

EvaluateAgainstCommand (added last round) treats expectedCommand == ""
identically to "not declared" — but .proofrun.yml has no non-empty
validation on Check.Command, so `command: ""` with `required: true` was
a legal config that re-opened exactly the hole the last fix closed:
`proofrun run test -- true` + status --strict exited 0. Reproduced
against the current binary before fixing.

Root-caused rather than patched around: config.Load() now rejects any
check with an empty (or whitespace-only) command outright. That's a
stronger invariant than special-casing the empty string downstream —
it means anything present in cfg.Checks is guaranteed to have a real
command, so EvaluateAgainstCommand's `expectedCommand == ""` check is
now only ever true for checks that genuinely aren't declared in config.
status/report already propagate config.Load() errors, so an invalid
config now fails loudly (`error: .proofrun.yml: check(s) with an empty
command: test`, exit 1) instead of silently allowing a forged PASS.

Re-verified against the rebuilt binary: the exact repro now errors
instead of exiting 0. Verified no regression on this repo's own valid
.proofrun.yml (build/test/vet all still PASS with --strict exit 0).

The `strings.Join(argv, " ")` command-identity comparison was also
flagged as a SHOULD FIX (false-negative NOT RUN for legitimately quoted
arguments, not a false PASS) — deferred per reviewer guidance since it
doesn't block this fix cycle.
@yebiguo

yebiguo commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

Review response (round 2)

Verified the MUST FIX before fixing (reproduced against the actual binary): command: "" + required: true in .proofrun.yml, then proofrun run test -- true, then status --strict — confirmed exit 0. Real gap, same root cause as last round (raw string used as the "declared or not" signal), just a different way in.

Root-caused rather than patched at the evaluation layer again: config.Load() now rejects any check declared with an empty (or whitespace-only) command outright — error: .proofrun.yml: check(s) with an empty command: test, exit 1. That makes "declared in config" and "has a real command" the same guarantee everywhere downstream, so EvaluateAgainstCommand's empty-string check is now only ever true for checks genuinely absent from config. Re-verified against the actual re-published binary (commit d36539e): both this exploit and the round-1 exploit (command: go test ./... satisfied by true) now correctly report NOT RUN/error and --strict exits 1. No regression on this repo's own valid .proofrun.yml (build/test/vet still PASS, --strict exits 0).

On the SHOULD FIX (strings.Join losing argv structure for quoted arguments) — agreed it's a real false-negative, and agreed it doesn't block this cycle since it can't produce a false PASS. Leaving it for a follow-up rather than folding it into this fix, to keep this round's diff scoped to what was actually reported.

v0.1.0-alpha was deleted and re-cut again from the fixed commit (learned from last round: explicitly checked git rev-parse v0.1.0-alpha^{commit} against HEAD before pushing this time, since the tag-recreation step silently no-op'd once already in the previous round and I almost re-published the vulnerable build).

…sion false PASS

Verified before fixing: []string{"go","test","-run","TestCritical","./..."}
and []string{"go","test","-run","TestCritical ./..."} are genuinely
different commands — the second runs zero tests (the "./..." got
absorbed into the -run regex by shell quoting) and exits 0 even in a repo
where the real test would fail — but strings.Join(argv, " ") collapses
both to the identical string "go test -run TestCritical ./...". Built a
repro repo with a test that fails when actually run, confirmed the
mis-quoted variant exits 0 with zero tests executed, and confirmed
`proofrun status --strict` accepted it as PASS. A genuine false PASS via
completely ordinary CLI usage, no receipt tampering involved.

Root-caused per reviewer guidance: don't patch the string comparison
(re-tokenizing with a shell parser isn't viable cross-platform, per
AGENTS.md's Windows/macOS/Linux target), change what's being compared.
.proofrun.yml's `command` field is now a YAML list (argv), not a
shell-style string:

    command: [go, test, -run, TestCritical, ./...]

EvaluateAgainstCommand now compares with slices.Equal instead of
string-joining either side, so the two argvs above are correctly
distinguished. This is a breaking schema change, done deliberately now
rather than patched around later — the repo is still private/pre-1.0
with no external consumers of the old string format yet, so this is the
cheapest point at which to fix it.

Re-verified against the rebuilt binary: the exact repro now reports
NOT RUN with a diagnostic showing the differing argv, `--strict` exits 1.
No regression on this repo's own .proofrun.yml (converted to array
syntax; build/test/vet still PASS, `--strict` exits 0) or on the
round-1/round-2 exploits (still correctly blocked).
@yebiguo

yebiguo commented Aug 13, 2026

Copy link
Copy Markdown
Owner Author

Review response (round 3)

Verified the escalated MUST FIX before fixing (built a real repro repo with a test that fails when actually run): go test -run TestCritical ./... and go test -run "TestCritical ./..." are genuinely different argvs (5 elements vs 4 — the second absorbs ./... into the -run regex via shell quoting) but strings.Join(argv, " ") collapses both to the identical string. Confirmed the mis-quoted variant runs zero tests and exits 0, and confirmed proofrun status --strict accepted it as PASS for a config declaring the correct command. A genuine false PASS via ordinary CLI usage — no receipt tampering needed.

Fixed exactly as suggested: .proofrun.yml's command field is now a YAML list (argv), not a shell-style string, and EvaluateAgainstCommand compares with slices.Equal instead of joining either side. This is a breaking schema change (command: pytest → command: [pytest]), made deliberately now rather than patched around — no external consumers of the old format exist yet.

Re-verified against the actual re-published binary (commit 709b870) — ran all three exploits from all three review rounds against it directly:

  1. Command mismatch (true vs go test ./...) → NOT RUN, --strict exits 1
  2. Empty command (command: []) → config load error, exits 1
  3. Argv collision (this round's finding) → NOT RUN with a diagnostic showing the differing argv, --strict exits 1

No regression: this repo's own .proofrun.yml (converted to array syntax) still shows all three checks PASS with --strict exiting 0, and cross-compilation for all four release targets still succeeds.

@yebiguo
yebiguo marked this pull request as ready for review August 13, 2026 00:59
@yebiguo
yebiguo merged commit 74c3572 into main Aug 13, 2026
7 checks passed
@yebiguo
yebiguo deleted the v0.1-dev branch August 13, 2026 00:59
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