Skip to content

spec(port): port specs/port/trios-railway/crates/trios-igla-race/src/invariants.t27 (Closes #9677) - #9812

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

gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9677-race-invariants

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Contributor

Summary

Port gHashTag/trios-railway:crates/trios-igla-race/src/invariants.rs (at 8b229e9489ee, 15 lines) as specs/port/trios-railway/crates/trios-igla-race/src/invariants.t27 — Roadmap Stage 6 (goal #4548), target t27c gen-rust. Closes #9677. This is the first spec under specs/port/trios-railway/ — the directory is created by this one file.

The original is the constitutional anchor check: it computes phi as (1 + sqrt(5)) / 2 and verifies phi^2 + 1/phi^2 = 3 within 1e-10. Per the issue's rule ("Port the decision, not the plumbing"), the one listed function is ported under its name as a tested pure decision, and the language's missing sqrt builtin is computed honestly rather than hardcoded:

  • sqrt5_newton — Newton's iteration x <- (x + 5/x) / 2, forty rounds from 5.0 (quadratic convergence, far past f64 precision);
  • phi_from_sqrt5 — (1 + sqrt(5)) / 2 (original line 2);
  • anchor_of_phi — phi^2 + 1/phi^2 (original line 3);
  • within_anchor_tolerance — the (anchor - 3).abs() < 1e-10 bound, carried as its decimal form 0.0000000001 (the parser's literal set has no scientific notation) (original line 4);
  • check_phi_anchor — the composed check (original lines 1-5), asserted true like the original's own test.

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: 5/5 tested (100%) — no transports in this port.
  • t27c test-report: 5 tests / 5 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes — including the sqrt convergence window (2.2360679774 < s < 2.2360679775), the golden-ratio window, the tolerance bounds on both sides of 3, and the anchor identity at the golden ratio.
  • t27c gen | grep -c 'not yet implemented': 0; gen | wc -l: 69 (> 12).
  • grep -cE '^\s*(pub )?fn (check_phi_anchor)\(': 1. grep -cE '^\s*test\s+(["|[A-Za-z_])': 5 (≥ 1).
  • Boundary: git status --short — exactly this one file. The repo's lefthook pre-commit passed.
  • dupe_scan: all 5 names unique across 2040 specs; the bare body scan adds no duplicate group (752 bodies / 221 groups on base, identical with this spec present).

Dmitrii Fedorov (@dmitrii-f-t27)

…invariants.t27 (Closes gHashTag#9677)

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

The constitutional anchor check is ported as pure functions and
tested (5 tests, 5 pass, 0 vacuous, 100% function coverage): the
language has no sqrt builtin, so sqrt(5) is computed by Newton's
iteration (forty halving steps from 5.0, far past f64 precision),
phi as (1 + sqrt(5)) / 2, the anchor as phi^2 + 1/phi^2, and the
tolerance check carries the original's 1e-10 bound as its decimal
form. No transport exists in this port.

Verified: parse OK, spec-status IMPLEMENTED, typecheck 0 errors,
coverage 5/5, test-report 5/5 pass, 0 BLOCKED, gen 69 lines with 0
'not yet implemented', boundary exactly this one file, dupe_scan:
all 5 names unique across 2040 specs, bare body scan adds no
duplicate group (752 bodies / 221 groups 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 #9677 port — crates/trios-igla-race/src/invariants.rs (gHashTag/trios-railway, at 8b229e9489ee, 15 lines) re-authored as specs/port/trios-railway/crates/trios-igla-race/src/invariants.t27. One file (the first under specs/port/trios-railway/), head 17f13be53, Closes #9677.

What is verified:

  • t27c parse OK, spec-status IMPLEMENTED, typecheck 0 errors / 0 warnings, coverage 5/5 (100%) — no transports, t27c test-report 5 tests / 5 pass / 0 FAIL / 0 BLOCKED, 0 vacuous.
  • The missing sqrt builtin is computed honestly: Newton's iteration x <- (x + 5/x)/2 (forty rounds, far past f64 precision), asserted into its convergence window; phi, the anchor phi^2 + 1/phi^2 and the 1e-10 tolerance bound are each ported and tested; the composed check_phi_anchor passes like the original's own test.
  • gen → 69 lines, 0 not yet implemented; fn (check_phi_anchor)( count 1; 5 test blocks; boundary exactly the one file.
  • dupe_scan: all 5 names unique across 2040 specs; bare body scan adds no duplicate group (752/221 unchanged).
  • The t27b-native-run artifact of this head (commit 17f13be, run 38994045686) — рow: reference pass, t27b pass, tests 5, invariants 0, asserts 13, blockers [], detail empty, reference_disagree: [].

CI (head 17f13be): required trio green — validate, check-linked-issue, parse-ratchet; 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 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 #9677 auto-closed, and file the 14-step report.

Dmitrii Fedorov (@dmitrii-f-t27)

@dmitrii-f-t27

Copy link
Copy Markdown
Contributor Author

Correction to my merge request above: the t27b-native-run artifact run id is 38992184549 (the ratchet job of this head), not the number I typed there. The artifact facts stand as verified from the downloaded run.json of that run: commit 17f13be53, invariants.t27 row — reference pass, t27b pass, tests 5, invariants 0, asserts 13, blockers [], detail empty, reference_disagree: [].

Dmitrii Fedorov (@dmitrii-f-t27)

@gHashTag
gHashTag merged commit 8ac870f into gHashTag:master Oct 17, 2026
26 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants