Repository navigation
spec(port): port specs/port/trios-railway/crates/trios-igla-race/src/ema.t27 (Closes #9683) - #9829
Conversation
…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))
|
@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 — What is verified:
CI (head df1ed2d): required trio green — The 3 reds are the base-red trio, not this change: 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) |
Summary
Port
gHashTag/trios-railway:crates/trios-igla-race/src/ema.rs(at385c2143ef46, 18 lines) asspecs/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:
newbuilds the tracker with its alpha and no value;updateseeds the average with the first sample, then blends every following sample asv * (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 selfthreading 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).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)