feat(engine): add deterministic historical replay

This commit is contained in:
Boki 2026-10-22 23:34:35 -04:00
parent ccf333cc0a
commit 417a7bd21e
10 changed files with 2055 additions and 28 deletions

View file

@ -1,6 +1,6 @@
# Canonical development backlog
**First seven waves committed; F04/F05 independently reviewed and validated, uncommitted.** Consult manifest execution_scope, [ROADMAP](../ROADMAP.md), [skeptical review](../REVIEW.md) and [first-wave handoff](../FIRST-WAVE.md). ADR-002/003/004 are approved. The owner authorized F05 on F04's validated integrated source without requesting a commit. Other tasks/policies remain gated.
**First nine waves committed; F06 independently reviewed and validated, uncommitted.** Consult manifest execution_scope, [ROADMAP](../ROADMAP.md), [skeptical review](../REVIEW.md) and [first-wave handoff](../FIRST-WAVE.md). ADR-002/003/004 are approved. The owner authorized the F04/F05 commit (`ccf333c`) and F06 continuation. Other tasks/policies remain gated.
## One source of truth
@ -32,9 +32,9 @@ Relative size: S narrow correction, M coherent boundary, L sensitive owner-contr
| [F01 Define the minimal financial contract and economic fixtures](tasks/F01.md) | P0 / done | ADR-002, ADR-003, ADR-004 (approved) | — | Rust financial contract owner / M |
| [F02 Implement one owner-aware financial ledger](tasks/F02.md) | P0 / done | F01, ADR-002 | — | Rust accounting / L |
| [F03 Add strategy-owned position books and fill allocations](tasks/F03.md) | P0 / merged → F02 | None | — | Rust portfolio accounting / M |
| [F04 Enforce cash reservations and portfolio risk centrally](tasks/F04.md) | P0 / review | F02, ADR-002, ADR-003 | — | Rust financial risk / L |
| [F05 Unify matching and order lifecycle on the ledger](tasks/F05.md) | P0 / review | F04, ADR-003 | F06 | Rust execution semantics / L |
| [F06 Implement deterministic replay once, with linear historical traversal](tasks/F06.md) | P0 / blocked | F05, D01, P01, ADR-003 | — | Rust deterministic replay / M |
| [F04 Enforce cash reservations and portfolio risk centrally](tasks/F04.md) | P0 / done | F02, ADR-002, ADR-003 | — | Rust financial risk / L |
| [F05 Unify matching and order lifecycle on the ledger](tasks/F05.md) | P0 / done | F04, ADR-003 | F06 | Rust execution semantics / L |
| [F06 Implement deterministic replay once, with linear historical traversal](tasks/F06.md) | P0 / review | F05, D01, P01, ADR-003 | — | Rust deterministic replay / M |
| [F07 Expose bounded Rust step sessions through existing NAPI workers](tasks/F07.md) | P0 / blocked | F06, C02, ADR-004 | — | Rust/TypeScript integration / M |
| [F08 Publish canonical metrics and versioned result projections](tasks/F08.md) | P1 / blocked | F06, ADR-002, ADR-003 | — | Quant analytics/Rust integration / M |
@ -75,7 +75,7 @@ Relative size: S narrow correction, M coherent boundary, L sensitive owner-contr
| [R02 Deliver strategy catalog and version-aware backtest setup](tasks/R02.md) | P1 / blocked | R01, W03, ADR-006 | W04 | Full-stack research product / M |
| [R03 Add projects, hypotheses and evidence-linked findings APIs](tasks/R03.md) | P1 / blocked | R01, R10, ADR-006 | — | Full-stack research product / M |
| [R04 Deliver research workspace and save-findings flow](tasks/R04.md) | P1 / blocked | R03, W02, ADR-006 | W04 | Full-stack research product / M |
| [R05 Freeze complete provenance and cut over durable canonical runs](tasks/R05.md) | P0 / blocked | F08, S02, R01, R10, D01, W03, C06, ADR-006 | — | Full-stack research product / M |
| [R05 Freeze complete provenance and cut over durable canonical runs](tasks/R05.md) | P0 / blocked | F08, S02, R01, R10, D01, W03, C06, ADR-006 | Multi-asset default mark-policy disposition | Full-stack research product / M |
| [R06 Create immutable experiments and bounded sweep expansion](tasks/R06.md) | P1 / blocked | R05, ADR-006 | — | Full-stack research product / M |
| [R07 Deliver sweep configuration and comparable-result views](tasks/R07.md) | P1 / blocked | R06, ADR-006 | W04 | Full-stack research product / M |
| [R08 Add bounded chronological and reset-segment validation](tasks/R08.md) | P1 / blocked | R06, ADR-006 | — | Quantitative research integrity / M |
@ -115,4 +115,4 @@ Relative size: S narrow correction, M coherent boundary, L sensitive owner-contr
Before any wave: unique IDs; existing task/ADR references; acyclic implementation graph; no scheduled task dependent on merged/deferred work; approvals/readiness; actual file locks; isolated native build outputs/workspace dependencies and test databases. Release gates are checked separately at activation.
The first seven waves are independently reviewed, validated and committed with owner approval. Evidence is recorded in [FIRST-WAVE.md](../FIRST-WAVE.md#execution-record--2026-10-22), the [ROADMAP handoffs](../ROADMAP.md#ninth-wave-handoff--2026-10-22) and the manifest. The latest owner request authorized **F05** using accepted integrated F04. Both implementations are now independently reviewed and `validated_uncommitted`; F05's explicit integration overlay pins its prerequisite source, and ninth-wave validation records the resulting cumulative seven-file financial overlay. Next after acceptance: F06. R01 still needs ADR-006; other consumers wait for their dependencies. No commit, push, PR or trading operation is authorized.
The first nine waves are independently reviewed, validated and committed with owner approval. Evidence is recorded in [FIRST-WAVE.md](../FIRST-WAVE.md#execution-record--2026-10-22), the [ROADMAP handoffs](../ROADMAP.md#tenth-wave-handoff--2026-10-22) and the manifest. The latest owner request committed F04/F05 as `ccf333c` and authorized **F06**, now reviewed and `validated_uncommitted`. Next after acceptance: F07's verified dataset/native adapter. F08 is another eligible component successor after acceptance; coordinate any shared result/native contracts. R01 still needs ADR-006. The manifest's canonical release gate records the unresolved multi-asset mark-policy decision; this does not block additive adapter work. No push, PR, trading operation or further task implementation is authorized.

View file

@ -1,13 +1,13 @@
{
"schema_version": 1,
"plan_revision": "2026-10-22.21",
"plan_revision": "2026-10-22.23",
"repository_base": "b7aeca4",
"plan_status": "ninth_wave_validated_uncommitted",
"plan_status": "tenth_wave_validated_uncommitted",
"execution_authorized": true,
"execution_scope": {
"authorized_by": "User: do it (2026-10-22), authorizing the explicitly proposed F05 continuation on accepted integrated F04; no commit requested",
"authorized_by": "User: commit all and do it (2026-10-22), authorizing the F04/F05 commit and proposed F06 continuation",
"tasks": [
"F05"
"F06"
],
"permissions": [
"isolated_implementation",
@ -16,7 +16,7 @@
"planning_progress_updates"
],
"excluded": [
"commits_without_further_approval",
"new_wave_commits_without_further_approval",
"push",
"pull_requests",
"live_or_paper_operations",
@ -437,7 +437,7 @@
"epic": "E2",
"priority": "P0",
"severity": "Critical",
"status": "review",
"status": "done",
"dependencies": [
"F02"
],
@ -460,7 +460,7 @@
"assignment": "/root/wave8_f04",
"branch": "wave8/f04-financial-risk",
"pull_request": null,
"completed_commit": null,
"completed_commit": "ccf333cc0ae9bcf1cc81ff6cc50099686738def2",
"blocker": null,
"release_gates": [],
"worktree": "/tmp/stock-bot-wave8.pKzr7p/f04",
@ -468,14 +468,14 @@
"concrete_write_scope": [
"apps/stock/engine/src/financial/"
],
"integration_state": "validated_uncommitted",
"integration_state": "validated_committed",
"reviewed_by": [
"/root/wave8_risk_review",
"/root/wave8_quant_review"
],
"review_notes": "Both independent reviewers and combined gates passed; owner accepted continuation to F05. Integrated F04 remains uncommitted, with frozen source hashes recorded in eighth_wave_validation.",
"review_notes": "Both independent reviewers and combined gates passed; owner accepted continuation to F05. Integrated F04 remains uncommitted, with frozen source hashes recorded in eighth_wave_validation. Subsequently committed at owner request as ccf333c.",
"verification_reference": "ROADMAP.md#eighth-wave-handoff--2026-10-22",
"accepted_by": "Owner: do it, authorizing proposed F05 continuation on validated integrated F04 (2026-10-22)"
"accepted_by": "Owner: commit all and do it (2026-10-22), accepting F04/F05 and authorizing F06"
},
{
"id": "F05",
@ -483,7 +483,7 @@
"epic": "E2",
"priority": "P0",
"severity": "Critical",
"status": "review",
"status": "done",
"dependencies": [
"F04"
],
@ -507,7 +507,7 @@
"assignment": "/root/wave9_f05",
"branch": "wave9/f05-matching",
"pull_request": null,
"completed_commit": null,
"completed_commit": "ccf333cc0ae9bcf1cc81ff6cc50099686738def2",
"blocker": null,
"release_gates": [
"F06"
@ -523,13 +523,14 @@
"concrete_write_scope": [
"apps/stock/engine/src/financial/"
],
"integration_state": "validated_uncommitted",
"review_notes": "Both independent reviewers accepted the final frozen source; root integrated matching hashes and passed all repository checks plus the release matching measurement. No active runtime cutover; F06 remains the replay release gate.",
"integration_state": "validated_committed",
"review_notes": "Both independent reviewers accepted the final frozen source; root integrated matching hashes and passed all repository checks plus the release matching measurement. No active runtime cutover; F06 remains the replay release gate. Subsequently committed at owner request as ccf333c.",
"reviewed_by": [
"/root/wave9_execution_review",
"/root/wave9_quant_review"
],
"verification_reference": "ROADMAP.md#ninth-wave-handoff--2026-10-22"
"verification_reference": "ROADMAP.md#ninth-wave-handoff--2026-10-22",
"accepted_by": "Owner: commit all and do it (2026-10-22), accepting F04/F05 and authorizing F06"
},
{
"id": "F06",
@ -537,7 +538,7 @@
"epic": "E2",
"priority": "P0",
"severity": "Critical",
"status": "blocked",
"status": "review",
"dependencies": [
"F05",
"D01",
@ -558,12 +559,26 @@
"rust-replay"
],
"parallel_policy": "Allowed only with satisfied dependencies/approvals and disjoint write locks AND actual files; see agents/integration.md.",
"assignment": null,
"branch": null,
"assignment": "/root/wave10_f06",
"branch": "wave10/f06-replay",
"pull_request": null,
"completed_commit": null,
"blocker": null,
"release_gates": []
"release_gates": [],
"worktree": "/tmp/stock-bot-wave10.8uCLfa/f06",
"integration_base": "ccf333cc0ae9bcf1cc81ff6cc50099686738def2",
"concrete_write_scope": [
"apps/stock/engine/src/financial/replay.rs",
"apps/stock/engine/src/financial/replay_tests.rs",
"apps/stock/engine/src/financial/mod.rs"
],
"integration_state": "validated_uncommitted",
"review_notes": "Both independent reviewers accepted exact frozen source; combined repository gates and integrated release replay measurement passed. Internal bar replay only; active simulator/NAPI/SQL unchanged. Material sequential equal-time risk approximation remains the canonical multi-asset default policy gate.",
"reviewed_by": [
"/root/wave10_replay_review",
"/root/wave10_quant_review"
],
"verification_reference": "ROADMAP.md#tenth-wave-handoff--2026-10-22"
},
{
"id": "F07",
@ -3230,5 +3245,122 @@
],
"handoff": "F04/F05 independently reviewed and validated, uncommitted. Next after owner acceptance: F06 availability-aware deterministic replay. No commit, push, PR, other task implementation or trading operation.",
"cleanup": "No services/data removed; isolated worktree and logs retained."
},
"canonical_release_gates": [
{
"id": "multi_asset_mark_policy",
"status": "requires_owner_disposition",
"applies_to": [
"R05"
],
"capability": "Canonical multi-asset research as the default",
"evidence": "F06 sequential_equal_time_marks_can_latch_risk_before_synchronized_barrier: offsetting same-time marks preserve final equity but latch intermediate daily/drawdown halts under F04/F05 per-mark risk.",
"resolution": "Owner must explicitly accept the disclosed versioned sequential-mark approximation or approve a coordinated atomic-mark policy change with independent fixtures before default activation.",
"does_not_block": [
"F06 additive integration",
"F07 internal/native adapter work",
"single-asset component work"
],
"task_reference": "backlog/tasks/R05.md",
"approved_by": null
}
],
"tenth_wave": [
"F06"
],
"tenth_wave_base": "ccf333cc0ae9bcf1cc81ff6cc50099686738def2",
"tenth_wave_notes": [
"Owner authorized committing all existing reviewed F04/F05 work and continuing F06; existing work committed ccf333c. No push, PR or trading operations.",
"One isolated implementation owner, two independent read-only reviewers; root owns planning/integration. Dependencies F05/D01/P01 committed; ADR003 approved.",
"Internal prepared-bar replay only. Frozen D01 adaptation and public NAPI sessions stay F07; TypeScript strategy state/RNG stays S01; metrics F08. No active legacy cutover.",
"Pin true session initialization, late-data mark/volume handling, series tie breaks, shared coordinator barrier revision, terminal failure and half-open trading bounds."
],
"tenth_wave_validation": {
"base": "ccf333cc0ae9bcf1cc81ff6cc50099686738def2",
"integration_state": "validated_uncommitted",
"committed_prerequisites": "Owner requested all existing changes committed, producing ccf333c for F04/F05 plus planning. F06 uses that exact base without overlays.",
"repository_check": {
"command": "CARGO_BUILD_JOBS=2 bun run check",
"log": "/tmp/stock-bot-wave10.8uCLfa/integration-check.log",
"exit_code": 0,
"passed": {
"tooling": 60,
"utils": 43,
"calculations": 35,
"integration": 342,
"rust": 131
},
"rust_manual_benchmarks_ignored": 4,
"other_gates": "Build, typecheck, contracts, lint and secret audit passed."
},
"independent_review": {
"timing": "/root/wave10_replay_review: accepted frozen source; independently ran debug artifact focused25passed/1ignored and full131passed/4ignored, zero failures. Reviewed completed frozen release measurement.",
"quant": "/root/wave10_quant_review: accepted frozen source; focused25passed/1ignored, zero failures; reviewed full-suite log and release measurement. No competing financial authority or future-data exposure through prefix API.",
"debug_artifact": "/tmp/stock-bot-wave10.8uCLfa/f06/target/debug/deps/engine-318becfe365f2c10",
"debug_artifact_sha256": "1e90db0aa3aeb327ac1aeb6985b47f0226c1231077d78b499e969b49b43c688f",
"coordination": "Quant focused Cargo invocation finished without recompilation before direct-binary-only coordination; subsequent timing review executed the frozen test binary. No shared/symlinked native build output between worktrees."
},
"scoped_checks": [
"rustfmt --edition 2021 --check --config skip_children=true on three changed financial files passed.",
"git diff --check; manifest IDs/task/ADR references, acyclic dependencies and authorized prerequisite readiness passed.",
"Integrated source hashes match the three independently reviewed files; base and previously committed financial files remain unchanged."
],
"source_hashes": {
"apps/stock/engine/src/financial/replay.rs": "0c9d466e96549571ae29247528351058f5a91563215f5bed83cfaea0205411cf",
"apps/stock/engine/src/financial/replay_tests.rs": "3e2b150bc142f5361592328f807a5e577732bc515a3d38ca525bed8e52952ee4",
"apps/stock/engine/src/financial/mod.rs": "6c90bd6ec2bd2702f9c9e3a13c226e3578749c83cd2b06dcdb51dd6aceb3bb90"
},
"native_artifact": {
"path": "apps/stock/engine/dist/engine.node",
"sha256": "26c323c45ab947146db71424008406ae37c6603293ed46b8b81cda80c1d2fd95",
"note": "Built from integrated checkout; native API still uses legacy simulator."
},
"measurement": {
"command": "CARGO_BUILD_JOBS=2 cargo test -p engine --lib --release --offline replay_scaling_measurement -- --ignored --nocapture",
"author_log": "/tmp/stock-bot-wave10.8uCLfa/f06-replay-release-frozen.log",
"integrated_log": "/tmp/stock-bot-wave10.8uCLfa/integration-replay-release.log",
"result": "1 passed,0 failed;134 filtered. Author and integrated frozen builds passed18 rows each; earlier ledger/risk/matching manual measurements not repeated.",
"artifact": "target/release/deps/engine-abe56cbc3e15ae30",
"artifact_sha256": "0d20d304471e0f780b72f133ceefb120a5f3f20becb3b5042137efeb46b29f73",
"host": "AMD Ryzen9 9950X3D; Linux6.8 x86_64; Rust/Cargo1.88.0; build jobs2. Author/integrated release artifact hashes match.",
"workload": "1/2assets with1k/10k/100k total execution bars plus1feature/cadence row;3repeats, no explicit warmup. Exactly1decision/buy/fill quantity1@10,fee0.1,initialcapital10000; remaining traversal performs marks/open events. Fixed synthetic10ms bars exercise internal prepared cursor, not D01 interval normalization.",
"timing": "Input generation/cloning excluded. Load includes canonicalization/validation/event sorting/exact binding serialization. Traversal includes fixture decision construction and matcher marks/journals. Checkpoint copy and restore separately timed; restore includes new/load/fixed-trace replay and full checkpoint validation copy. Output serialization excluded.",
"equality": "Expected cash9989.9/equity9999.9 and one accepted fill asserted. Full checkpoint bytes identical across3repeats per fixture; restored checkpoint equal. Ordinary permutation regressions also compare full checkpoints. No cross-platform determinism claim.",
"raw_integrated_rows": [
"replay instruments=1 execution_bars=1000 total_bars=1001 repeat=0 load_us=808 replay_us=10823 checkpoint_us=3512 restore_us=14572 checkpoint_bytes=4204033 fills=1",
"replay instruments=1 execution_bars=1000 total_bars=1001 repeat=1 load_us=662 replay_us=9907 checkpoint_us=1736 restore_us=14115 checkpoint_bytes=4204033 fills=1",
"replay instruments=1 execution_bars=1000 total_bars=1001 repeat=2 load_us=766 replay_us=9337 checkpoint_us=1582 restore_us=12684 checkpoint_bytes=4204033 fills=1",
"replay instruments=1 execution_bars=10000 total_bars=10001 repeat=0 load_us=7004 replay_us=108708 checkpoint_us=37550 restore_us=160897 checkpoint_bytes=42449082 fills=1",
"replay instruments=1 execution_bars=10000 total_bars=10001 repeat=1 load_us=6876 replay_us=101074 checkpoint_us=26523 restore_us=151922 checkpoint_bytes=42449082 fills=1",
"replay instruments=1 execution_bars=10000 total_bars=10001 repeat=2 load_us=7099 replay_us=99939 checkpoint_us=24254 restore_us=149012 checkpoint_bytes=42449082 fills=1",
"replay instruments=1 execution_bars=100000 total_bars=100001 repeat=0 load_us=78537 replay_us=1062133 checkpoint_us=338708 restore_us=1631855 checkpoint_bytes=429579131 fills=1",
"replay instruments=1 execution_bars=100000 total_bars=100001 repeat=1 load_us=77106 replay_us=1113410 checkpoint_us=288906 restore_us=1546489 checkpoint_bytes=429579131 fills=1",
"replay instruments=1 execution_bars=100000 total_bars=100001 repeat=2 load_us=76279 replay_us=1061281 checkpoint_us=277388 restore_us=1556940 checkpoint_bytes=429579131 fills=1",
"replay instruments=2 execution_bars=1000 total_bars=1001 repeat=0 load_us=721 replay_us=8325 checkpoint_us=1334 restore_us=11212 checkpoint_bytes=4200000 fills=1",
"replay instruments=2 execution_bars=1000 total_bars=1001 repeat=1 load_us=697 replay_us=8090 checkpoint_us=1246 restore_us=11194 checkpoint_bytes=4200000 fills=1",
"replay instruments=2 execution_bars=1000 total_bars=1001 repeat=2 load_us=721 replay_us=7795 checkpoint_us=1207 restore_us=10951 checkpoint_bytes=4200000 fills=1",
"replay instruments=2 execution_bars=10000 total_bars=10001 repeat=0 load_us=7768 replay_us=87483 checkpoint_us=25049 restore_us=140364 checkpoint_bytes=42419059 fills=1",
"replay instruments=2 execution_bars=10000 total_bars=10001 repeat=1 load_us=7793 replay_us=87431 checkpoint_us=25305 restore_us=136945 checkpoint_bytes=42419059 fills=1",
"replay instruments=2 execution_bars=10000 total_bars=10001 repeat=2 load_us=7667 replay_us=87640 checkpoint_us=26653 restore_us=138028 checkpoint_bytes=42419059 fills=1",
"replay instruments=2 execution_bars=100000 total_bars=100001 repeat=0 load_us=84055 replay_us=958878 checkpoint_us=286388 restore_us=1422346 checkpoint_bytes=429289118 fills=1",
"replay instruments=2 execution_bars=100000 total_bars=100001 repeat=1 load_us=83135 replay_us=906061 checkpoint_us=275798 restore_us=1394171 checkpoint_bytes=429289118 fills=1",
"replay instruments=2 execution_bars=100000 total_bars=100001 repeat=2 load_us=85020 replay_us=961257 checkpoint_us=278030 restore_us=1421355 checkpoint_bytes=429289118 fills=1"
],
"limits": "One-fill canonical Rust component workload, not order-heavy TS/NAPI, storage, batch or cold-process throughput; no speedup claim. Preparation O(n log n); event traversal linear plus existing matching/risk/map/journal work. Serialized full checkpoint~4.2/42.4/429MB at1k/10k/100k, not RSS. Journals/history retained; no compaction."
},
"not_run": [
"Disposable PostgreSQL/Redis, browser and Python suites: persistence/API/UI/Python boundaries unchanged."
],
"limitations": [
"Trusted prepared bars/session tables, not frozen D01 admission. F07 must verify/adapt dataset hashes, decimals, calendars, execution selection, eligibility and limitations.",
"Quote replay and abutting same-series venue sessions reject. Internal synthetic test intervals are not a new persisted dataset timeframe.",
"Sequential equal-time marks can latch intermediate daily/drawdown halts despite recovered synchronized equity. Explicit regression/model limitation; canonical_release_gates.multi_asset_mark_policy remains unresolved before R05 multi-asset default.",
"Event budgets bound count, not wall time. No mutable matcher access, but host APIs are not untrusted-code security boundaries; F07 must not expose checkpoints/full prepared data to strategies.",
"Checkpoints bind exact canonical input/config content and validate fixed decision replay; not authenticated provenance, arbitrary TS determinism or strategy/RNG recomputation.",
"Event-index-derived IDs can differ when a feature dataset changes; unused-feature tests compare unchanged economic/cadence behavior, not IDs across different bindings.",
"No active simulator, NAPI, SQL/paper or web cutover. Existing build warnings remain."
],
"handoff": "F04/F05 committed ccf333c at owner request. F06 independently reviewed and validated, uncommitted. Next after acceptance: F07 verified dataset/native pull adapter; F08 result projection may follow with coordinated contracts. No push, PR, other task implementation or trading operation.",
"cleanup": "No services/data removed; isolated worktree and logs retained."
}
}

View file

@ -16,6 +16,16 @@ Implement the replay cursor once: sorted immutable events with stable availabili
Consume F05's explicit event contract without reconstructing a second matcher: quote observation time is not delivery time, and eligibility requires an order to be ready by physical quote time. Open time must equal its execution key; skip/reject missed opens, never relabel them as newly occurring. Decision admission uses the coordinator's shared portfolio/order revision, distinct from the nested economic ledger revision. Terminal F05 failures retain diagnostic prefixes but must fail/discard the replay attempt, never produce successful performance results.
## Execution handoff clarifications
- Add an internal prepared-input cursor over MatchingAccount, not a second public session API or a legacy-runtime cutover. D01 currently has bar datasets only: reject quote-mode replay input until a quote dataset contract exists. Existing F05 quote tests remain relevant matcher evidence, not a claim of quote replay support.
- Accept typed prepared bars with canonical decimals and retained session boundaries. Document that F07 must verify/adapt the frozen D01 snapshot; do not duplicate the TS normalizer/hash algorithm. Validate executable-series/config agreement, raw execution prices, bounds and eligibility; retain exploratory limitations. Bind checkpoints to the exact prepared input/config, not only a caller-supplied dataset label.
- Initialize using true venue open times, including the preceding open for a mid-session warmup/start. Never restamp missed opens. Publish late observations without regressing authoritative mark time; capacity uses the physically latest completed available execution-series volume, not latest arrival or future volume.
- Resolve feature-series sequence ties with stable series identity. Only declared cadence triggers decisions; due owners share one immutable context/revision. Warmup cannot trade; observations at tradeEnd may mark only; later observations are unavailable.
- Internal barrier/cursor/checkpoint and fixed decision-trace replay belong here. Public NAPI session protocol, frozen dataset transport, TS strategy state/RNG and strategy recomputation belong to F07/S01. Prefer offset-based observation prefixes to copying all history on every advance.
- Sorting may be O(n log n); traversal is linear plus matching/risk work. Measure 1k/10k/100k release workloads with economics equality and explicit load/replay timing. This is a canonical Rust component measurement, not TS callback or end-to-end research throughput.
- Existing F04/F05 policy evaluates risk after each mark. Equal-time cross-asset marks are applied in deterministic instrument order, not atomically: an intermediate portfolio value can latch a loss/drawdown halt even when the final same-time valuation recovers. Pin this behavior with a permutation regression and disclose it as a modeling limitation. Do not implement an F06-local risk bypass or silently introduce atomic marking; changing that economic policy requires coordinated approval and fixtures.
## Exclusions
No unrelated refactor, new service, broker enablement, or silent reinterpretation of historical results.
@ -47,6 +57,7 @@ Parallel eligibility: only with disjoint actual files and reserved write locks;
- adjacent_open_zero_latency, positive_latency_skips_open, future_ohlcv_does_not_change_open_fill, daily_close_target_survives_to_open.
- feature_timeframe_does_not_duplicate_liquidity, equal_timestamp_symbol_permutation, warmup_cannot_trade, stale_mark_timestamp_preserved.
- Replay/restore trace equality. Extend P01 with1k/10k/100k release-build load/replay scaling; preserve economics before accepting faster runs.
- Delayed older observations do not regress marks/capacity; mid-session starts retain true session boundaries; terminal observations are mark-only; equal-time feature-series sequence ties are stable; altered input/config checkpoint restore rejects.
Apply relevant [quality gates](../../QUALITY-GATES.md). Report exact commands/results and unavailable checks; named new cases are requirements, not claims of existing passing tests.

View file

@ -12,7 +12,11 @@ Scheduling source of truth: [manifest entry F07](../manifest.json). No task is a
## Intended behavior and implementation scope
Expose a small pull session (load/create/advance/submit/finalize/dispose) in the existing worker, backed by the same financial kernel. advance returns a tagged union: progress, decision batch, or complete. For a decision batch, all due strategies receive immutable views from the same ledger revision; collect all decisions before ordered admission. Use one native test strategy/intent trace for conformance, not a port of every Rust built-in. Per-session dataset load once; cross-trial residency is P03.
Expose a small pull session (load/create/advance/submit/finalize/dispose) in the existing worker, backed by the same financial kernel. advance returns a tagged union: progress, decision batch, or complete. For a decision batch, all due strategies receive the same immutable financial view; collect all decisions before ordered admission. The submission token is F05/F06's coordinator admission revision, not the nested ledger snapshot revision (reservations and order state can change without an economic posting). Use one native test strategy/intent trace for conformance, not a port of every Rust built-in. Per-session dataset load once; cross-trial residency is P03.
F06 consumes internal typed prepared bars/session tables, not an independently authenticated D01 snapshot. This adapter must verify the frozen v2 dataset with the existing normalizer/hash verifier, preserve its hash/eligibility/limitations, convert numeric fields through canonical decimal ingress, and map exact calendars/execution series/bounds into F06. Do not trust a supplied hash label alone or reconstruct a competing normalizer. Quote replay stays unsupported until its dataset contract is explicitly added. Retain prefix-only strategy contexts; do not expose native full-dataset/checkpoint host handles to strategy callbacks.
Expose recorded model limitations, including F06's explicitly unsupported abutting venue sessions and F04/F05's sequential equal-time portfolio marks (intermediate valuations can latch risk halts). An event budget bounds event count, not wall time or the cost of an individual matching transition. These are not promises of atomic multi-asset valuation, arbitrary-calendar support or constant-latency cancellation.
## Exclusions

View file

@ -48,6 +48,7 @@ Parallel eligibility: only with disjoint actual files and reserved write locks;
- Sharpe uses periodic excess-return mean/std; Sortino uses downside deviation relative to the declared target; zero-variance/undefined cases are null with reasons.
- Exposure uses the union of occupied intervals; open positions count; attribution distinguishes fills and round trips.
- Reviewed calculation functions are reused where their conventions match. Any deliberate difference has a versioned policy and independent arithmetic fixture, not an unexplained second formula.
- Preserve the sequential equal-time marking policy and its material risk limitation in result provenance: intermediate valuations may latch halts despite a recovered synchronized value. Do not report such traces as atomically marked portfolio risk. Before canonical multi-asset default cutover, apply R05's explicit owner policy-review gate; component F06 acceptance does not satisfy it.
## Mandatory tests

View file

@ -42,11 +42,13 @@ Parallel eligibility: only with disjoint actual files and reserved write locks;
- Changing template, strategy source or provider history after dataset freezing cannot alter an admitted run. A source query alone is not labelled a frozen dataset.
- No strategy decision executes before artifact verification and atomic dataset binding; failed preparation remains diagnosed and retry-safe.
- New results declare financialEngine=rust and strategyExecution separately; correctness-gate evidence requires approved engine/data gates, not a UI flag.
- Before making canonical multi-asset research the default, obtain explicit owner disposition of sequential equal-time mark risk: either accept the disclosed versioned approximation or approve a coordinated atomic-mark policy/implementation with independent fixtures. F04/F05 currently evaluate each ordered mark; F06 demonstrates offsetting simultaneous moves can latch intermediate loss/drawdown halts. A passing deterministic replay suite alone does not resolve this material modeling issue. Single-asset component work and additive native integration need not wait for this decision.
## Mandatory tests
- mutate_template_after_submit, freeze_before_first_decision, frozen_seed_replay, provider_change_after_dataset_bind.
- Full durable runner restart/lease/cancel suite and result contract compatibility.
- Multi-asset default activation rejects while the mark-policy disposition is absent; accepted policy/version/limitations are frozen in provenance, with offsetting-mark regression evidence.
Apply the relevant [quality gates](../../QUALITY-GATES.md); submit exact commands, outcomes and skipped checks. Named cases above are required regression scenarios, not claims that those tests already exist.