Re-filed from #3990. 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.
Port part 1 of 3 of tools/gft_train_demo.py to specs/port/tools/gft_train_demo.t27 (8 functions)
Context
tools/gft_train_demo.py is 202 lines of hand-written Python. Re-author its logic as specs/port/tools/gft_train_demo.t27 so that t27c generates the equivalent. The Python file stays where it is - this issue adds the .t27 source it should have been written in.
.t27 is the hand-authored source language. t27c compiles it out to C, Rust, Verilog and Zig. You are writing source, not compiler output, and not prose about an implementation. The goal of this project is that every hand-written file in the repository is authored in .t27 and the other languages are generated from it - this issue is one file of that migration.
All 3 parts name the same file, so they share one boundary and cannot run at the same time. The swarm holds specs/port/tools/gft_train_demo.t27 for whoever has it.
Read the original first
# from the repository root
$ wc -l tools/gft_train_demo.py
$ sed -n '1,120p' tools/gft_train_demo.py
What to write
Create specs/port/tools/gft_train_demo.t27 with one .t27 function per Python function below. Keep the names exactly as they are - the name is how the port is checked. Quoted verbatim from the original:
- line 18 -
def gft_value(u):
- line 24 -
def f2gft(x):
- line 34 -
def magadd(a, b):
- line 50 -
def magsub(hi, lo):
- line 68 -
def sadd(a, b):
- line 78 -
def neg(v): return 0 if v==0 else v^65536
- line 80 -
def magmul(a16, b16):
- line 93 -
def smul(a, b):
Add a test block for each of the 8 functions, asserting on the behaviour you read in the original. A ported body with nothing asserting on it is a claim, not a result - and the review compiles the generated Zig and runs exactly those tests.
Acceptance criteria
-
test -f specs/port/tools/gft_train_demo.t27 && echo present prints present (today the file does not exist)
-
grep -cE '^\s*(pub )?fn (gft_value|f2gft|magadd|magsub|sadd|neg|magmul|smul)\(' specs/port/tools/gft_train_demo.t27 prints 8 - every function above is ported under its own name
-
t27c gen specs/port/tools/gft_train_demo.t27 > /tmp/t27-gen.zig && grep -c 'not yet implemented' /tmp/t27-gen.zig prints 0, and t27c gen specs/port/tools/gft_train_demo.t27 | wc -l prints more than 24 - an absent or empty file makes the grep print 0 on its own, so both halves are required
-
t27c spec-status specs/port/tools/gft_train_demo.t27 does not print NOPARSE - 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.)
-
grep -cE '^[[:space:]]*test[[:space:]]+("|[A-Za-z_])' specs/port/tools/gft_train_demo.t27 prints at least 8
Use t27c from the repository root, not the t27c on PATH: the PATH build prints no parse metrics at all, so criterion 4 greps nothing and an empty result reads as a pass.
Boundary
specs/port/tools/gft_train_demo.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/port/tools/gft_train_demo.t27 as 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/port/tools/gft_train_demo.t27 is 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.
-
t27c test-report specs/port/tools/gft_train_demo.t27 2>&1 | grep -c BLOCKED prints 0 - the generated Zig must COMPILE. Every other criterion can pass on a file the compiler then refuses, which is how five of these came back with the work done and the oracle failing. Run it before you report.
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-REPORTS has no test or invariant: measured 2026-09-20 over 60 specs it printed 677 of those where coverage found 190 untested functions, disagreeing on 59 of the 60 - it warns about bit_to_trit_pair in specs/base/ternary_encoding.t27, which test bit_to_trit_pair_zero calls on line 249. Read it as a hint; coverage is the answer.
t27c typecheck <spec> - types, before generation. Prints Typecheck 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. BLOCKED means 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.
Re-filed from #3990. 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.
Port part 1 of 3 of tools/gft_train_demo.py to specs/port/tools/gft_train_demo.t27 (8 functions)
Context
tools/gft_train_demo.pyis 202 lines of hand-written Python. Re-author its logic asspecs/port/tools/gft_train_demo.t27so thatt27cgenerates the equivalent. The Python file stays where it is - this issue adds the.t27source it should have been written in..t27is the hand-authored source language.t27ccompiles it out to C, Rust, Verilog and Zig. You are writing source, not compiler output, and not prose about an implementation. The goal of this project is that every hand-written file in the repository is authored in.t27and the other languages are generated from it - this issue is one file of that migration.All 3 parts name the same file, so they share one boundary and cannot run at the same time. The swarm holds
specs/port/tools/gft_train_demo.t27for whoever has it.Read the original first
What to write
Create
specs/port/tools/gft_train_demo.t27with one.t27function per Python function below. Keep the names exactly as they are - the name is how the port is checked. Quoted verbatim from the original:def gft_value(u):def f2gft(x):def magadd(a, b):def magsub(hi, lo):def sadd(a, b):def neg(v): return 0 if v==0 else v^65536def magmul(a16, b16):def smul(a, b):Add a
testblock for each of the 8 functions, asserting on the behaviour you read in the original. A ported body with nothing asserting on it is a claim, not a result - and the review compiles the generated Zig and runs exactly those tests.Acceptance criteria
test -f specs/port/tools/gft_train_demo.t27 && echo presentprintspresent(today the file does not exist)grep -cE '^\s*(pub )?fn (gft_value|f2gft|magadd|magsub|sadd|neg|magmul|smul)\(' specs/port/tools/gft_train_demo.t27prints8- every function above is ported under its own namet27c gen specs/port/tools/gft_train_demo.t27 > /tmp/t27-gen.zig && grep -c 'not yet implemented' /tmp/t27-gen.zigprints0, andt27c gen specs/port/tools/gft_train_demo.t27 | wc -lprints more than24- an absent or empty file makes the grep print0on its own, so both halves are requiredt27c spec-status specs/port/tools/gft_train_demo.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.)grep -cE '^[[:space:]]*test[[:space:]]+("|[A-Za-z_])' specs/port/tools/gft_train_demo.t27prints at least8Use
t27cfrom the repository root, not thet27con PATH: the PATH build prints no parse metrics at all, so criterion 4 greps nothing and an empty result reads as a pass.Boundary
specs/port/tools/gft_train_demo.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 & Testingspecs/port/tools/gft_train_demo.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/port/tools/gft_train_demo.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.
t27c test-report specs/port/tools/gft_train_demo.t27 2>&1 | grep -c BLOCKEDprints0- the generated Zig must COMPILE. Every other criterion can pass on a file the compiler then refuses, which is how five of these came back with the work done and the oracle failing. Run it before you report.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.