Repository navigation
t27o golden port 1: bootstrap/src/host/bitmask.rs becomes specs/host/bitmask.t27 and the Rust t27c gen-rust writes from it (Closes #11156) - #11157
Merged
Conversation
…bitmask.t27 and the Rust t27c gen-rust writes from it (Closes #11156) First golden port of step 4 of #9000. The 170-line hand file (96 lines of #[cfg(test)]) is deleted; its spec, converted by tri t27o and reviewed, is specs/host/bitmask.t27 (26 tests: the 14 of the hand file, one negative control, 11 oracle tests recorded from the hand file), sealed in .trinity/seals/host_HostBitmask.json. t27c gen-rust writes bootstrap/gen/rust/host/bitmask.rs, which host/mod.rs mounts by #[path] as module bitmask; the pub use line of mod.rs is unchanged, so no caller changes. Hand lines: +1 / -171 (the mount line replaces the pub mod line). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Owner
Author
|
CI result for head 6673508: 47 checks, 42 success, 3 skipped, 2 failure. Both failures are explained and neither is a defect of the port.
Everything else is green, including the own-language checks, the L1 check, the seal and spec guards, and the corpus gates run locally and listed in the description. |
gHashTag
marked this pull request as ready for review
October 19, 2026 21:29
This was referenced Oct 19, 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.
What this is
The first golden port of step 4 of #9000 (analysis: #11149,
docs/now/2026-10-20-golden-candidates.md). The hand-writtenbootstrap/src/host/bitmask.rsis replaced by a converted, reviewed and sealed spec and the Rust thatt27c gen-rustwrites from it. Nothing in the crate calls the module except the two lines ofhost/mod.rs, and those are unchanged in effect.Closes #11156
Deleted and added
bootstrap/src/host/bitmask.rs#[cfg(test)])bootstrap/src/host/mod.rspub mod bitmask;becomes the#[path = "../../gen/rust/host/bitmask.rs"] #[allow(...)] pub mod bitmask;mount; line 69 (pub use bitmask::{...}) untouchedspecs/host/bitmask.t27tri t27ooutput, reviewed, with a header, doc comments, the 14 tests of the hand file, 1 negative control, 11 oracle tests recorded from the hand filebootstrap/gen/rust/host/bitmask.rst27c gen-rust specs/host/bitmask.t27(force-added:bootstrap/genis gitignored).trinity/seals/host_HostBitmask.jsongit diff --numstat --no-renames BASE...HEAD: 37/0 seal, 159/0 generated, 0/170bitmask.rs, 1/1mod.rs, 351/0 spec. Hand-written lines: +1 / -171.Not touched:
docs/reports/t27b_expectations.json(the steward adds the row of a new spec), any census pin, any--bless.Signature differences (found by reading the generated file and by compiling the real crate)
No caller needs a change:
grep -rIn "host/bitmask\|bitmask\.rs\|host::bitmask\|FieldDesc"over the tree findsmod.rslines 26 and 69, this spec, and four comment lines ofspecs/tools/t27o/rust_convert.t27. The public items that differ, and that nothing uses:pub const fn(mask,field_mask,extract,insert,is_set,set_bit,clear_bit,toggle_bit)const fnfn(same names, same parameter and return types); no const context uses themFieldDescmethods (new,width,mask,extract,insert), allpub const fnFieldDesc_new,FieldDesc_width,FieldDesc_mask,FieldDesc_extract,FieldDesc_insert,self_first; nothing calls themFieldDescderivesDebug, Clone, Copy, PartialEq, EqDebug, Clone, Copyandcfg_attr(feature = "serde", ...); nothing compares twoFieldDescpopcount,trailing_zeros,leading_zeros, and the fieldsname: &'static str,high: u8,low: u8host::bitmask, none re-exported bymod.rscount_ones_u32/_u64,leading_zeros_u32/_u64,trailing_zeros_u32/_u64(spliced fromtools::t27o::rust_std),B_UNDERSCORE,alpha,digit,same,word(spliced fromtri::t27b::type_text, because an oracle test compares thenametext)cargo test -p t27c#[test]underbootstrap/src/hostThe mount line carries
unexpected_cfgsin itsallowlist (ascli/t27bdoes), so theserdecfg adds no warning;cargo checkprints none forbitmask.rs.Verification
Spec, with t27c and t27b built by
cargo build --release -p t27c -p t27bat16c7dcf13(the parent of this branch's base7999992ff, which only adds the candidates document):t27c test-report specs/host/bitmask.t27: 26 tests, 26 pass, 0 fail,vacuous passes 0 of 26.t27b test specs/host/bitmask.t27:HostBitmask: 26 passed, 0 failed, 26 total.t27c seal --save, thent27c seal --verify: spec, zig, verilog, c and rust hashes all MATCH.t27c coverage: 16 functions, 16 tested (100%).tri coverage --strict: gaps 0, coverage 5/5.tri t27o --checkon the hand file (before it was deleted): 25 passed, 0 failed (14 translated tests and 11 oracle tests; this PR adds the negative control as the 26th).The real crate (
CARGO_TARGET_DIRshared, one job at a time):cargo check -p t27c: ok.cargo check -p t27c --all-targets: ok (integration tests included).cargo test -p t27c host::: 138 test targets, 577 passed, 0 failed.Side-by-side run of the OLD hand file (
git show origin/master:bootstrap/src/host/bitmask.rs) and the generated file, one small driver compiled withrustc, scratch only, nothing committed. Every function is called with the same arguments on both; a result must be equal, or both must panic. Inputs:maskevery u8 width;field_maskevery (high, low) u8 pair (65,536);extractandinsertover those pairs with 8 values and 8 fields; the four single-bit fns over every u8 bit number and 132 values (all single bits, their complements, 2^k - 1, patterns, randoms);popcount,trailing_zeros,leading_zerosover those values, an exhaustive prefix, the same prefix shifted to the top and complemented, and xorshift randoms; everyFieldDescmethod over every (high, low) pair with 2 or 4 names.-C opt-level=0 -C overflow-checks=on(the dev and test profile)-C opt-level=3 -C overflow-checks=off(the release profile)-C opt-level=3 -C overflow-checks=onThe copy of the generated file used by the driver differs from the committed one only in the header comment line that counts the spec's tests (25 then, 26 now).
Own-language, compiled from the merge base (
7999992ff), as.github/workflows/own-language.ymldoes:60 0 bootstrap/src/host/x.rsgives rc 1 ("more than 40 hand-written foreign lines added in one file"); the same budget fed1/1 mod.rs, 0/170 bitmask.rs, 150/0 specgives rc 0.git diff --name-status BASE...HEAD: rc 0.Corpus gates, base against this branch:
python3 -I tools/dupe_scan.py:duplicate bodies: 1632 ... in 632 group(s)at both (17,561 bodies across 2,480 specs at the base, 17,564 across 2,481 here);--like specs/host/bitmask.t27: "nothing in this file is written elsewhere".python3 -I tools/check_devhome_paths.py: identical output (29 files, 37 occurrences, all pinned). No/Users/literal in the diff.tri types ratchet: identical,RATCHET: CLEAN, ledger 107 names, observed 107 (FieldDescis declared by no other spec).tri census pin --gateandtri hooks pre-commit:PASS: no pinned census moved.tri hooks commit-msg: L1 passed.python3 -I tools/check_duplicate_declarations.py: rc 0.python3 -I tools/l2_regen_check.py --base origin/master --head HEAD: rc 0.Issue t27o golden port 1 (step 4 of #9000): bootstrap/src/host/bitmask.rs becomes specs/host/bitmask.t27 and its generated Rust #11156 passes the shape gate (
gen/c/policy/issue_shape.ccompiled with the main ofneeds-boundary.yml: exit 0).Not run, and open points
tools/check_seal_coverage.pyandtools/check_seal_currency.pyover the whole corpus (they recompute the hashes of every seal): only this spec'st27c seal --verify.cargo test -p t27c(only thehost::filter, pluscargo check --all-targets) andcargo build --release -p t27con this head; the t27c and t27b used for item 1 were built before the mount existed, at16c7dcf13.specs/tools/t27o/rust_convert.t27(9729, 11889, 11911, 11933) still namebootstrap/src/host/bitmask.rsandFieldDescas the origin of converter test cases. They are provenance, not a path anything reads, and editing a sealed 12,000-line spec would stale its seal and conflict with the other converter lanes, so they are left as they are.docs/nowentry (optional).🤖 Generated with Claude Code