Skip to content

spec(port): port specs/port/trios/crates/trios-sacred/src/lib.t27 (Closes #9050) - #9911

Merged
gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9050-sacred-lib
Oct 17, 2026
Merged

gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9050-sacred-lib

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Contributor

Summary

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

The original is the Rust wrapper around the zig-sacred-geometry vendor library, with two faces: the library-built face answers real values through the FFI, and the without-library face answers documented fallbacks.

Per the issue's rule ("Port the decision, not the plumbing"), all six listed functions are ported under their names as pure functions (no transports — the FFI calls themselves are the callers' plumbing) with 6 tests (22 runtime asserts, 0 vacuous, 100% function coverage):

  • phi_attention — the dimension contract: queries and keys each seq_len*dim long with the mismatch named; the output seq_len*seq_len; return code 0 answers Ok, anything else the failed-with-code error (lines 13-45);
  • fibonacci_spiral / golden_sequence — the (x, y) point and the n-value sequence, both faces' shapes (lines 48-62);
  • beal_search — up to max_results candidates truncated to the found count, with the six-field candidate shape and its validity flag (lines 65-94);
  • phi_bottleneck / head_spacing — the bottleneck pass-through and the n spacings, zero without the library (lines 97-108);
  • the without-library fallback face: the error naming the missing FFI (zig-sacred-geometry FFI not available. Build zig vendor first.), the zero point, the zero-filled sequence, the empty candidates (lines 110-155).

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: 13/13 tested (100%) — no transports in this port.
  • t27c test-report: 6 tests / 6 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes — the dimension contract both matched and mismatched (each side), the return-code verdict, both faces' shapes, the truncation at found/over/zero, the candidate shape, the bottleneck and spacing both ways, and the exact fallback error string.
  • t27c gen | grep -c 'not yet implemented': 0; gen | wc -l: 109 (> 12).
  • grep -cE '^\s*(pub )?fn (phi_attention|fibonacci_spiral|golden_sequence|beal_search|phi_bottleneck|head_spacing)\(': 6. grep -cE '^\s*test\s+(["|[A-Za-z_])': 6 (≥ 6).
  • Boundary: git status --short — exactly this one file. The repo's lefthook pre-commit passed.
  • dupe_scan: all 7 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)

…oses gHashTag#9050)

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

The sacred-geometry wrapper's decisions are ported as pure
functions and tested (6 tests, 6 pass, 0 vacuous, 22 runtime
asserts, 100% function coverage): the phi_attention dimension
contract (queries and keys each seq_len*dim long, the mismatch
named; the output seq_len*seq_len; return code 0 answers Ok,
anything else the failed-with-code error), the spiral and
golden-sequence shapes, the beal_search truncation to the found
count with the six-field candidate shape and its validity flag,
the bottleneck and head-spacing pass-throughs, and the whole
without-library fallback face - the error naming the missing FFI,
the zero point, the zero-filled sequence, the empty candidates.
The FFI calls themselves are the callers' plumbing.

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

What is verified:

  • t27c parse OK, spec-status IMPLEMENTED, typecheck 0 errors / 0 warnings, coverage 13/13 (100%) — no transports in this port, t27c test-report 6 tests / 6 pass / 0 FAIL / 0 BLOCKED, 0 vacuous — the phi_attention dimension contract (queries and keys each seq_len*dim, the mismatch named on each side; the output seq_len*seq_len; return code 0 → Ok, anything else the failed-with-code error), both faces' shapes for the spiral and the golden sequence, the beal truncation at found/over/zero with the six-field candidate shape and its validity flag, the bottleneck and head-spacing pass-throughs both ways, and the exact without-library fallback error string.
  • gen → 109 lines, 0 not yet implemented; the 6 required names count exactly 6; 6 test blocks; boundary exactly the one file.
  • dupe_scan: all 7 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 c446621, run 39023617988): lib.t27 row — reference pass, t27b pass, tests 6, invariants 0, asserts 22, blockers [], detail empty, reference_disagree: [].

CI (head c446621): 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 #9050 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-sacred/src/lib.rs (Rust, 6 functions) to specs/port/trios/crates/trios-sacred/src/lib.t27

2 participants