Repository navigation
Implement part 1 of 2 of the empty bodies in specs/ml/transformer/norm.t27 (8 functions) #6420
Description
Re-filed from #4775. An attempt claimed that issue on 2026-09-24 and left an empty branch, and a dispatch row that has spent its retry ceiling keeps its issue for good - so no bee could take it again, however much the brief improved. The work below is carried over unchanged.
Re-filed from #4439. An attempt claimed that issue on 2026-09-20 and left an empty branch, and a dispatch row that has spent its retry ceiling keeps its issue for good - so no bee could take it again, however much the brief improved. The work below is carried over unchanged.
Re-filed from #3860. An attempt claimed that issue on 2026-09-17 and left an empty branch, and a dispatch row that has spent its retry ceiling keeps its issue for good - so no bee could take it again, however much the brief improved. The work below is carried over unchanged.
Context
specs/ml/transformer/norm.t27 holds 11 functions declared with a body that contains no statement. It is split into 2 issues because one turn cannot carry them all.
All 2 parts name the same file, so they share one boundary and cannot run at the same time — the swarm holds the file for whoever has it. They must be done in order, and the check below stops you if you arrived out of turn.
.t27 is the hand-authored source language. t27c compiles it out to C, Rust, Verilog and Zig. You are writing source, not compiler output.
Before you start
$ cd /Users/playom/t27
$ t27c gen specs/ml/transformer/norm.t27 2>&1 | grep -c 'not yet implemented'
11 # if it is not 11, this part is not yours yet — stop
What to write
Keep every signature exactly as it is. Quoted verbatim:
- line 82 —
fn init(config: NormConfig) -> NormState - line 95 —
fn forward(state: NormState, input: []gf16::GF16) -> ForwardResult - line 107 —
fn forward_strand(strand: Strand, input: []gf16::GF16) -> ForwardResult - line 114 —
fn backward(state: NormState, result: ForwardResult, grad_output: []gf16::GF16) -> NormGradients - line 122 —
fn backward_strand(strand: Strand, result: ForwardResult, grad_output: []gf16::GF16) -> NormGradients - line 128 —
fn update(state: NormState, grads: NormGradients, lr: gf16::GF16) -> NormState - line 135 —
fn normalize_vector(x: []gf16::GF16, eps: gf16::GF16) -> []gf16::GF16 - line 145 —
fn phi_init_gamma(hidden_size: u32) -> []gf16::GF16
Add a test block for each function you implement.
Acceptance criteria
-
t27c gen specs/ml/transformer/norm.t27 > /tmp/t27-gen.zig && grep -c 'not yet implemented' /tmp/t27-gen.zigprints3(on arrival: 11)
-
t27c spec-status specs/ml/transformer/norm.t27does not printNOPARSE- the file still parses. (This replaces a parse-metrics criterion. The compiler in the container prints no such metrics, so the command printed nothing and no work could ever satisfy it.)
-
- with criterion 1 satisfied, all 8 names above still exist:
grep -cE '^\s*(pub )?fn (init|forward|forward_strand|backward|backward_strand|update|normalize_vector|phi_init_gamma)\(' specs/ml/transformer/norm.t27prints8
- with criterion 1 satisfied, all 8 names above still exist:
Boundary
specs/ml/transformer/norm.t27
The instruments
Every one of these reads and prints; none of them writes. Run them from the repository root, with <spec> replaced by the file in `## User Scenarios & Testing
- Given
specs/ml/transformer/norm.t27as it stands today,
when the work described above is done and the commands under Acceptance criteria are run from the repository root,
then each of those commands prints the value stated beside it.
Requirements
- FR-001: every signature already in the file MUST stay exactly as it is - the signature is the contract, and a caller elsewhere is holding it.
- FR-002: the file MUST still parse afterwards.
t27c parse specs/ml/transformer/norm.t27is the check, and a spec that stops parsing generates nothing, so every test it already carried stops running too. - FR-003: no function MUST be deleted to satisfy a count.
Boundary`:
t27c spec-status <spec>- the compiler's one-word verdict: IMPLEMENTED, PARTIAL, UNWRITTEN, NOPARSE, NOFN. Exit code is 0 whatever it says, so read the word.t27c symbols <spec>- every name the file declares, with its kind. Answers "does this already exist here?" before you add it.t27c outline <spec>- per function: its locals, what it calls, what it returns. The contract you are implementing against.t27c coverage <spec>- which functions have a test and which do not. The issue asks for tests; this is how you check you wrote them.t27c lint <spec>- style and shape warnings. It OVER-REPORTShas no test or invariant: measured 2026-09-20 over 60 specs it printed 677 of those wherecoveragefound 190 untested functions, disagreeing on 59 of the 60 - it warns aboutbit_to_trit_pairinspecs/base/ternary_encoding.t27, whichtest bit_to_trit_pair_zerocalls on line 249. Read it as a hint;coverageis the answer.t27c typecheck <spec>- types, before generation. PrintsTypecheck OK (0 errors, 0 warnings)or the errors.t27c test-report <spec>- builds this spec and runs its own tests, which is what the oracle does.BLOCKEDmeans the generated Zig does not compile, with the error beside it.python3 tools/dupe_scan.py --name <function>- where that function already lives, if it does. 576 of 4021 bodies here are byte-identical copies.
The rest of the toolbelt is in docs/BEE_TOOLBELT.md.
The instruments
Every one of these reads and prints; none of them writes. Run them from the repository root, with <spec> replaced by the file in ## Boundary:
.t27 is not Rust and not Zig, and a bee fluent in either writes one by
accident. Measured 2026-09-20: a bee filled eight bodies in
specs/file/watcher.t27 with return Ok(());, Err(FileError::WatcherNotFound)
and for i in 0..watchers.length. The parse ratchet refused the whole file --
Unexpected token in expression: RParen, line 123 -- and a spec that does not
parse generates nothing, so every test it already carried stopped running.
At the top level the parser accepts exactly these eight forms, with an optional
pub, and no others:
const var fn enum struct test invariant bench
There is no trait, no impl, no type X = ..., no generics, no macro. What
a bee reaches for from another language, and what happens:
- Rust's result sugar (
Ok(()),Err(E::V),?) is not a construct here. - Rust macros (
println!,format!,vec!) are not constructs here. - A range loop (
for i in 0..n) is Rust and Zig, not this language. - Zig builtins (
catch unreachable,@intCast,@constCast) are not constructs here. - Cross-module reuse (
use other::fn;) parses and then generates a comment and an unqualified call, so the Zig fails withuse of undeclared identifier(use a::b; generates no import, so no spec can reuse a function from another spec #4298). It does not work yet.
t27c parse <spec> answers in one line whether what you wrote is the language.
Run it before you report, every time.
t27c spec-status <spec>- the compiler's one-word verdict: IMPLEMENTED, PARTIAL, UNWRITTEN, NOPARSE, NOFN. Exit code is 0 whatever it says, so read the word.t27c symbols <spec>- every name the file declares, with its kind. Answers "does this already exist here?" before you add it.t27c outline <spec>- per function: its locals, what it calls, what it returns. The contract you are implementing against.t27c coverage <spec>- which functions have a test and which do not. The issue asks for tests; this is how you check you wrote them.t27c lint <spec>- style and shape warnings. It OVER-REPORTShas no test or invariant: measured 2026-09-20 over 60 specs it printed 677 of those wherecoveragefound 190 untested functions, disagreeing on 59 of the 60 - it warns aboutbit_to_trit_pairinspecs/base/ternary_encoding.t27, whichtest bit_to_trit_pair_zerocalls on line 249. Read it as a hint;coverageis the answer.t27c typecheck <spec>- types, before generation. PrintsTypecheck OK (0 errors, 0 warnings)or the errors.t27c test-report <spec>- builds this spec and runs its own tests, which is what the oracle does.BLOCKEDmeans the generated Zig does not compile, with the error beside it.python3 tools/dupe_scan.py --name <function>- where that function already lives, if it does. 576 of 4021 bodies here are byte-identical copies.
The rest of the toolbelt is in docs/BEE_TOOLBELT.md.
The instruments
Every one of these reads and prints; none of them writes. Run them from the repository root, with <spec> replaced by the file in ## Boundary:
.t27 is not Rust and not Zig, and a bee fluent in either writes one by
accident. Measured 2026-09-20: a bee filled eight bodies in
specs/file/watcher.t27 with return Ok(());, Err(FileError::WatcherNotFound)
and for i in 0..watchers.length. The parse ratchet refused the whole file --
Unexpected token in expression: RParen, line 123 -- and a spec that does not
parse generates nothing, so every test it already carried stopped running.
At the top level the parser accepts exactly these eight forms, with an optional
pub, and no others:
const var fn enum struct test invariant bench
There is no trait, no impl, no type X = ..., no generics, no macro. What
a bee reaches for from another language, and what happens:
- Rust's result sugar (
Ok(()),Err(E::V),?) is not a construct here. - Rust macros (
println!,format!,vec!) are not constructs here. - A range loop (
for i in 0..n) is Rust and Zig, not this language. - Zig builtins (
catch unreachable,@intCast,@constCast) are not constructs here. - Cross-module reuse (
use other::fn;) parses and then generates a comment and an unqualified call, so the Zig fails withuse of undeclared identifier(use a::b; generates no import, so no spec can reuse a function from another spec #4298). It does not work yet.
t27c parse <spec> answers in one line whether what you wrote is the language.
Run it before you report, every time.
t27c spec-status <spec>- the compiler's one-word verdict: IMPLEMENTED, PARTIAL, UNWRITTEN, NOPARSE, NOFN. Exit code is 0 whatever it says, so read the word.t27c symbols <spec>- every name the file declares, with its kind. Answers "does this already exist here?" before you add it.t27c outline <spec>- per function: its locals, what it calls, what it returns. The contract you are implementing against.t27c coverage <spec>- which functions have a test and which do not. The issue asks for tests; this is how you check you wrote them.t27c lint <spec>- style and shape warnings. It OVER-REPORTShas no test or invariant: measured 2026-09-20 over 60 specs it printed 677 of those wherecoveragefound 190 untested functions, disagreeing on 59 of the 60 - it warns aboutbit_to_trit_pairinspecs/base/ternary_encoding.t27, whichtest bit_to_trit_pair_zerocalls on line 249. Read it as a hint;coverageis the answer.t27c typecheck <spec>- types, before generation. PrintsTypecheck OK (0 errors, 0 warnings)or the errors.t27c test-report <spec>- builds this spec and runs its own tests, which is what the oracle does.BLOCKEDmeans the generated Zig does not compile, with the error beside it.python3 tools/dupe_scan.py --name <function>- where that function already lives, if it does. 576 of 4021 bodies here are byte-identical copies.
The rest of the toolbelt is in docs/BEE_TOOLBELT.md.
Activity
gHashTag commentedon Oct 5, 2026
Claude is taking this (owner asked to help the bees)
gHashTag commentedon Oct 5, 2026
Blocked on a t27c change (Rust), so I am stopping here. No PR.
Measured with t27c built from master e7afb32 on the t27c lab:
allocate_array,compute_mean,sum_arrayandrange(...), none of which exist. They also do float math directly ongf16::GF16, which isu16in the generated Zig. So they need a rewrite.fn phi_normalize(x: u16, mean: u16, var: u16) u16. The parametervaris a Zig keyword and is written unescaped, while the body uses@"var". The result is a parse error, which blocks the whole file, so no test in this spec can run. Renaming the parameter would break FR-001, andphi_normalizeis part 2 anyway.The compiler fix is filed as #6532. The cause is in
bootstrap/src/compiler.rsaround lines 8939-8944: a parameter name is escaped only whenzig_is_primitiveis true, not when it is a keyword.Once #6532 lands, the rewrite of the 8 part-1 functions needs to:
approximately_equal,random_input,any_norm_config, ...). Invariants run at comptime, so one bad invariant blocks the whole file.github-actions commentedon Oct 10, 2026
Re-filed as #8516.
An attempt claimed this issue on 2026-10-05 and left an empty branch. A dispatch row that has spent its retry ceiling is released once and then keeps its issue for good, which is the right rule for a third identical failure and the wrong outcome for an issue nobody ever attempted twice. The new issue carries the same work, the same boundary, and today's brief.
Closing this one so the swarm can take the work again.