Repository navigation
spec: seal --verify owes the committed gen file; compile refuses a hand-written output (#10457) - #10472
Merged
Conversation
…nd-written output Two follow-ups of #10457, both reproduced on the Railway lab with t27c built from master 982894c, written as .t27 with tests and negative controls. specs/verified/gen_file_check.t27 (follow-up A). `seal --verify` regenerates every backend in memory and never opens bootstrap/gen/ or gen/: a digest_cache.rs cut to 200 bytes, and a bench_boards.rs with a hand-appended fn, both verified "all hashes MATCH", exit 0. The rule compares a committed gen file with what `t27c gen-<backend>` emits today, not with the recorded gen_hash_*: gen-rust and gen-c resolve `use` first and seal does not, so for bench_boards, die_binding and claw/gates the untouched file differs from the seal while equal to its generator. 61 of the 124 committed gen files hash to a recorded seal value, 63 do not. Absent is not drift; unreadable and no-longer-generated fail closed; the file check adds to the seal check. 12 tests, 0 vacuous. specs/compiler/compile_output.t27 (follow-up B). `t27c compile specs/x/k.t27` overwrote a hand-written k.zig (k.v, k.c with --backend), and `-o specs/x/k.t27` replaced the spec with its own Zig output, all exit 0. The rule: the input spec is never the output; no file, write; -o naming the path is consent; otherwise write only when "generated by t27c" is in the first 5 lines, and refuse an unreadable file. All 75 committed outputs next to a same-stem spec carry the marker (14 on line 2, 61 on line 3), so the rule refuses none of them. 10 tests, 0 vacuous. Sealed without --force, --verify all hashes MATCH. Eight hand-made mutants (four per spec) each fail at least one test. t27b passes both natively (aarch64 under qemu, 22 tests), recorded in docs/reports/t27b_expectations.json. Refs #10457 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gHashTag
enabled auto-merge (squash)
October 18, 2026 13:25
Contributor
This was referenced Oct 18, 2026
Merged
This was referenced Oct 18, 2026
This was referenced Oct 18, 2026
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.
Refs #10457 (follow-ups A and B of issue comment 6250250375). Spec only: no Rust changes. The t27c change that applies these rules is a separate draft PR, which waits for the owner.
What the lab showed
Railway lab, t27c 0.5.2 built from master 982894c, fixtures in .t27 only.
A.
seal --verifynever reads the committed gen filet27c seal <spec> --verifybootstrap/gen/rust/verified/digest_cache.rstruncated to 200 bytesMATCHlines,all hashes MATCH, exit 0pub fn hand_edit() {}appended tobootstrap/gen/rust/verified/bench_boards.rs(compiled into t27c via#[path])all hashes MATCH, exit 0B.
t27c compileoverwrites whatever is at its output pathspecs/x/k.t27t27c compile specs/x/k.t27, with a hand-writtenspecs/x/k.zigpresentwrote specs/x/k.zig, exit 0, hand-written line gone--backend verilogwithk.v,--backend cwithk.ct27c compile specs/x/k.t27 -o specs/x/k.t27wrote specs/x/k.t27, exit 0; the spec was replaced by its own Zig outputThe finding that changed rule A
As first proposed, rule A said a committed file must hash to the recorded
gen_hash_*. That false-alarms on untouched files.sealhashes the generation of the unresolved source, butgen-rustandgen-c(which write the committed files) resolveusefirst:usegen-<backend>todayAll four seals verify, and claw/gates.c is one of the six files spec-guards already proves fresh. Over the tree, 61 of the 124 committed files under
gen/andbootstrap/gen/hash to some value a seal records, and 63 do not. So the spec compares the file with what its generator emits today (resolved, or unresolved when gen-rust/gen-c fall back), and keeps the recorded-hash rule as a negative control.The specs
specs/verified/gen_file_check.t27:gen_file_check()returns OK, ABSENT, DRIFT, UNREADABLE or ORPHAN. ORPHAN means the backend no longer generates the spec.producer_hash()handles the fallback, andverify_passes()requires the seal check AND every committed file. 12 tests use the measured hash prefixes. The negative controls show that today's verify passes the truncation, that the recorded-hash rule refuses untouchedusespecs, and that fresh files do not rescue a mismatched seal.specs/compiler/compile_output.t27:output_check()checks, in order:-oor not.-onaming the path is consent: write.generated by t27cis in the first 5 lines.All 75 committed
.zig/.v/.c/.rsfiles next to a same-stem spec carry the marker, 14 on line 2 and 61 on line 3, so the rule refuses none of them. 10 tests. The negative controls cover today's overwrite, a head of 2 lines (which would refuse generated C and Verilog), and refusing every existing file.Evidence
t27c test-report: 12/12 and 10/10 pass, 0 vacuous.t27c seal --save(no--force);--verifyprintsall hashes MATCHfor both.-ochecked before the spec guard: 2 fail.passindocs/reports/t27b_expectations.json.Out of scope
compile-allandcompile-project, which write into an output directory they are given.sealandgen-<backend>, which print to stdout.🤖 Generated with Claude Code