Skip to content

spec(port): port specs/port/trios/crates/trios-trainer/src/ledger.t27 (Closes #7324) - #9943

Merged
gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-7324-trainer-ledger
Oct 17, 2026
Merged

gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-7324-trainer-ledger

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Contributor

Summary

Port gHashTag/trios:crates/trios-trainer/src/ledger.rs (at 8b229e9489ee, 165+ lines) as specs/port/trios/crates/trios-trainer/src/ledger.t27 — Roadmap Stage 6 (goal #4548), target t27c gen-rust. Closes #7324.

The original is the ledger: triplet-validated row emission with an embargo block — every row MUST carry BPB, step, seed, sha, the jsonl row and the gate status.

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 filesystem append and the git subprocess are the callers' plumbing) with 6 tests (28 runtime asserts, 0 vacuous, 100% function coverage), including the original's own embargo and triplet tests:

  • EmbargoBlock_new — the default blocked list is EMPTY (the comment names it the place for failed-validation commits) (lines 43-50);
  • EmbargoBlock_is_embargoed — the membership gate (the original's own deadbeef/goodcommit pair) (lines 53-55);
  • EmbargoBlock_default — the delegation to new (lines 58-62);
  • emit_row — the emission order: the embargo gate FIRST (an embargoed sha answers EmbargoBlocked before anything is written), then serialize, then the append, then the triplet validation with the NaN-or-empty InvalidTriplet rule; the four-entry error catalogue; the create+append-only ledger contract (lines 67-110, 112-125);
  • get_commit_sha — the git rev-parse HEAD command shape with its failure answer (lines 128-140);
  • plus the six-field triplet contract and the eight-field full row (lines 13-32).

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: 14/14 tested (100%) — no transports in this port.
  • t27c test-report: 6 tests / 6 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes — the triplet field table, the empty default with the delegation, the membership gate both ways, the emission order with all three gate answers, the error catalogue with the append contract, and the git command shape with the failure answer.
  • t27c gen | grep -c 'not yet implemented': 0; gen | wc -l: 141 (> 12).
  • grep -cE '^\s*(pub )?fn (EmbargoBlock_new|EmbargoBlock_is_embargoed|EmbargoBlock_default|emit_row|get_commit_sha)\(': 5. grep -cE '^\s*test\s+(["|[A-Za-z_])': 6 (≥ 5).
  • Boundary: git status --short — exactly this one file. The repo's lefthook pre-commit passed.
  • dupe_scan: all 9 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)

…Closes gHashTag#7324)

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

The ledger's decisions are ported as pure functions and tested (6
tests, 6 pass, 0 vacuous, 28 runtime asserts, 100% function
coverage), including the original's own embargo and triplet tests:
the six-field triplet contract (bpb, step, seed, sha, jsonl_row,
gate_status) with the eight-field full row, the empty default
blocked list with Default delegating to new, the embargo membership
gate (the original's own deadbeef/goodcommit pair), the emission
order - the embargo gate FIRST, an embargoed sha answering
EmbargoBlocked before anything is written, then serialize, then the
append, then the triplet validation with the NaN-or-empty rule -
the four-entry error catalogue, the create+append-only ledger
contract, and the git rev-parse HEAD command shape with its
failure answer. The filesystem append and the git subprocess are
the callers' plumbing.

Verified: parse OK, spec-status IMPLEMENTED, typecheck 0 errors,
coverage 14/14, test-report 6/6 pass, 0 BLOCKED, gen 141 lines
with 0 'not yet implemented', boundary exactly this one file,
dupe_scan: all 9 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 #7324 port — crates/trios-trainer/src/ledger.rs (gHashTag/trios, at 8b229e9489ee, 165+ lines) re-authored as specs/port/trios/crates/trios-trainer/src/ledger.t27. One file, one commit, head ec840b43c, Closes #7324.

What is verified:

  • t27c parse OK, spec-status IMPLEMENTED, typecheck 0 errors / 0 warnings, coverage 14/14 (100%) — no transports in this port, t27c test-report 6 tests / 6 pass / 0 FAIL / 0 BLOCKED, 0 vacuous — the six-field triplet contract (bpb, step, seed, sha, jsonl_row, gate_status) with the eight-field full row, the empty default blocked list with Default delegating to new, the embargo membership gate (the original's own deadbeef/goodcommit pair), the emission order with the embargo gate FIRST (an embargoed sha answering EmbargoBlocked before anything is written), the NaN-or-empty InvalidTriplet rule, the four-entry error catalogue, the create+append-only ledger contract, and the git rev-parse HEAD command shape with its failure answer.
  • gen → 141 lines, 0 not yet implemented; the 5 required names count exactly 5; 6 test blocks; boundary exactly the one file.
  • dupe_scan: all 9 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 ec840b4, run 39035425119): ledger.t27 row — reference pass, t27b pass, tests 6, invariants 0, asserts 28, blockers [], detail empty, reference_disagree: [].

CI (head ec840b4): 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 #7324 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-trainer/src/ledger.rs (Rust, 5 functions) to specs/port/trios/crates/trios-trainer/src/ledger.t27

2 participants