Final functional M5 iteration (specae905de, plan 67027ab; on green m5.1204c171+ m5.2b724cd1whose leak-proof resolved viadbd76e5). Proves the chunk/window-boundary-invisibility claim the M4 retirement rests on: - adapter::fold_window — purely additive windowed sibling of fold_symbol (same MidPriceStream+Kernel path; stream_tick_windowed). fold_symbol/MidPriceStream/Kernel byte-untouched. - chrono as a DEV-dep only — the time-shard test derives (y,m)->Unix-ms bounds (data-server's own precedent) and passes raw ms to the bin; the bin is date-math-free; Invariant 1 unaffected. - new single-responsibility [[bin]] timeshard_runner — one thread per disjoint window, each owning its Kernel (Ctx:!Send => compile-time per-thread-ctx). - tests/timeshard.rs — spec §3 strength-ordered: (a) per-shard (acc,n) BIT-EXACT vs single-thread host fold of that exact window in stream order (THE boundary-invisibility proof); (b) Σ partials bit-exact by construction; (c) whole-window within REL_TOL=1e-6 only (cross-shard f64 reassociation is host arithmetic, never a kernel property — bit-exact there would be the bug; tolerance derived from the recursive-summation error bound). Plus the now-deterministic leak-Σ + a journal-only friction timing capture (no bench gate, no timing assertion). Concrete pin: EURUSD 2017-03/04/05 (recon-verified present, contiguous, no gaps; data-server has no month-listing API). RED was a genuine deterministic compile failure (declared-but-absent bin source; Cargo missing-source error vs the plan's predicted env! error — same cause, no false-green; benign plan-text imprecision in Concerns). Boss-verified independently: timeshard determinism 5/5 (no jitter); full ail-embed suite 0 failed AND 0 ignored across all binaries (m5.2 symbol_fan_swarm_leak_free stays un-ignored & green — the saga's resolution intact); isolated embed_rc_global_stats_race still green; AILang workspace data-server count 0; compiler-surface diff empty (zero diff to crates/ailang-*, crates/ail/, runtime/, examples/*.ail, root Cargo.toml, DESIGN.md). Friction-harvest deliverable (P2 flat-array-decision input): host-per-tick-FFI ~= 658 ms / 3,192,562 ticks ~= ~206 ns/tick at real EURUSD volume. M5 functional work complete; milestone closes next via the mandatory audit (which also handles the pre-existing DESIGN.md:2358-2360 "additive M4 concern" drift, out of m5.3 scope). Includes the per-iter journal, stats, and the INDEX.md line.
5.0 KiB
iter embedding-abi-m5.3 — time-shard boundary-invisibility proof + friction harvest
Date: 2026-05-19
Started from: 67027ab0f9
Status: DONE
Tasks completed: 3 of 3
Summary
Final functional M5 iteration. Proves the chunk/window-boundary-invisibility
claim the M4 retirement rests on: one symbol (EURUSD), three disjoint
contiguous single-month windows (2017-03 / 2017-04 / 2017-05), each folded
on its own thread owning its own Kernel (Ctx: !Send makes
one-ctx-per-thread a compile-time guarantee), each shard's (acc,n)
asserted bit-exact vs a single-thread host fold of that exact window in
data-server stream order. Adds the windowed adapter sibling fold_window
(purely additive after fold_symbol), a new single-responsibility
[[bin]] timeshard_runner, and tests/timeshard.rs carrying the spec §3
strength-ordered (a)/(b)/(c) assertions plus the deterministic leak-Σ and a
journal-only friction-timing capture (no bench gate, no timing assertion).
The shipped m5.2 symbol-fan path (swarm_runner.rs, swarm.rs) and m5.1
core stay byte-untouched and green. Invariant 1 holds (the AILang workspace
graph has zero data-server; chrono enters only as an ail-embed
dev-dep). Determinism re-verified 6× (5× standalone + 1× in full suite),
all identical. Friction-harvest observed:
TIMING total_ticks=3192562 elapsed_ms=658 → derived per-tick-FFI cost
≈ 658 ms / 3,192,562 ≈ ~206 ns/tick (the Boss records this as the P2
flat-array-decision input in the close-out journal).
Per-task notes
- iter embedding-abi-m5.3.1: windowed adapter + chrono dev-dep + bin
declaration —
fold_window(server, symbol, from_ms, to_ms)appended toail-embed/src/adapter.rsimmediately afterfold_symbol, before the#[cfg(test)] mod testsblock (windowed sibling, sameMidPriceStream+Kernelpath, differs only bystream_tick_windowed);chrono = "0.4"added to[dev-dependencies]+[[bin]] timeshard_runnerdeclared inail-embed/Cargo.toml.--libregression check2 passed; 0 failed(exactly the plan's prediction). Spec compliant, quality approved, 0 re-loops. - iter embedding-abi-m5.3.2: the time-shard E2E test (RED) —
ail-embed/tests/timeshard.rscreated verbatim from the plan (boundary-invisibility (a)/(b)/(c) + leak-Σ + friction capture). RED observed: the declared-but-absent[[bin]] timeshard_runnersource makes the test binary fail to build. Spec compliant, quality approved, 0 re-loops. DONE_WITH_CONCERNS — see Concerns (RED-text discrepancy, same cause). - iter embedding-abi-m5.3.3: the
timeshard_runnerbin (GREEN) —ail-embed/src/bin/timeshard_runner.rscreated verbatim (one thread per window, each building its ownKernel; printsRESULT/TIMING). Step 2 GREEN (1 passed; 0 failed, ran 2.71s against real /mnt data — did NOT skip). Step 3 determinism ×5: 5/5ok. Step 4 full suite: 0 failed AND 0 ignored across all binaries (m5.2symbol_fan_swarm_*un-ignored & green). Step 5:cargo metadatadata-server count = 0; path filter empty. Step 6:embed_rc_global_stats_race1 passed; 0 failed. Spec compliant, quality approved, 0 re-loops.
Concerns
- iter embedding-abi-m5.3.2 (DONE_WITH_CONCERNS): the Task 2 Step 2 RED
surfaced as
error: couldn't read \src/bin/timeshard_runner.rs`: No such file or directoryrather than the plan's predictederror: environment variable `CARGO_BIN_EXE_timeshard_runner` not defined at compile time. Same root cause (the declaredbin timeshard_runnertarget has no source until Task 3), same trigger, same resolution (disappears exactly when Task 3 lands the bin) — Cargo fails at the missing-source check before reaching theenv!` expansion, so the surface error differs but the RED is genuine, deterministic, and not a false-green. Observation only; the plan's intent (a deterministic compile-failure RED isolating Task 2 from Task 3) is fully satisfied.
Known debt
- (none introduced by this iter)
- Pre-existing
docs/DESIGN.md:2358-2360"additive M4 concern" drift is explicitly out of m5.3 scope (spec §"Out of scope" / Boss decision) and was deliberately not touched — the milestone-close audit handles it, not this iter.
Blocked detail
(not applicable — Status DONE)
Files touched
ail-embed/src/adapter.rs(modified — additivefold_window)ail-embed/Cargo.toml(modified —chronodev-dep +timeshard_runnerbin)ail-embed/Cargo.lock(modified — single line:chronodirect-dep edge; automatic, strictly required by the Cargo.toml dep add, already resolved transitively via data-server)ail-embed/src/bin/timeshard_runner.rs(created)ail-embed/tests/timeshard.rs(created)
All within the plan's declared file set and the Step 5b allowed path scope
(ail-embed/**, docs/, bench/orchestrator-stats/). Zero diff to
crates/ailang-*, crates/ail/, runtime/, examples/*.ail, root
Cargo.toml, docs/DESIGN.md.
Stats
bench/orchestrator-stats/2026-05-19-iter-embedding-abi-m5.3.json