Skip to content

feat(t27c): t27c asm / t27c disasm run specs/isa/t27a.t27 through gen-rust (Closes #6507) - #6862

Merged
gHashTag merged 1 commit into
masterfrom
sieve/t27c-asm-disasm
Oct 6, 2026
Merged

gHashTag merged 1 commit into
masterfrom
sieve/t27c-asm-disasm

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Closes #6507

Owner approval, 2026-10-06, on #6507: "add the label yourself, do the work, do not ask about labels". Label owner-approved-foreign.

#6789 landed the spec half: specs/isa/t27a.t27 and the T736 table in specs/isa/ternary_encoding.t27. This PR lands the two parts #6789 had parked, both on the Rust side. The emulator side is gHashTag/trinity#1437.

What

  • t27c asm [file|-] and t27c disasm [words...] (bootstrap/src/main.rs).
    • Every assemble/list decision is specs/isa/t27a.t27, lowered by t27c gen-rust into the checked-in bootstrap/gen/rust/isa/t27a.rs. The table has no second home.
    • main.rs only splits lines, parses word tokens and prints. Each bad line is reported by number.
    • An undefined byte is listed as .word N.
  • The old asm command is removed. It parsed a .t27 file and then emitted the same three hard-coded instructions whatever the input was.
  • Two gen-rust lowerings in bootstrap/src/compiler.rs, without which t27a.rs did not compile (5 x E0277, 6 x E0308):
    • a string is indexed through .as_bytes();
    • x.len is typed usize when len is not a struct field.
  • bootstrap/stage0/FROZEN_HASH moves with compiler.rs to 0ec05a8c..., per CONTRIBUTING "Build speed".
  • bootstrap/tests/t27a_cli.rs, 7 tests:
    • the checked-in Rust is byte-identical to fresh gen-rust output;
    • the words the spec pins come back out of asm and disasm;
    • disasm | asm returns all 256 low bytes and 2048 pseudo-random words;
    • ill-formed text and tokens are refused;
    • a gen-rust fixture that indexes a string compiles under -D warnings and runs.
  • .trinity/seals: 104 resealed with the new binary and zig 0.16.0. gen-rust output moved for 52 specs plus their twin seals, and for 8 specs outside specs/. Three seals that feat(isa): t27a MVP -- TRI-27 assembler/disassembler round-trip (Refs #6507) #6789 landed with absolute /Users/... spec_path values are relative now.
  • tools/policy/foreign-exceptions.txt lists the test and FROZEN_HASH under the approval. main.rs is already listed for t27c test-report: count executed asserts and flag vacuous passes (sieve C10, T730) #6509.
  • specs/isa/t27a.t27 header: the "parked" note now says where the CLI lives. Resealed, 10/10 tests.

Evidence

All runs are on the Railway t27c lab. No cargo ran on the Mac. The lab tree was checked by sha256 against every tracked file of this commit before the runs.

Check Result
cargo test --release -p t27c --test t27a_cli 7 passed
cargo test --release -p t27c, whole crate on master c4dfa27 2919 passed, 0 failed
tools/check_seal_coverage.py rc=0; 1472 seals, 1330 hold, 142 known-broken (unchanged ledger)
tools/check_seal_currency.py rc=0; 1347 current (1344 with the compiler before this change), STALE 0

rustc on gen-rust output, master binary vs this one:

  • t27a: 11 errors to 0.
  • lexer: 2 errors to 0.
  • mse_loss: 1 error to 0.
  • tri/net/http (33 to 34) and aho_corasick (28 to 29) keep their pre-existing range-slice lowering error, which now surfaces one step later.

gitleaks was run by hand on the commit: no leaks.

Not done here

T27A_CONSUMER_GAP in specs/isa/ternary_encoding.t27 stays until gHashTag/trinity#1437 merges. That PR is labelled, auto-merge is on, and it is waiting on checks. Removing the marker earlier would make a false claim, and editing that spec would also move the vendored generated file's hash.

🤖 Generated with Claude Code

…-rust (Closes #6507)

Owner, 2026-10-06, on issue #6507: "add the label yourself, do the work,
do not ask about labels" -- label owner-approved-foreign. This lands the
part of #6507 that was parked for that label.

- bootstrap/gen/rust/isa/t27a.rs: `t27c gen-rust specs/isa/t27a.t27`,
  checked in. The T736 field table and every assemble/list decision live
  only in the spec; main.rs splits lines and prints.
- bootstrap/src/main.rs: `t27c asm [file|-]` writes one 0x%08x word per
  instruction line and names each bad line; `t27c disasm [words...]` (or
  stdin) lists each word, `.word N` for an undefined byte. The old `asm`
  command is gone: it parsed a .t27 file and then emitted the same three
  hard-coded instructions whatever the input said.
- bootstrap/src/compiler.rs: gen-rust indexes a `string` through
  `.as_bytes()` and types `x.len` as usize when `len` is not a struct
  field. Without both, t27a.rs did not compile (5 x E0277, 6 x E0308).
  FROZEN_HASH moves with it (3c78f3c7.. -> 0ec05a8c..).
- bootstrap/tests/t27a_cli.rs: 7 tests -- the checked-in Rust is
  byte-identical to fresh gen-rust output; asm and disasm give the words
  the spec pins; disasm | asm returns all 256 low bytes and 2048
  pseudo-random words; ill-formed lines and tokens are refused; a gen-rust
  fixture that indexes a string compiles under -D warnings and runs.
- .trinity/seals: 104 seals resealed with the new binary and zig 0.16.0,
  because gen-rust output moved for 52 specs (and their twin seals) plus 8
  outside specs/. Three seals that #6789 landed with absolute spec_path
  values (isa_T27a, isa_Tri27Encoding, theory_CompilerTheoryIsaRoundTrip)
  are relative now.
- tools/policy/foreign-exceptions.txt lists the test and FROZEN_HASH
  under the approval (main.rs is already listed for #6509).

Evidence, Railway t27c lab, never cargo on the Mac:
- cargo test -p t27c --test t27a_cli: 7 passed.
- cargo test --release -p t27c (whole crate, on master c4dfa27): 2919
  passed, 0 failed.
- check_seal_coverage: rc=0, 1472 seals, 1330 hold, 142 known-broken.
- check_seal_currency: rc=0, 1347 current (base 1344), STALE 0.
- rustc on gen-rust output, base vs this binary: t27a 11 -> 0 errors,
  lexer 2 -> 0, mse_loss 1 -> 0; tri/net/http and aho_corasick keep their
  pre-existing range-slice error one step later (33 -> 34, 28 -> 29).

The trinity side (decoder.zig on the same table) is a separate PR in
gHashTag/trinity (#1437); T27A_CONSUMER_GAP stays until it lands.

Closes #6507

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

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-06 14:09:14 UTC

Summary

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

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

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=0ec05a8c1a46 != 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 merged commit 75cf4e5 into master Oct 6, 2026
32 of 37 checks passed
gHashTag added a commit that referenced this pull request Oct 6, 2026
Master's #6862 already resealed the three t27a seals with repo-relative
paths; take master's copies. Only the orbitofrontal_value.t27 parse fix
remains in this PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gHashTag added a commit that referenced this pull request Oct 7, 2026
…ec outside it (Closes #6913) (#6925)

* fix(t27c): seal records spec_path relative to the store, refuses a spec outside it (Closes #6913)

compute_seal_hashes stored spec_path exactly as typed. #6789 sealed with
absolute paths and committed three seals (isa_T27a, isa_Tri27Encoding,
theory_CompilerTheoryIsaRoundTrip) naming the sealing agent's worktree;
check_seal_coverage then failed every PR with "3 seal(s) newly do not hold
[dangling]" until #6862 rewrote the three paths by hand. Second effect of the
same line: run_seal's twin refresh matches spec_path by string, so an
absolute-path --save left the repo-relative twins stale without a word.

seal_spec_path() now records the path relative to the working directory
(the directory .trinity/seals resolves against): `.` dropped, absolute and
`..` forms canonicalized against the canonical cwd (macOS /var ->
/private/var included), `/` separators. A spec outside the working directory
is refused with the reason instead of recorded.

seal_duplicates.rs pins it: an absolute, a ./ and a .. spelling of one spec
each record specs/probe/dup.t27 and refresh the poisoned twin; a spec in
another directory is refused and nothing is written. foreign-exceptions.txt
gains the test file under the owner's standing approval (#6913).

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

* fix(t27c): seal_spec_path names std::env and PathBuf in full; the file-scope imports sit in a nested module (Closes #6913)

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

* chore(policy): drop the #6847 one-time block as master did in #6898, so master merges clean (Refs #6913)

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

* chore(policy): take master's exception list plus the seal_duplicates.rs entry, so master merges clean (Refs #6913)

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

owner-approved-foreign Owner-approved exception to the only-t27 rule: hand-written foreign code allowed in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

t27a MVP: TRI-27 assembler/disassembler with a round-tripping field table (T735, T736)

1 participant