Skip to content

spec(port): port specs/port/trinity/src/vibeec/create_test_mistral.t27 (Closes #9644) - #10121

Closed
dmitrii-f-t27 wants to merge 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9644-test-mistral
Closed

dmitrii-f-t27 wants to merge 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9644-test-mistral

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Contributor

Summary

Port gHashTag/trinity:src/vibeec/create_test_mistral.zig (at ee512359254b, 129 lines) as specs/port/trinity/src/vibeec/create_test_mistral.t27 — Roadmap Stage 5 (goal #4547), target t27c gen-rust. Closes #9644.

The original builds a scaled-down Mistral test model as a safetensors file.

Per the issue's rule ("Port the decision, not the plumbing"), the one listed function is ported under its name as a pure function (no transports — the header string building, the file write and the PRNG itself are the callers' plumbing) with 9 tests (42 runtime asserts, 0 vacuous, 100% function coverage):

  • the mini Mistral config (original lines 12-21): vocab 256, hidden 64, intermediate 128, 2 layers, 4 heads, 2 kv heads — head_dim = hidden / heads;
  • the f32 tensor byte rule (lines 46-49): 4 bytes per element times the 2-D shape product;
  • the per-layer shape table (lines 62-89): q/o [hidden, hidden], k/v [kv_dim, hidden], gate/up [intermediate, hidden], down [hidden, intermediate] — slot codes 0..6;
  • the tensor count (lines 61-93): the embedding plus seven per layer plus the lm head — 2 + 7·layers;
  • the payload byte count: the embedding and lm head share the [vocab, hidden] shape — for the default config 425984 bytes = 106496 parameters;
  • the parameter count (line 125): bytes / 4; the file size (line 128): 8-byte prefix + header + payload;
  • the JSON header's comma rule (lines 41-44): every entry except the first;
  • the seeded data range (lines 110-118): the PRNG's [0,1) float scaled into [-1, 1), seed 42 carried as a const.

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: 11/11 tested (100%) — no transports in this port.
  • t27c test-report: 9 tests / 9 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes — head_dim divisions, the byte rule from 65536 down to the zero dimension, all seven slots of both shape functions, the tensor count at 0/2/3 layers, the payload bytes for the default and a hand-computed small config, the param and file totals, the comma rule, and the sample range at the four quadrant points.
  • All four generators were run before the push: gen (137 lines, 0 'not yet implemented'), gen-rust, gen-c, gen-verilog.
  • grep -cE '^\s*(pub )?fn (main)\(': 1. grep -cE '^[[:space:]]*test[[:space:]]+("|[A-Za-z_])': 9 (≥ 1).
  • Boundary: git status --short — exactly this one file. The repo's lefthook pre-commit passed.
  • dupe_scan: all 11 function names unique across the corpus (checked before the commit); the bare scan reports zero error lines — no new duplicate group, none grew.

Dmitrii Fedorov (@dmitrii-f-t27)

Closes gHashTag#9644)

Port gHashTag/trinity:src/vibeec/create_test_mistral.zig (at
ee512359254b, 129 lines) as specs/port/trinity/src/vibeec/
create_test_mistral.t27 - Roadmap Stage 5, goal gHashTag#4547, target t27c
gen-rust.

The safetensors builder's decisions are ported as pure functions and
tested (9 tests, 9 pass, 0 vacuous, 42 runtime asserts, 100%
function coverage): the mini Mistral config (vocab 256, hidden 64,
intermediate 128, 2 layers, 4 heads, 2 kv heads - head_dim =
hidden/heads), the f32 tensor byte rule (4 bytes per element times
the 2-D shape product), the per-layer shape table (q/o [hidden,
hidden], k/v [kv_dim, hidden], gate/up [intermediate, hidden], down
[hidden, intermediate] - slot codes 0..6), the tensor count (the
embedding plus seven per layer plus the lm head = 2 + 7*layers), the
whole payload's byte count (the embedding and lm head share the
[vocab, hidden] shape), the parameter count (bytes / 4), the file
size (8-byte prefix + header + payload), the JSON header's comma
rule (every entry except the first), and the seeded data range
(random float in [0,1) scaled to [-1, 1)). The header string
building, the file write and the PRNG itself are the callers'
plumbing. All four generators (gen, gen-rust, gen-c, gen-verilog)
emit this spec before the push.

Verified: parse OK, spec-status IMPLEMENTED, typecheck 0 errors,
coverage 11/11, test-report 9/9 pass, 0 BLOCKED, gen 137 lines with
0 'not yet implemented', boundary exactly this one file, dupe_scan:
all 11 function names unique, bare scan reports zero error lines.

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 only you can merge it.

Verification of this head (3e1d26a, on current master — no extra merge needed):

  • Required CI trio green: validate, check-linked-issue, parse-ratchet; also Check L1 TRACEABILITY, duplicate-bodies and cli-tri green.
  • The t27b-native-run artifact of this head (commit 3e1d26a, run 39067967302) row for specs/port/trinity/src/vibeec/create_test_mistral.t27: reference pass, t27b pass, tests 9, invariants 0, asserts 42, blockers [], detail empty, reference_disagree: [].
  • All four generators were run locally before the push (gen, gen-rust, gen-c, gen-verilog) — this spec emits cleanly everywhere.
  • The only red checks are proven base-red on master WITHOUT this PR:
    • Corpus ratchet: the failing step is 'Every conflicted type name has a written verdict' — docs/reports/type_conflicts_classified.json disagrees with the tree (UNJUDGED/STALE). The identical error fails on master itself (workflow runs on 18c98cc and b655dce). This spec declares no struct or enum, so it cannot add a conflicted type name.
    • t27b-native-ratchet: the registration debt, red on master across this whole port series.

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

Dmitrii Fedorov (@dmitrii-f-t27)

@gHashTag

Copy link
Copy Markdown
Owner

Landed unchanged (as a merge commit) in #10174, together with ten other green ports, on top of the master fixes #10160/#10172. Closing this as superseded; the linked issue closes when #10174 merges.

@gHashTag gHashTag closed this Oct 18, 2026
dmitrii-f-t27 pushed a commit to dmitrii-f-t27/t27 that referenced this pull request Oct 18, 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/trinity:src/vibeec/create_test_mistral.zig (Zig, 1 function) to specs/port/trinity/src/vibeec/create_test_mistral.t27

2 participants