Repository navigation
t27c seal: wire seal_write.t27 into the seal writers -- refuse collisions, recheck, stage then rename (Closes #10454) - #10466
Merged
Merged
Conversation
This was referenced Oct 18, 2026
Contributor
gHashTag
marked this pull request as draft
October 18, 2026 13:29
This was referenced Oct 18, 2026
Merged
…ions, recheck, stage then rename (Closes #10454) #10458 put the rules for one seal write in specs/verified/seal_write.t27, but nothing in t27c called them. This commit makes the three seal writers call the code generated from that spec. The Rust left in main.rs and service.rs is I/O glue only. No second spec: seal_identity.t27 is the same as on master. seal_write.t27 gains the rules the glue needed that it did not have, each with a test and a negative control: - dest_allowed(code, force): --force lifts WRITE_OWNER_UNKNOWN (a torn or legacy seal) and never WRITE_COLLISION (another spec's file). - gens_check(code, gens_same) and WRITE_GEN_MOVED: generating the spec a second time must give the recorded gen hashes. - SEAL_STAGE_SUFFIX ".part": the staging file is .<seal>.part-<pid>, which is not a *.json seal name. 19 tests, 19 pass, 0 vacuous. The glue: - run_seal finds the destination with names_collide (exact or case-folded), reads its spec_path, and asks dest_check and dest_allowed before any write. - write_seal_atomic stages the bytes beside the seal, syncs, lets post_write_check + gens_check judge the staged file, then renames. Any other answer removes the stage and leaves the old seal. - tested = the hash of the spec bytes test-report built its tests from (new Report.read field); after = the spec hashed again after the tests. - The twin seals and frontier --reseal go through the same staged write. On the Railway lab, at master 1c83555 plus this commit: - check: OK. test-report seal_write.t27: 19/19, 0 vacuous. - seal --save, then seal --verify of seal_write.t27: all hashes MATCH. The committed gen file's sha256 equals the seal's gen_hash_rust. - Collision: the second spec is refused, with or without --force; the first spec's seal is byte-identical afterwards. - Torn seal: refused without --force, replaced with --force, parses. - Spec edited mid-seal, at ten points from 0.05 s to 0.6 s: all ten are refused ("the spec changed while it was being sealed"), and no seal file is left. - No .part file left behind in any control. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 18, 2026
gHashTag
force-pushed
the
claude/seal-write-guard
branch
from
October 18, 2026 13:54
a21034a to
ec5af19
Compare
gHashTag
marked this pull request as ready for review
October 18, 2026 13:55
Contributor
PR DashboardGenerated at: 2026-10-18 14:01:58 UTC
Summary
Seal Status
|
This was referenced Oct 18, 2026
Merged
Merged
This was referenced Oct 18, 2026
Contributor
PR DashboardGenerated at: 2026-10-18 16:55:13 UTC
Summary
Seal Status
|
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 #10454
What changes
#10458 put the rules for one seal write in
specs/verified/seal_write.t27(module VerifiedSealWrite), but nothing in t27c called them. This PR makes the three seal writers call the code generated from that spec (bootstrap/gen/rust/verified/seal_write.rs, fromt27c gen-rust):run_seal, with its twin seals;frontier --resealwrite-back.The Rust left in
main.rsandservice.rsis I/O glue only.One home for the rules. An earlier version of this PR kept its own copy of these rules in
seal_identity.t27. That copy is gone, andseal_identity.t27is the same as on master. Rules the glue needed thatseal_write.t27lacked were added there, each with a test and a negative control:dest_allowed(code, force)--forceliftsWRITE_OWNER_UNKNOWN(a torn or legacy seal) and neverWRITE_COLLISION(another spec's file).force_lifts_an_unknown_owner_and_never_a_collision,negative_control_force_for_everything_would_reopen_the_collisiongens_check(code, gens_same),WRITE_GEN_MOVED = 6a_second_generation_must_give_the_recorded_code,negative_control_the_spec_check_alone_misses_moved_gensSEAL_STAGE_SUFFIX = ".part".<seal>.part-<pid>, which is not a*.jsonseal name.the_stage_suffix_is_not_a_seal_nameHow the glue calls it
Before any write.
names_collide(exact or case-folded) picks the destination.spec_pathis read.dest_checkanddest_alloweddecide.--force. A seal with no readablespec_pathis refused unless--forceis given.Stage, judge, rename.
write_seal_atomic(STAGE_THEN_RENAME):post_write_checkandgens_checkjudge the staged file;Any other answer removes the stage and leaves the old seal untouched. The inputs to
post_write_check:tested: the hash of the spec bytestest-reportbuilt its tests from (newReport.readfield).after: the spec hashed again after the tests.readback_equal: the staged file read back.Twins and
frontier --resealgo through the same staged write. A twin that fails is now named and fails the command; before, it was skipped silently.Line counts. Foreign lines:
main.rs+39/−80,test_report.rs+4,service.rs+1/−1. That is 44 added, within the foreign budget.hash_pairsreplaces two hand-spelled lists of the five seal hashes, and the twin loop is folded..gitignoregains.trinity/seals/.*.part-*.Evidence (Railway lab, x86_64, master 1c83555 plus this PR)
t27c check specs/verified/seal_write.t27is OK.test-reportgives 19/19 tests passing, 0 vacuous.seal --save, thenseal --verifyonseal_write.t27: all hashes MATCH. The committed gen file's sha256 (3d720a32…) equals the seal'sgen_hash_rust.specs/zzseal1/same/x.t27andspecs/zzseal2/same/y.t27both declaremodule ZzCollide.--force. The message names the owner.7ee284ef…), and the first spec reseals fine.--force("names no readable spec_path"). With--forceit is replaced, and the result parses.frontier --resealran in its own process group, and the group was SIGKILLed at 29 s, 38 s, 47 s, 56 s and 65 s..trinity/seals/*.jsonfiles parse..part-file is left over..part-file.cargo test -p t27c --no-fail-fastran 138 test targets: 2999 passed, 0 failed, 2 ignored. The unit tests insrc/main.rswere 1842 passed.CI reds that are not from this PR
clamp01copied 3 times since #10452#10460 and #10462 fixed the Corpus and test-ratchet reds from the old head; both are in master now.
Overlap. #10464 (
claude/seal-write-fix, draft) wires the same spec intomain.rs. One of the two should be closed.🤖 Generated with Claude Code