Skip to content

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
gHashTag merged 1 commit into
masterfrom
t27o/golden-bitmask-g1
Oct 19, 2026
Merged

gHashTag merged 1 commit into
masterfrom
t27o/golden-bitmask-g1

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

What this is

The first golden port of step 4 of #9000 (analysis: #11149, docs/now/2026-10-20-golden-candidates.md). The hand-written bootstrap/src/host/bitmask.rs is replaced by a converted, reviewed and sealed spec and the Rust that t27c gen-rust writes from it. Nothing in the crate calls the module except the two lines of host/mod.rs, and those are unchanged in effect.

Closes #11156

Deleted and added

path change lines
bootstrap/src/host/bitmask.rs deleted (hand Rust; 96 of the 170 lines were #[cfg(test)]) -170
bootstrap/src/host/mod.rs line 26 pub mod bitmask; becomes the #[path = "../../gen/rust/host/bitmask.rs"] #[allow(...)] pub mod bitmask; mount; line 69 (pub use bitmask::{...}) untouched +1 / -1
specs/host/bitmask.t27 new spec: tri t27o output, reviewed, with a header, doc comments, the 14 tests of the hand file, 1 negative control, 11 oracle tests recorded from the hand file +351
bootstrap/gen/rust/host/bitmask.rs new, unedited t27c gen-rust specs/host/bitmask.t27 (force-added: bootstrap/gen is gitignored) +159
.trinity/seals/host_HostBitmask.json new seal +37

git diff --numstat --no-renames BASE...HEAD: 37/0 seal, 159/0 generated, 0/170 bitmask.rs, 1/1 mod.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 finds mod.rs lines 26 and 69, this spec, and four comment lines of specs/tools/t27o/rust_convert.t27. The public items that differ, and that nothing uses:

item hand file generated file
8 free pub const fn (mask, field_mask, extract, insert, is_set, set_bit, clear_bit, toggle_bit) const fn fn (same names, same parameter and return types); no const context uses them
5 FieldDesc methods (new, width, mask, extract, insert), all pub const fn methods free fns FieldDesc_new, FieldDesc_width, FieldDesc_mask, FieldDesc_extract, FieldDesc_insert, self_ first; nothing calls them
FieldDesc derives Debug, Clone, Copy, PartialEq, Eq Debug, Clone, Copy and cfg_attr(feature = "serde", ...); nothing compares two FieldDesc
popcount, trailing_zeros, leading_zeros, and the fields name: &'static str, high: u8, low: u8 identical names and types
extra public names in module host::bitmask, none re-exported by mod.rs count_ones_u32/_u64, leading_zeros_u32/_u64, trailing_zeros_u32/_u64 (spliced from tools::t27o::rust_std), B_UNDERSCORE, alpha, digit, same, word (spliced from tri::t27b::type_text, because an oracle test compares the name text)
cargo test -p t27c 591 #[test] under bootstrap/src/host 577: the 14 tests moved into the spec

The mount line carries unexpected_cfgs in its allow list (as cli/t27b does), so the serde cfg adds no warning; cargo check prints none for bitmask.rs.

Verification

  1. Spec, with t27c and t27b built by cargo build --release -p t27c -p t27b at 16c7dcf13 (the parent of this branch's base 7999992ff, 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, then t27c 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 --check on 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).
  2. The real crate (CARGO_TARGET_DIR shared, 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.
  3. 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 with rustc, scratch only, nothing committed. Every function is called with the same arguments on both; a result must be equal, or both must panic. Inputs: mask every u8 width; field_mask every (high, low) u8 pair (65,536); extract and insert over 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_zeros over those values, an exhaustive prefix, the same prefix shifted to the top and complemented, and xorshift randoms; every FieldDesc method over every (high, low) pair with 2 or 4 names.

    build comparisons disagreements both panicked (out-of-contract args)
    -C opt-level=0 -C overflow-checks=on (the dev and test profile) 18,740,716 0 12,850,733
    -C opt-level=3 -C overflow-checks=off (the release profile) 678,861,196 0 0
    -C opt-level=3 -C overflow-checks=on 58,630,156 0 12,850,733
    total 756,232,068 0

    The 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).

  4. Own-language, compiled from the merge base (7999992ff), as .github/workflows/own-language.yml does:

    • "Foreign-line budget": rc 0 on the numstat above. Control: 60 0 bootstrap/src/host/x.rs gives rc 1 ("more than 40 hand-written foreign lines added in one file"); the same budget fed 1/1 mod.rs, 0/170 bitmask.rs, 150/0 spec gives rc 0.
    • "Only t27" gate with git diff --name-status BASE...HEAD: rc 0.
  5. 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 (FieldDesc is declared by no other spec).
    • tri census pin --gate and tri 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.
  6. 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.c compiled with the main of needs-boundary.yml: exit 0).

Not run, and open points

  • tools/check_seal_coverage.py and tools/check_seal_currency.py over the whole corpus (they recompute the hashes of every seal): only this spec's t27c seal --verify.
  • A full cargo test -p t27c (only the host:: filter, plus cargo check --all-targets) and cargo build --release -p t27c on this head; the t27c and t27b used for item 1 were built before the mount existed, at 16c7dcf13.
  • The CI workflows themselves; the own-language and shape gates were reproduced locally from their workflow text.
  • Callers outside this repository: none searched here (the analysis of t27o golden PRs (step 4 of #9000), measured first: the 85 Rust files that convert whole, ranked by hand lines a port would delete #11149 read five checkouts and found none).
  • Four comment lines of specs/tools/t27o/rust_convert.t27 (9729, 11889, 11911, 11933) still name bootstrap/src/host/bitmask.rs and FieldDesc as 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.
  • No t27b ledger row (the steward's), no docs/now entry (optional).

🤖 Generated with Claude Code

…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>
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-19 21:16:59 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 47
PRs with All Checks Green 3
READY 2
FAILING 47
PENDING 0
NO CHECKS YET 0

These columns do not partition: 2 + 47 + 0 + 0 = 49, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=e34e1b174c96 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag

Copy link
Copy Markdown
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.

  1. Verilog widths (absurd-width ledger): red on master too (checks of 7999992 and 16c7dcf fail the same way). Both runs name the same two NEW specs, specs/widgets/bit_diff.t27 and specs/widgets/lut_treemap.t27 (2097151 bits each, from widgets: canvas draw-list protocol and fifteen more native pages in .t27 #11107). The run of this PR scanned 2,481 specs, one more than master's, and specs/host/bitmask.t27 is not among the hits; its Verilog has no width at or above 2^20. The failure set of this PR equals master's.
  2. t27b-native-ratchet: tri t27b ratchet: red -- UNLISTED 4, STALE 1. The four unlisted specs are specs/host/bitmask.t27 (this PR; the reference run passes it, so the steward adds its ledger row; docs/reports/t27b_expectations.json is not touched here, as agreed), specs/analog/sar_trace_raw.t27, specs/widgets/vcd_wrapped.t27 and specs/widgets/vcd_wrapped_logic.t27 (already on master). The stale entry is specs/ml/train_hslm.t27 (does not link in the reference run). UNEXPECTED FAILURE 0, UNEXPECTED PASS 0, MOVED 0.

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.

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.

t27o golden port 1 (step 4 of #9000): bootstrap/src/host/bitmask.rs becomes specs/host/bitmask.t27 and its generated Rust

2 participants