Skip to content

t27b: the body walks of lower.rs move to specs/tri/t27b/ast_walk.t27 (Closes #8249) - #8258

Merged
gHashTag merged 5 commits into
masterfrom
t27b-port-lower-ast-walk
Oct 9, 2026
Merged

gHashTag merged 5 commits into
masterfrom
t27b-port-lower-ast-walk

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Closes #8249. Port slice of #6198 (t27b written in t27), under #6063 and #5980. It follows #8235, whose specs/tri/t27b/type_text.t27 it reuses (use tri::t27b::type_text).

What moved

cli/t27b/src/lower.rs walked a fn body of the t27c AST with hand-written recursions over compiler::Node. These walks move to specs/tri/t27b/ast_walk.t27:

  • name_count: uses of a name, or of a dotted path starting with it;
  • name_mentions with its word_in: those uses, plus size, type, field and return-type texts that name it as a word. The occurrences follow str::match_indices: left to right, no overlap, and an empty name at every char boundary.
  • discard_count: _ = name; statements;
  • mentions: an identifier with that name;
  • mutated: the reference's collect_mutable_names;
  • zig_mutates, with its rooted;
  • the declaration count of shadow_names;
  • is_value_stmt and zig_renders.

How the AST reaches the spec. gen-rust takes no Rust struct, and passes only a []const u8 parameter by reference. Any other slice it passes by value (#8102), and a walk calls its helpers many times. So a list of nodes reaches the spec as two byte texts:

  • one record per node in preorder: 72 bytes holding its kind, the end of its subtree, and the start and end of eight text fields;
  • then the text itself.

flat in lower.rs writes them in 17 lines. A compile-time assert! pins NodeKind's discriminants to the spec's K_ codes, so a reordered NodeKind stops the build instead of misreading a kind. A node's children run from its index + 1 to its subtree end, each child's own end naming the next. Every walk here is a count or an any over the whole tree, so the order of the visit does not matter. t27c gen-rust writes gen/rust/tri/t27b/ast_walk.rs, mounted in lower.rs as aw. Each walk keeps its Rust signature, with a one-line body: let (a, t) = flat(ns); aw::....

This byte form is how later ports can reach the collectors that remain, such as array_locals, calls_in, ref_mutable_names and strength_reduced.

Lines

lines
hand Rust deleted (cli/t27b/src/lower.rs) 96
hand glue added (cli/t27b/src/lower.rs, the only foreign file: flat, the assert, the mount, nine bodies) 31
net hand Rust under cli/t27b/ -65 (on master 3ac8bef: src 14694 -> 14629, tests 8284 unchanged; lower.rs 8021 -> 7956)
generated (gen/rust/tri/t27b/ast_walk.rs) 436
.t27 (specs/tri/t27b/ast_walk.t27) 726
seal (.trinity/seals/t27b_T27bAstWalk.json, closure: type_text.t27) 32

The AGENTS.md remainder line goes from 14694 plus 1222 (15916) to 14629 plus 1222 (15851), with tests unchanged at 8284 (wc -l, after merging master 3ac8bef from master's side, which includes #8252).

Gate

Both gates ran with master's gen/c/policy/own_language.c (with #8236's net rule):

  • check_budget on git diff --numstat --no-renames: exit 0. That is 31 added and 96 deleted foreign lines, all in one file.
  • check_all with origin/master:tools/policy/foreign-exceptions.txt: exit 0.

Evidence that nothing changed

  • Oracle. The spec's tests build small trees by hand. Their expected values are what the deleted Rust returns on the same trees.

  • Differential (t27c lab, a throwaway program, not committed). It used a copy of master's NodeKind and Node, master's walks copied verbatim, and flat plus the generated walks, with debug assertions and overflow checks.

    • It ran on 400,000 random forests of 1 to 3 trees, up to 5 levels deep. Their nodes were drawn from all 35 kinds, weighted toward assignments, identifiers, indexes, fields, unary, calls and locals. The names included x, _, xyz.w, x.push, *, undefined and the empty name. The ops included =, += and &. The texts included [N]u8, xN and é N.
    • Each forest was checked against 14 names: 5,600,000 pairs, with all seven walks compared on each.
    • is_value_stmt and zig_renders were also checked on all 35 kinds.

    Every result is identical.

  • t27c test-report. 18 of 18 pass, 0 vacuous.

  • tri mutate spec. 272 mutants: 257 killed, 0 survived, 12 hung and 3 unviable.

    • All 12 hangs are a loop the mutant made endless.
    • The unviable ones empty a void test helper, which gen does not lower.
    • A first round found 4 survivors. Three were dead writes of record bytes nothing reads, now removed. The fourth was a test gap at the end of the text, now covered.
  • Seal. t27c seal --save, then --verify: all hashes MATCH.

  • cargo test --release -p t27b on the t27c lab (x86_64), at the head f0610d9 (master 3ac8bef merged in): 138 passed, 0 failed, no warnings.

Corpus receipts (#7686)

On the t27b lab, from /work/t27, with /work/t27c-master corpus-receipt compare BASE HEAD --challenge <mine> --challenge-head <mine>:

base "3ac8bef8745acb751fbbae7d2ebbfc9d7952f842" AUTH_MISSING_NONE FRESH leaves-bound true
head "f0610d9c056523bf6c390dc0ec23e1f8c216aeaf" AUTH_MISSING_NONE FRESH leaves-bound true
  input only-head specs/tri/t27b/ast_walk.t27
  verdict only-head specs/tri/t27b/ast_walk.t27
  output only-head specs/tri/t27b/ast_walk.t27
  lane improved specs/tri/t27b/ast_walk.t27
totals false inputs false verdicts false outputs false: IMPROVED_ONLY
exit=3

Verdict: IMPROVED_ONLY (exit 3). The only lane line is the new spec itself, which t27b passes (18 of 18). Every other file keeps its verdict and its t27b asm digest. A strict EQUIVALENT (exit 0) is not possible for a port that adds a spec under specs/.

Ledger. The final head 26e9194 merged master 95ae4bc in from master's side. It added the rows of the lane's two specs that had none: ast_walk.t27 (pass), and source_text.t27 from #8252 (blocked on type i128, unimplemented). max_not_pass went from 19 to 20 for that one blocked spec. cargo test --release -p t27b at 26e9194: 138 passed, 0 failed, no warnings.

gen-rust gaps

No new one is filed. #8102 (a read-only slice parameter becomes an owned Vec) is why the u32 fields of a record are read from bytes. If #8102 is fixed, the records could become []const u32.

🤖 Generated with Claude Code

…loses #8249)

name_count, name_mentions (with its word_in), discard_count, mentions,
mutated, zig_mutates, shadow_names' declaration count, is_value_stmt and
zig_renders are now t27c gen-rust of specs/tri/t27b/ast_walk.t27
(gen/rust/tri/t27b/ast_walk.rs), mounted in lower.rs as `aw`.

gen-rust passes only a []const u8 parameter by reference (#8102) and
takes no Rust struct, so a list of nodes reaches the spec as bytes: a
fixed record per node in preorder (kind, subtree end, eight text spans),
then the text. `flat` in lower.rs writes them; a compile-time assert pins
NodeKind's discriminants to the spec's codes. Each walk keeps its Rust
signature as one line of glue.

A differential of the deleted walks against the generated ones agrees on
5,600,000 random (forest, name) pairs and on all 35 node kinds.

Hand Rust under cli/t27b: 96 lines deleted, 31 added, net -65. See #6198.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-09 16:37:25 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 49
PRs with All Checks Green 1
READY 0
FAILING 49
PENDING 0
NO CHECKS YET 0

These columns do not partition: 0 + 49 + 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)=557cd271f4e3 != 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).

No conflict; it moves the head onto a master whose corpus receipt the lab
signs, so the lane compare has a base.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-09 17:46:37 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 43
PRs with All Checks Green 7
READY 0
FAILING 43
PENDING 0
NO CHECKS YET 0

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

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=557cd271f4e3 != 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).

AGENTS.md keeps both remainder entries, #8050 then this one, re-measured
with wc -l (14698 plus 1222, tests 8284).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-09 19:00:27 UTC

Summary

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

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

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=557cd271f4e3 != 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).

AGENTS.md keeps both remainder entries, #8248 then this one, re-measured
with wc -l (14629 plus 1222, tests 8284).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-09 19:10:43 UTC

Summary

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

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

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=557cd271f4e3 != 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).

…#8249)

AGENTS.md keeps both remainder entries, #7876 then this one, re-measured
with wc -l (14622 plus 1222, tests 8284).

docs/reports/t27b_expectations.json gets the rows of the two lane specs
without one: specs/tri/t27b/ast_walk.t27 passes in t27b, and
specs/tri/t27b/source_text.t27 (#8252) is blocked on `type i128`
(unimplemented); max_not_pass 19 -> 20 for that one blocked spec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-09 19:59:42 UTC

Summary

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

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

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=557cd271f4e3 != 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
gHashTag disabled auto-merge October 9, 2026 20:06
@gHashTag gHashTag added compiler and removed compiler labels Oct 9, 2026
@gHashTag
gHashTag enabled auto-merge (squash) October 9, 2026 20:06
@gHashTag
gHashTag merged commit ab5b3b7 into master Oct 9, 2026
37 of 41 checks passed
gHashTag pushed a commit that referenced this pull request Oct 9, 2026
…7812)

Master brings #8258 (lower.rs's body walks move to ast_walk.t27). Conflicts
were the AGENTS.md remainder line (re-measured with wc -l) and the ledger
(rows kept from both sides, max_not_pass recounted from the rows). Hand lines
under cli/t27b against ab5b3b7: net -21.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Oct 9, 2026
…ed (Closes #7902)

Master brings #8258 (lower.rs's body walks move to ast_walk.t27). Conflicts
were the AGENTS.md remainder line (re-measured with wc -l) and the ledger
(rows kept from both sides, max_not_pass recounted from the rows). Hand lines
under cli/t27b against ab5b3b7: net -5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Oct 9, 2026
…Closes #7909)

Master brings #8258 (lower.rs's body walks move to ast_walk.t27). Conflicts
were the AGENTS.md remainder line (re-measured with wc -l) and the ledger
(rows kept from both sides, max_not_pass recounted from the rows). Hand lines
under cli/t27b against ab5b3b7: net -7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dmitrii-f-t27 added a commit that referenced this pull request Oct 9, 2026
…ll; 12 t27b rows (#8375)

Closes #8361

duplicate-bodies: has_at (specs/tri/t27b/ast_walk.t27, #8258) is the body of
starts_with (source_text.t27). An import typechecks and ast_walk's 18 tests
pass, but t27c gen-rust emits the call without a `use`, and
cli/t27b/src/lower.rs mounts ast_walk.rs as its own module, so cli/t27b would
not build. One line, has_at 2.

scan: the skill read `git -C /Users/playom/t27 config --get core.hooksPath`;
every worktree shares that config, so `git config --get core.hooksPath` says
the same without a developer's home path.

t27b-native-ratchet: rows for the 12 specs the ratchet listed as UNLISTED in
run 37993522616 (t27b-native on ef75683), each as that run judged it with
the reference passing: 10 pass, base/types.t27 blocked on `type [N]T`,
math/constants.t27 blocked on `ExprCall(@Rem)` (both unimplemented).
max_not_pass 18 -> 20, the two new blocked rows; no existing row moves.
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.

t27b: move the body walks of lower.rs (name_count, mutated, zig_mutates and more) to specs/tri/t27b/ast_walk.t27

2 participants