Skip to content

spec(port): port specs/port/trios/crates/trios-phi-schedule/src/lib.t27 (Closes #9443) - #9927

Merged
gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9443-phi-schedule
Oct 17, 2026
Merged

gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9443-phi-schedule

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Contributor

Summary

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

The original is the φ-LR scheduler for the Issue #54 calibration: three schedules — flat (the constant baseline), cosine (decaying to 0), and the φ-decay hypothesis (LR = base·φ^(−t/τ), τ = max_steps/(φ·27)) — with the Issue #53 finding riding along: α_φ is not a valid initial rate; its role is the asymptotic floor.

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) with 13 tests (44 runtime asserts, 0 vacuous, 100% function coverage), including the original's own no-decay-at-zero, monotonic-decay and φ-factor tests:

  • phi_schedule — base·φ^(−epoch/warmup): φ from a Newton square root, the power from a binary-expansion root ladder (no powf builtin);
  • flat_lr — the constant baseline;
  • cosine_lr — base·(1+cos(πt))/2, the cosine from a Taylor window (no cos builtin);
  • phi_decay_lr — the warmup gate, τ = max_steps/(φ·27), the exponent cap at 10, the 1e-6 floor. Measured, the cap binds first: base·φ^(−10) ≈ 2.4e-6 stays above the floor — the floor is the deeper safety net, and the test pins that honestly;
  • lr_schedule_54 — the unified dispatch with BASE_LR fixed at 3e-4 and the warmup at 100 steps.

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: 16/16 tested (100%) — no transports in this port.
  • t27c test-report: 13 tests / 13 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes — φ in its window (1.61803–1.61804), the sqrt ladder (√2, √5), the φ-power ladder (φ⁰=1, φ⁻¹=1/φ), the Taylor cosine (0, π/2, π), the no-decay-at-zero, the monotonic decay, the φ-factor at warmup 1, the flat constancy, the cosine curve (base at 0, below base at the midpoint, near 0 at 999), the warmup gate, the post-warmup decay above the floor, the cap pinning base·φ⁻¹⁰ above the floor, τ in its window (22.88–22.90), and the unified dispatch with the α_φ finding.
  • t27c gen | grep -c 'not yet implemented': 0; gen | wc -l: 216 (> 12).
  • grep -cE '^\s*(pub )?fn (phi_schedule|flat_lr|cosine_lr|phi_decay_lr|lr_schedule_54)\(': 5. grep -cE '^\s*test\s+(["|[A-Za-z_])': 13 (≥ 5).
  • Boundary: git status --short — exactly this one file. The repo's lefthook pre-commit passed.
  • dupe_scan: all 13 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)

…27 (Closes gHashTag#9443)

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

The phi-LR scheduler's decisions are ported as pure functions and
tested (13 tests, 13 pass, 0 vacuous, 44 runtime asserts, 100%
function coverage), including the original's own no-decay-at-zero,
monotonic-decay and phi-factor tests: phi_schedule = base *
phi^(-epoch/warmup) with phi from a Newton sqrt and the power from
a binary-expansion root ladder (no powf builtin), flat_lr the
constant baseline, cosine_lr = base * (1 + cos(pi t))/2 with cos
from a Taylor window (no cos builtin), phi_decay_lr with the warmup
gate, tau = max_steps/(phi*27), the exponent cap at 10 and the 1e-6
floor - measured, the cap binds first: base*phi^(-10) = 2.4e-6
stays above the floor, so the floor is the deeper safety net -
and lr_schedule_54 fixing BASE_LR 3e-4, warmup 100, and dispatching
the three schedules. The Issue gHashTag#53 finding rides along: alpha_phi
is not a valid initial rate; its role is the asymptotic floor.

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

What is verified:

  • t27c parse OK, spec-status IMPLEMENTED, typecheck 0 errors / 0 warnings, coverage 16/16 (100%) — no transports in this port, t27c test-report 13 tests / 13 pass / 0 FAIL / 0 BLOCKED, 0 vacuous — the original's own no-decay-at-zero, monotonic-decay and φ-factor tests carried over, plus the three schedules' full decision set: φ from a Newton sqrt and φ^(-e) from a binary-expansion root ladder (no powf builtin), the cosine from a Taylor window (no cos builtin), the warmup gate, τ = max_steps/(φ·27) in its window, the exponent cap at 10 with the measured finding that the cap binds first (base·φ⁻¹⁰ ≈ 2.4e-6 stays above the 1e-6 floor), the unified dispatch with BASE_LR 3e-4 and warmup 100, and the Issue [TASK-005] Comprehensive test harness: tests/run_all.sh + CI integration #53 finding (α_φ is the asymptotic floor, not a valid initial rate).
  • gen → 216 lines, 0 not yet implemented; the 5 required names count exactly 5; 13 test blocks; boundary exactly the one file.
  • dupe_scan: all 13 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 5a4d6f1, run 39029620014): lib.t27 row — reference pass, t27b pass, tests 13, invariants 0, asserts 47, blockers [], detail empty, reference_disagree: [].

CI (head 5a4d6f1): 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 #9443 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-phi-schedule/src/lib.rs (Rust, 5 functions) to specs/port/trios/crates/trios-phi-schedule/src/lib.t27

2 participants