25 lines
1.8 KiB
Markdown
25 lines
1.8 KiB
Markdown
# ADR-001 — Application versus financial authority
|
||
|
||
Status: **user-mandated direction**; the detailed backlog still awaits approval.
|
||
|
||
## Selected approach
|
||
|
||
TypeScript owns product/application logic, strategy authoring, signal/regime composition and research orchestration. Rust owns authoritative financial state transitions, deterministic replay, matching and risk. Keep a modular monolith, existing durable dispatch/runner, shared public contracts and existing web product.
|
||
|
||
## Rationale and evidence
|
||
|
||
Current TypeScript [applyFill](../../../../apps/stock/orchestrator/src/execution/model.ts#L108) and Rust [process_fill](../../../../apps/stock/engine/src/backtest/engine.rs#L426) are competing authorities. Consolidation removes behavioral drift; moving all authoring to Rust would reduce flexibility without proving a throughput benefit.
|
||
|
||
## Alternatives and tradeoffs
|
||
|
||
- All TypeScript: simpler language footprint, conflicts with required native financial authority.
|
||
- All Rust: less runtime crossing, conflicts with flexible TS development goals.
|
||
- Separate services per stage: more operational overhead without demonstrated need.
|
||
|
||
## Migration consequences
|
||
|
||
Preserve all existing recovery/data/registry/calculation behavior. Keep explicit legacy readers and paths until cutover tests pass, but never auto-fallback from a failed canonical run to legacy economics. Gates: F01–F08, S01–S03, R05; delete duplicate execution only in S06.
|
||
|
||
## Skeptical revision
|
||
|
||
Do not port reviewed statistical reporting to Rust solely for language uniformity. F08 consumes Rust financial postings/session marks through one existing TS calculation path; this is analysis, not competing cash/fill accounting. C06 uses a fail-closed legacy composition guard instead of building another soon-to-be-retired research runtime. One canonical SMA path is sufficient for initial cutover.
|