Skip to content

spec(port): port specs/port/trios/crates/trios-igla-race/src/lessons.t27 (Closes #9413) - #9930

Merged
gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9413-race-lessons
Oct 17, 2026
Merged

gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9413-race-lessons

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Contributor

Summary

Port gHashTag/trios:crates/trios-igla-race/src/lessons.rs (at 8b229e9489ee, 260+ lines) as specs/port/trios/crates/trios-igla-race/src/lessons.t27 — Roadmap Stage 6 (goal #4548), target t27c gen-rust. Closes #9413.

The original is the Failure Memory: automatic lesson generation from pruned trials.

Per the issue's rule ("Port the decision, not the plumbing"), all five listed functions are ported under their names as pure functions (no transports — the database round-trips are the callers' plumbing) with 8 tests (48 runtime asserts, 0 vacuous, 100% function coverage), including the original's own high-lr and small-model tests:

  • LessonType_fmt / Outcome_fmt — the two display tables: five lesson types in upper case (AVOID, PATTERN, WINNER, WARN, INFO), five outcomes in lower case (pruned, failed, slow, unstable, timeout) (original lines 10-50);
  • generate_lesson — the six rule gates, each answered as its kind: the learning rate above 0.05 (AVOID) or below 0.001 (WARN); d_model at most 64 with BPB above 2.8 (PATTERN); hidden below 32 (WARN); weight decay above 0.1 with BPB above 3.0 (AVOID); SGD with BPB above 2.7 (PATTERN); the early death at step at most 1000 with BPB above 3.0 (AVOID) — the composition answering the most severe by the priority order Avoid > Pattern > Warn > Info > Winner, with the generic INFO fallback when nothing triggers (lines 75-172);
  • store_lesson — the outcome rides along in its Display form (lines 175-194);
  • get_top_lessons — the three-wide (lesson, type, pattern count) rows under the limit (lines 197-203).

Verification (all run live from the worktree root, zig 0.16.0)

  • t27c parse: OK. t27c spec-status: IMPLEMENTED. t27c typecheck: 0 errors, 0 warnings.
  • t27c coverage: 17/17 tested (100%) — no transports in this port.
  • t27c test-report: 8 tests / 8 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes — both display tables, the severity order across every adjacent pair, the lr gates at the boundaries (0.07 → AVOID, the 0.001–0.05 middle band, 0.0005 → WARN), all remaining gates at their boundaries, the composition (AVOID beating everything, Pattern beating Warn, Warn beating Info, the generic INFO), the original's own high-lr and small-model cases, and the store/get shapes.
  • t27c gen | grep -c 'not yet implemented': 0; gen | wc -l: 242 (> 12).
  • grep -cE '^\s*(pub )?fn (LessonType_fmt|Outcome_fmt|generate_lesson|store_lesson|get_top_lessons)\(': 5. grep -cE '^\s*test\s+(["|[A-Za-z_])': 8 (≥ 5).
  • Boundary: git status --short — exactly this one file. The repo's lefthook pre-commit passed.
  • dupe_scan: all 12 introduced names unique across 2040 specs (checked before the commit); the bare body scan adds no duplicate group (752 bodies / 221 groups on base, identical with this spec present).

Dmitrii Fedorov (@dmitrii-f-t27)

…t27 (Closes gHashTag#9413)

Port gHashTag/trios:crates/trios-igla-race/src/lessons.rs (at
8b229e9489ee, 260+ lines) as specs/port/trios/crates/
trios-igla-race/src/lessons.t27 - Roadmap Stage 6, goal gHashTag#4548,
target t27c gen-rust.

The Failure Memory's decisions are ported as pure functions and
tested (8 tests, 8 pass, 0 vacuous, 48 runtime asserts, 100%
function coverage), including the original's own high-lr and
small-model tests: the two display tables (five lesson types in
upper case, five outcomes in lower case), the severity priority
(Avoid > Pattern > Warn > Info > Winner), the six rule gates - the
learning rate above 0.05 / below 0.001, the d_model at most 64
with BPB above 2.8, the hidden below 32, the weight decay above
0.1 with BPB above 3.0, SGD with BPB above 2.7, and the early
death at step at most 1000 with BPB above 3.0 - the composition
answering the most severe triggered kind, the generic INFO
fallback when nothing triggers, and the store/get shapes (the
outcome riding along in its Display form; the three-wide top
rows). The database round-trips are the callers' plumbing.

Verified: parse OK, spec-status IMPLEMENTED, typecheck 0 errors,
coverage 17/17, test-report 8/8 pass, 0 BLOCKED, gen 242 lines
with 0 'not yet implemented', boundary exactly this one file,
dupe_scan: all 12 introduced names unique across 2040 specs
(checked before the commit), bare body scan adds no duplicate
group (752/221 unchanged).

Dmitrii Fedorov ([@dmitrii-f-t27](https://github.com/dmitrii-f-t27))
@dmitrii-f-t27

Copy link
Copy Markdown
Contributor Author

@gHashTag Please merge this PR into master via the golden chain — rights on gHashTag/t27 are read-only for me (403), so the merge itself needs your action.

What this is: the #9413 port — crates/trios-igla-race/src/lessons.rs (gHashTag/trios, at 8b229e9489ee, 260+ lines) re-authored as specs/port/trios/crates/trios-igla-race/src/lessons.t27. One file, one commit, head f69ccf3ff, Closes #9413.

What is verified:

  • t27c parse OK, spec-status IMPLEMENTED, typecheck 0 errors / 0 warnings, coverage 17/17 (100%) — no transports in this port, t27c test-report 8 tests / 8 pass / 0 FAIL / 0 BLOCKED, 0 vacuous — the two display tables (five lesson types upper-case, five outcomes lower-case), the severity priority (Avoid > Pattern > Warn > Info > Winner, every adjacent pair), the six rule gates at their boundaries (lr 0.07 → AVOID with the 0.001–0.05 middle band; d_model ≤ 64 with BPB > 2.8 → PATTERN; hidden < 32 → WARN; weight decay > 0.1 with BPB > 3.0 → AVOID; SGD with BPB > 2.7 → PATTERN; early death at step ≤ 1000 with BPB > 3.0 → AVOID), the composition answering the most severe triggered kind with the generic INFO fallback — and the original's own high-lr and small-model tests carried over.
  • gen → 242 lines, 0 not yet implemented; the 5 required names count exactly 5; 8 test blocks; boundary exactly the one file.
  • dupe_scan: all 12 introduced names unique across 2040 specs (checked before the commit); the bare body scan adds no duplicate group (752/221 unchanged).
  • The t27b-native-run artifact of this head (commit f69ccf3, run 39031151006): lessons.t27 row — reference pass, t27b pass, tests 8, invariants 0, asserts 48, blockers [], detail empty, reference_disagree: [].

CI (head f69ccf3): required trio green — validate, check-linked-issue, parse-ratchet — Check L1 TRACEABILITY green and Corpus ratchet green; 26 checks pass overall, incl. emit-bitexact, t27b-native-linux, t27b-native-macos.

The 3 reds are the base-red trio, not this change: cli-tri (the #3324 include_str!), duplicate-bodies (only the known base names), t27b-native-ratchet (the same verdict red the Queen's port PRs carry; this spec's own row is reference pass + t27b pass — the registration debt is the UNLISTED class).

After the merge I will: verify the spec file live on the merge SHA, confirm #9413 auto-closed, and file the 14-step report.

Dmitrii Fedorov (@dmitrii-f-t27)

This was referenced Oct 17, 2026
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.

Port gHashTag/trios:crates/trios-igla-race/src/lessons.rs (Rust, 5 functions) to specs/port/trios/crates/trios-igla-race/src/lessons.t27

2 participants