feat(research): run stateful TypeScript strategies on canonical replay

This commit is contained in:
Boki 2026-10-23 13:08:24 -04:00
parent 0870b55830
commit 2bcadbd117
14 changed files with 1864 additions and 33 deletions

View file

@ -55,3 +55,11 @@ Keep migrations additive and previous results readable. Do not add a switch that
## Handoff
Report scope changes (if any), fixture expectations, API/schema changes, measurements, remaining limitations and commit/PR references once authorized. Request independent review; only the integration/planning owner may mark the manifest done.
## S01 integration handoff — 2026-10-23
Consume `contracts/canonical-strategy.ts` and `backtest/strategy-runtime.ts`: typed synchronous programs return JSON next state and financial intent; the host owns per-instance seeds/cursors and Rust owns admission/accounting. Reuse reviewed incremental calculation semantics. Preserve the current legacy factory contract; add only the small trusted built-in resolver/composition needed to select the canonical SMA version deliberately.
Wire that reviewed built-in through the existing native worker with explicit strategy/version/parameters and retained dataset/config inputs. Never serialize callback functions/source or accept arbitrary module paths. Keep legacy and conformance requests intact; unknown canonical strategies/versions reject explicitly. R05 still owns durable default and public-result migration. No browser/default activation or paper migration is implied here.
S01 retries whole attempts from frozen inputs and original state/seeds. Its snapshots are diagnostic, not native resume tokens. `sma_checkpoint_restore` should verify indicator state serialization/recomputation and full retry equivalence without introducing TS-only mid-run financial resume. Admission feedback is not a complete fill-event feed; positions/open orders remain authoritative native views.