Skip to content

spec(port): port specs/port/trios-railway/crates/trios-igla-race/src/ema.t27 (Closes #9683) - #9829

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

gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9683-race-ema

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Contributor

Summary

Port gHashTag/trios-railway:crates/trios-igla-race/src/ema.rs (at 385c2143ef46, 18 lines) as specs/port/trios-railway/crates/trios-igla-race/src/ema.t27 — Roadmap Stage 6 (goal #4548), target t27c gen-rust. Closes #9683.

The original tracks an exponential moving average: new builds the tracker with its alpha and no value; update seeds the average with the first sample, then blends every following sample as v * (1 - alpha) + x * alpha.

Per the issue's rule ("Port the decision, not the plumbing"), both listed functions are ported under their names as pure functions — the Rust Option<f64> value becomes the presence flag on the port's state, and the &mut self threading becomes the state chain — with 6 tests (11 runtime asserts, 0 vacuous, 100% function coverage):

  • EmaTracker_new — the unseeded start (original lines 6-9);
  • EmaTracker_update — the two decisions: an unseeded tracker takes the sample as its value (the seed, original line 14), a seeded one blends it (original line 13);
  • ema_blend — the blend formula, tested directly and at the alpha extremes: alpha 0 freezes the average, alpha 1 tracks the sample.

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: 3/3 tested (100%) — no transports in this port.
  • t27c test-report: 6 tests / 6 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes.
  • t27c gen | grep -c 'not yet implemented': 0; gen | wc -l: 65 (> 12).
  • grep -cE '^\s*(pub )?fn (EmaTracker_new|EmaTracker_update)\(': 2. grep -cE '^\s*test\s+(["|[A-Za-z_])': 6 (≥ 2).
  • Boundary: git status --short — exactly this one file. The repo's lefthook pre-commit passed.
  • dupe_scan: all 3 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)

…ema.t27 (Closes gHashTag#9683)

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

The EMA tracker's decisions are ported as pure functions and tested
(6 tests, 6 pass, 0 vacuous, 11 runtime asserts, 100% function
coverage): the tracker starts unseeded, the first update seeds the
average with the sample, every following update blends it as
v * (1 - alpha) + x * alpha - including the alpha extremes, where
alpha 0 freezes the average and alpha 1 tracks the sample. The Rust
Option becomes the presence flag on the state, and the &mut self
threading becomes the state chain, keeping both listed functions
pure. No transport exists in this port.

Verified: parse OK, spec-status IMPLEMENTED, typecheck 0 errors,
coverage 3/3, test-report 6/6 pass, 0 BLOCKED, gen 65 lines with 0
'not yet implemented', boundary exactly this one file, dupe_scan:
all 3 names unique across 2040 specs, 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 #9683 port — crates/trios-igla-race/src/ema.rs (gHashTag/trios-railway, at 385c2143ef46, 18 lines) re-authored as specs/port/trios-railway/crates/trios-igla-race/src/ema.t27. One file, head df1ed2d6e, Closes #9683.

What is verified:

  • t27c parse OK, spec-status IMPLEMENTED, typecheck 0 errors / 0 warnings, coverage 3/3 (100%) — no transports, t27c test-report 6 tests / 6 pass / 0 FAIL / 0 BLOCKED, 0 vacuous — the unseeded start, the first-sample seed, the blend formula directly, the blend after the seed, and both alpha extremes (0 freezes, 1 tracks).
  • gen → 65 lines, 0 not yet implemented; the 2 required names count exactly 2; 6 test blocks; boundary exactly the one file.
  • dupe_scan: all 3 names unique across 2040 specs; bare body scan adds no duplicate group (752/221 unchanged).
  • The t27b-native-run artifact of this head (commit df1ed2d, run 38999903674): ema.t27 row — reference pass, t27b pass, tests 6, invariants 0, asserts 11, blockers [], detail empty, reference_disagree: [].

CI (head df1ed2d): 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 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 #9683 auto-closed, and file the 14-step report.

Dmitrii Fedorov (@dmitrii-f-t27)

@gHashTag
gHashTag merged commit 6b3e718 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

Development

Successfully merging this pull request may close these issues.

Port gHashTag/trios-railway:crates/trios-igla-race/src/ema.rs (Rust, 2 functions) to specs/port/trios-railway/crates/trios-igla-race/src/ema.t27

2 participants