feat(research): add owner-aware ledger and intraday storage

Implement reviewed F02/D02: exact owner accounting, atomic funding checks, idempotent receipts and ledger checkpoints; connect existing EOD intraday storage through validated research admission without active financial-engine cutover.
This commit is contained in:
Boki 2026-10-22 21:16:53 -04:00
parent b4af840d4e
commit b65acccd91
15 changed files with 2704 additions and 104 deletions

View file

@ -1,6 +1,6 @@
# Canonical development backlog
**First five waves committed; ADR-002/003/004 approved; F01/D01 validated, uncommitted.** Consult manifest execution_scope, [ROADMAP](../ROADMAP.md), [skeptical review](../REVIEW.md) and [first-wave handoff](../FIRST-WAVE.md). F01/D01 await owner acceptance/commit; other tasks and unresolved policies remain gated.
**First six waves committed; F02/D02 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; F02/D02 await owner acceptance/commit, and other tasks/policies remain gated.
## One source of truth
@ -29,8 +29,8 @@ Relative size: S narrow correction, M coherent boundary, L sensitive owner-contr
| Task | Priority / status | Implementation prerequisites | Release gate | Specialist / size |
| --- | --- | --- | --- | --- |
| [F01 Define the minimal financial contract and economic fixtures](tasks/F01.md) | P0 / review | ADR-002, ADR-003, ADR-004 (approved) | — | Rust financial contract owner / M |
| [F02 Implement one owner-aware financial ledger](tasks/F02.md) | P0 / blocked | F01, ADR-002 | — | Rust accounting / L |
| [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 / review | 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 / blocked | F02, ADR-002, ADR-003 | — | Rust financial risk / L |
| [F05 Unify matching and order lifecycle on the ledger](tasks/F05.md) | P0 / blocked | F04, ADR-003 | F06 | Rust execution semantics / L |
@ -42,8 +42,8 @@ Relative size: S narrow correction, M coherent boundary, L sensitive owner-contr
| Task | Priority / status | Implementation prerequisites | Release gate | Specialist / size |
| --- | --- | --- | --- | --- |
| [D01 Introduce availability-aware dataset v2](tasks/D01.md) | P0 / review | ADR-003 (approved) | — | TypeScript trading infrastructure / M |
| [D02 Connect supported intraday storage to research datasets](tasks/D02.md) | P1 / blocked | D01 | — | TypeScript trading infrastructure / M |
| [D01 Introduce availability-aware dataset v2](tasks/D01.md) | P0 / done | ADR-003 (approved) | — | TypeScript trading infrastructure / M |
| [D02 Connect supported intraday storage to research datasets](tasks/D02.md) | P1 / review | D01 | — | TypeScript trading infrastructure / M |
| [D03 Add dataset eligibility and corporate-action safeguards](tasks/D03.md) | P1 / merged → D01 | None | — | TypeScript trading infrastructure / M |
| [D04 Provide prefix-safe shared feature calculation](tasks/D04.md) | P1 / deferred | S01, P01 | — | Quantitative feature engineering / M |

View file

@ -1,23 +1,24 @@
{
"schema_version": 1,
"plan_revision": "2026-10-22.16",
"plan_revision": "2026-10-22.18",
"repository_base": "b7aeca4",
"plan_status": "sixth_wave_validated_uncommitted",
"plan_status": "seventh_wave_validated_uncommitted",
"execution_authorized": true,
"execution_scope": {
"authorized_by": "User: yes (2026-10-22), explicitly approving ADR-002/003/004 as written and continuation with F01/D01",
"authorized_by": "User: commit and continue (2026-10-22); commit accepted F01/D01 and continue with the explicitly proposed F02/D02 pair",
"tasks": [
"F01",
"D01"
"F02",
"D02"
],
"permissions": [
"commit_validated_sixth_wave",
"isolated_implementation",
"local_tests",
"local_integration_review",
"planning_progress_updates"
],
"excluded": [
"sixth_wave_commits_without_further_approval",
"seventh_wave_commits_without_further_approval",
"push",
"pull_requests",
"live_or_paper_operations",
@ -319,7 +320,7 @@
"epic": "E2",
"priority": "P0",
"severity": "Critical",
"status": "review",
"status": "done",
"dependencies": [],
"decision_dependencies": [
"ADR-002",
@ -341,7 +342,7 @@
"assignment": "/root/wave6_f01",
"branch": "wave6/f01-financial-contract",
"pull_request": null,
"completed_commit": null,
"completed_commit": "b4af840d4edde84b23c099e85c82f43721046067",
"blocker": null,
"release_gates": [],
"worktree": "/tmp/stock-bot-wave6.uIuYHz/f01",
@ -356,10 +357,10 @@
"test/fixtures/economics/",
"test/integration/financial-contract.test.ts"
],
"integration_state": "validated_uncommitted",
"integration_state": "validated_committed",
"reviewed_by": "/root/wave6_review",
"verification_reference": "ROADMAP.md#sixth-wave-handoff--2026-10-22",
"review_notes": "Independently accepted, integrated, and combined gates passed. No commit authorized in this wave; awaiting owner acceptance/commit before scheduling dependents."
"review_notes": "Independently accepted and combined gates passed; owner authorized commit and continuation. Completed commit contains the integrated F01/D01 implementation."
},
{
"id": "F02",
@ -367,7 +368,7 @@
"epic": "E2",
"priority": "P0",
"severity": "Critical",
"status": "blocked",
"status": "review",
"dependencies": [
"F01"
],
@ -388,12 +389,24 @@
"rust-ledger"
],
"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/wave7_f02",
"branch": "wave7/f02-owned-ledger",
"pull_request": null,
"completed_commit": null,
"blocker": null,
"release_gates": []
"release_gates": [],
"worktree": "/tmp/stock-bot-wave7.UIkAQD/f02",
"integration_base": "b4af840d4edde84b23c099e85c82f43721046067",
"concrete_write_scope": [
"apps/stock/engine/src/financial/",
"apps/stock/engine/Cargo.toml",
"Cargo.lock",
"test/fixtures/economics/"
],
"review_notes": "Independently accepted, exact frozen files integrated, combined repository checks passed. Seventh-wave changes remain uncommitted pending owner acceptance/commit; no downstream task started.",
"integration_state": "validated_uncommitted",
"reviewed_by": "/root/wave7_review",
"verification_reference": "ROADMAP.md#seventh-wave-handoff--2026-10-22"
},
{
"id": "F03",
@ -595,7 +608,7 @@
"epic": "E3",
"priority": "P0",
"severity": "Critical",
"status": "review",
"status": "done",
"dependencies": [],
"decision_dependencies": [
"ADR-003"
@ -615,7 +628,7 @@
"assignment": "/root/wave6_d01",
"branch": "wave6/d01-dataset-v2",
"pull_request": null,
"completed_commit": null,
"completed_commit": "b4af840d4edde84b23c099e85c82f43721046067",
"blocker": null,
"release_gates": [],
"worktree": "/tmp/stock-bot-wave6.uIuYHz/d01",
@ -628,10 +641,10 @@
"test/integration/historical-dataset-v2.test.ts",
"test/fixtures/historical-v2/"
],
"integration_state": "validated_uncommitted",
"integration_state": "validated_committed",
"reviewed_by": "/root/wave6_review",
"verification_reference": "ROADMAP.md#sixth-wave-handoff--2026-10-22",
"review_notes": "Independently accepted, integrated, and combined gates passed. No commit authorized in this wave; awaiting owner acceptance/commit before scheduling dependents."
"review_notes": "Independently accepted and combined gates passed; owner authorized commit and continuation. Completed commit contains the integrated F01/D01 implementation."
},
{
"id": "D02",
@ -639,7 +652,7 @@
"epic": "E3",
"priority": "P1",
"severity": "High",
"status": "blocked",
"status": "review",
"dependencies": [
"D01"
],
@ -654,12 +667,24 @@
"storage-adapters"
],
"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/wave7_d02",
"branch": "wave7/d02-intraday-storage",
"pull_request": null,
"completed_commit": null,
"blocker": null,
"release_gates": []
"release_gates": [],
"worktree": "/tmp/stock-bot-wave7.UIkAQD/d02",
"integration_base": "b4af840d4edde84b23c099e85c82f43721046067",
"concrete_write_scope": [
"apps/stock/orchestrator/src/services/StorageService.ts",
"apps/stock/orchestrator/src/data/",
"test/integration/intraday-storage.test.ts",
"test/fixtures/intraday/"
],
"review_notes": "Independently accepted, exact frozen files integrated, combined repository checks passed. Seventh-wave changes remain uncommitted pending owner acceptance/commit; no downstream task started.",
"integration_state": "validated_uncommitted",
"reviewed_by": "/root/wave7_review",
"verification_reference": "ROADMAP.md#seventh-wave-handoff--2026-10-22"
},
{
"id": "D03",
@ -2785,6 +2810,211 @@
"Existing Rust/frontend build warnings remain."
],
"cleanup": "Only verified stale sandbox check/test/worker processes were stopped after the successful escalated run; root session13178 exited143 and author session45451 exited143. No user services, databases, containers or files were removed. Worktrees/logs remain available.",
"handoff": "F01/D01 remain review/validated_uncommitted; F02/D02 await accepted integration and further execution authorization. No sixth-wave commit, push, PR, trading operation or other task started."
"handoff": "F01/D01 were independently accepted and subsequently committed at owner request as b4af840d4edde84b23c099e85c82f43721046067. The same request authorized F02/D02 continuation; no push, PR or trading operation."
},
"seventh_wave": [
"F02",
"D02"
],
"seventh_wave_base": "b4af840d4edde84b23c099e85c82f43721046067",
"seventh_wave_notes": [
"User authorized committing validated F01/D01 and continuing with the proposed F02/D02 pair; no additional ADR approval.",
"F02 owns financial modules/dependencies and economic fixtures. D02 owns StorageService, narrow data helpers, new intraday tests/fixtures; no shared DTO/index/ingestion source change without coordination.",
"One financial owner, one data owner and an independent read-only reviewer. Root owns planning and integration.",
"No active engine/paper/SQL cutover, native session API or unrelated task. Independent review and combined gates passed; awaiting owner acceptance/commit."
],
"seventh_wave_validation": {
"result": "passed",
"reviewer": "/root/wave7_review",
"base": "b4af840d4edde84b23c099e85c82f43721046067",
"repository_check": {
"command": "CARGO_BUILD_JOBS=2 bun run check",
"log": "/tmp/stock-bot-wave7.UIkAQD/check.log",
"tooling_tests": 60,
"utility_tests": 43,
"calculation_tests": 35,
"integration_tests": 342,
"rust_tests": 59,
"manual_rust_measurement_ignored_by_default": 1,
"failed": 0,
"note": "Escalated native build/worker execution; full build/typecheck/contracts/lint/secret audit passed."
},
"independent_review": {
"financial": "22 financial Rust tests passed;1manualmeasurement ignored;37unrelated tests filtered. All7 frozen hashes matched.",
"intraday": "36 intraday/ingestion/dataset tests passed;264assertions;3 frozen hashes and private rebuilt addon matched. These tests overlap repository totals."
},
"scoped_checks": [
"Standalone strict TypeScript with experimentalDecorators traversing the real ingestion import graph passed.",
"Explicit ESLint and Prettier on all3 D02 files passed.",
"Scoped rustfmt --check on financial modules and git diff --check passed."
],
"source_hashes": {
"Cargo.lock": "8f2ecaa4f1790f14e1650326f78fbf246f454dad6139dc4cb0d61383b9e301e8",
"apps/stock/engine/Cargo.toml": "f7eb29311a0ca2a943607f722ad4fa447857bdf951a8f8d9fa30dab9095a7525",
"apps/stock/engine/src/financial/contract.rs": "06d57c12d33c4f128482544cda31347e4c640f879998dc17f0da379c3f37f9db",
"apps/stock/engine/src/financial/mod.rs": "36645e77811740de41c017dbff6193715009da708f9377d17510dd738fdefdba",
"apps/stock/engine/src/financial/scalar.rs": "65da81ecf33db78935f50aeb53094293e9d4b0814ac25e0d0c281b53b75c5e06",
"apps/stock/engine/src/financial/ledger.rs": "b9016744e76256de4af080a5eba0e635e900b3fc6cb21caee581d88519e7a707",
"apps/stock/engine/src/financial/ledger_tests.rs": "96b5f40ff4cbeeaedc09d824effc1b35888c7d30bfae850e426b48f1d0d7ab05",
"apps/stock/orchestrator/src/services/StorageService.ts": "b06b67fd1d7e29e26d6c9c4f241169f88c18c355395c0e1b9de5813012c45458",
"test/integration/intraday-storage.test.ts": "9c209620097ada21d4a47fab5092f8e3308474708ef7db2422be6daaf3eebe3e",
"test/fixtures/intraday/eod.ts": "bdb9df09718a723736d88ba62ca57dbf842cfdafdb7a6ca2a279a97a20894d45"
},
"native_artifact": {
"path": "apps/stock/engine/dist/engine.node",
"sha256": "b8e272e5846bf8efe37f9f941920f489d012f1bacb3d5675352d1d55a63e772c",
"d02_author_sha256": "48ab4c24e8f56c1fbc537982b54ba07d42dc4b0ecec2ce34ced5ecfd354ef0ae",
"note": "Addons independently built in their own worktrees; no shared/copied native artifact. Active native simulator remains legacy."
},
"financial_measurement": {
"command": "CARGO_BUILD_JOBS=2 cargo test -p engine --lib --release --offline ledger_transition_measurement -- --ignored --nocapture",
"log": "/tmp/stock-bot-wave7.UIkAQD/f02-measurement.log",
"artifact": "/tmp/stock-bot-wave7.UIkAQD/f02/target/release/deps/engine-abe56cbc3e15ae30",
"sha256": "b21531e5c3e97c2d09f827ffccfb89858ed88f04f3055c0d57e5a82255539424",
"host": {
"cpu": "AMD Ryzen 9 9950X3D",
"logical_cpus": 32,
"ram_bytes": 98683457536,
"os": "Linux6.8.0-146-generic x86_64",
"rustc": "1.88.0(6b00bc388),LLVM20.1.5",
"cargo_build_jobs": 2
},
"workload": "Prebuilt commands;80%buys(0.01@100,fee0.001),20%marks;initialcapital1m. Single1owner/1asset vs multi3owners/4assets.3repeats;no explicit warmup. Transition time includes receipts and returned-effect collection;checkpointcopy separate;restore excludes inputclone;serialization outside timed regions.",
"columns": [
"transition_ms",
"checkpoint_ms",
"restore_ms"
],
"rows": {
"1000_single": [
[
4.823,
0.576,
5.484
],
[
4.16,
0.286,
5.9
],
[
4.244,
0.387,
4.99
]
],
"1000_multi": [
[
4.685,
0.298,
5.415
],
[
4.807,
0.298,
5.585
],
[
4.763,
0.282,
5.778
]
],
"10000_single": [
[
47.394,
8.028,
59.606
],
[
44.356,
5.27,
60.23
],
[
44.07,
5.32,
54.266
]
],
"10000_multi": [
[
50.48,
5.235,
62.177
],
[
51.257,
5.547,
65.779
],
[
51.003,
5.662,
60.142
]
]
},
"repeatability": "Full state+effect serialized bytes equal across repeats; DefaultHasher checksums are fixed-artifact diagnostics, not cryptographic provenance.",
"state_and_effect_bytes": {
"1000_single": 1294915,
"1000_multi": 1292139,
"10000_single": 13093921,
"10000_multi": 13050658
},
"limitations": "Scoped ledger sanity workload; no cold dataset/native startup/IPC/storage measurements, end-to-end throughput, legacy speedup or independent performance certification. Receipt history memory and restore work grow linearly; no compaction.",
"integration_recheck": {
"command": "CARGO_BUILD_JOBS=2 cargo test -p engine --lib --release --offline ledger_transition_measurement -- --ignored --nocapture",
"log": "/tmp/stock-bot-wave7.UIkAQD/integration-ledger-measurement.log",
"artifact": "target/release/deps/engine-abe56cbc3e15ae30",
"sha256": "b21531e5c3e97c2d09f827ffccfb89858ed88f04f3055c0d57e5a82255539424",
"result": "1passed,0failed;59filtered. Same state/effect checksums and full byte equality across repetitions.",
"raw_rows": [
"F02 count=1000 multi=false repeat=0 transition_ms=4.819 checkpoint_ms=0.810 restore_ms=5.722 bytes=1294915 checksum=446ce8be40fd4ba1",
"F02 count=1000 multi=false repeat=1 transition_ms=4.131 checkpoint_ms=0.304 restore_ms=5.615 bytes=1294915 checksum=446ce8be40fd4ba1",
"F02 count=1000 multi=false repeat=2 transition_ms=4.203 checkpoint_ms=0.286 restore_ms=4.858 bytes=1294915 checksum=446ce8be40fd4ba1",
"F02 count=1000 multi=true repeat=0 transition_ms=4.712 checkpoint_ms=0.329 restore_ms=5.562 bytes=1292139 checksum=a1df70fcbb707e69",
"F02 count=1000 multi=true repeat=1 transition_ms=4.759 checkpoint_ms=0.288 restore_ms=5.947 bytes=1292139 checksum=a1df70fcbb707e69",
"F02 count=1000 multi=true repeat=2 transition_ms=4.733 checkpoint_ms=0.295 restore_ms=5.511 bytes=1292139 checksum=a1df70fcbb707e69",
"F02 count=10000 multi=false repeat=0 transition_ms=49.398 checkpoint_ms=8.299 restore_ms=58.845 bytes=13093921 checksum=0f92079aeb5beff5",
"F02 count=10000 multi=false repeat=1 transition_ms=42.911 checkpoint_ms=5.375 restore_ms=58.622 bytes=13093921 checksum=0f92079aeb5beff5",
"F02 count=10000 multi=false repeat=2 transition_ms=43.119 checkpoint_ms=5.354 restore_ms=53.319 bytes=13093921 checksum=0f92079aeb5beff5",
"F02 count=10000 multi=true repeat=0 transition_ms=50.560 checkpoint_ms=5.266 restore_ms=61.046 bytes=13050658 checksum=36dcaa5fd201208a",
"F02 count=10000 multi=true repeat=1 transition_ms=49.624 checkpoint_ms=5.318 restore_ms=63.990 bytes=13050658 checksum=36dcaa5fd201208a",
"F02 count=10000 multi=true repeat=2 transition_ms=50.276 checkpoint_ms=5.395 restore_ms=59.666 bytes=13050658 checksum=36dcaa5fd201208a"
]
}
},
"intraday_measurement": {
"kind": "author exploratory adapter-only sanity measurement",
"host": "Same Ryzen9 9950X3D/Linux x64 host;Bun1.2.17/Nodecompat22.6.0",
"recipe": "Synthetic in-memory find() rows, start2024-03-11T13:30Z at300s spacing;FIXTURE.TEST,open100/high101/low99/close100/volume1000. Time only await getHistoricalBars(...,'5m'); construction/hash serialization excluded. Three repeats;no explicitwarmup.",
"milliseconds_1000": [
1.727282,
0.602739,
0.521505
],
"milliseconds_10000": [
6.232302,
5.555884,
4.477247
],
"normalized_hash_1000": "fb2d3f213487a7a2ff0ce4a6b98d74ba793b13355439b88c3eb1efb296339158",
"normalized_hash_10000": "18138da32c3758770703c7376ef05f8c1aae941cb7884bda3c2e628fb6fdabe4",
"limits": "Identical normalized hashes across3repeats per size. No Mongo/network/real-range throughput, baseline speedup or release performance claim; no new benchmark framework."
},
"not_run": [
"PostgreSQL/Redis fixture suite and Chromium E2E not rerun: persistent execution/API/UI boundaries unchanged.",
"No real Mongo server/provider network test; D02 replaces HTTP/Mongo transport and executes real ingestion/storage/dataset/native code."
],
"limitations": [
"F02 remains additive/unwired to active engines. No F04 reservations/portfolio risk, F05 matching, F06 availability/replay, NAPI sessions, SQL/paper cutover or full order/strategy/RNG restore.",
"Ledger checkpoints validate consistency by retained-history replay, not input authenticity; restore/memory scale with receipt history. No compaction or full financial-session snapshot.",
"D02 real ingestion fixture covers5m;1m/1h routing is checked. Provider selector remains StorageService-only; existing loadDataset/UI use auto priority. Connectivity is not range coverage.",
"Provider timestamps/prices checked against https://eodhd.com/financial-apis/intraday-historical-data-api on2026-10-22. Delayed finalization/corrections mean bar-close availability is only an explicit simulation assumption, not observed publication time.",
"Initial isolated D02 builds needed existing logger/config dependencies; native sandbox attempt timed out. Escalated tests and independent rerun passed unchanged. Existing build warnings remain."
],
"cleanup": "Only D02 stale test980112/worker980619 were terminated after exact PID/cwd checks; original session exited143 and process absence verified. No development services, databases or data touched. Worktrees/logs retained.",
"handoff": "F01/D01 committedb4af840 at owner request. F02/D02 independently accepted and validated_uncommitted, awaiting owner acceptance/commit. F04 is next prerequisite-dependent task; other ADR approvals unchanged. No push/PR/trading operation or extra task."
}
}

View file

@ -14,6 +14,16 @@ Trace the actual intraday collection/schema, add the smallest provider adapter o
Measurable benefit: Makes supported intraday requests usable and honest.
### Verified ingestion evidence and seventh-wave boundary
Before implementation, inspected `apps/stock/data-ingestion/src/handlers/eod/actions/intraday.ts`: `fetchIntraday` looks up the listing, uses `eodExchange || Exchange`, copies provider Unix-second `timestamp`, `datetime`, `gmtoffset` and OHLCV, then upserts `eodIntraday1M`, `eodIntraday5M` or `eodIntraday1H` keyed by timestamp + `eodSearchCode` (lines 486–585 at base `b4af840`). The research reader currently chooses QuestDB first, otherwise only daily `eodPrices`.
Retain the common `getHistoricalBars` admission path. Add the existing EOD intraday mapping, explicit provider selection/capabilities and typed unavailable/unsupported errors. Capabilities describe connected stores and supported intervals, not proven range coverage. Preserve default QuestDB priority and never switch provider on an empty range/error. Explicit provider requests never fall back to daily or synthetic data. Validate whole Unix seconds and listing identity; Unix timestamps are already UTC and must not be shifted by `gmtoffset`. QM's adjusted/unpinned interval records remain unsupported.
Tests invoke the actual EOD writer with replaced HTTP/Mongo transport, then the real storage reader and v1/v2 dataset normalizers with explicit retained calendar/action metadata. This proves adapter composition, not database-server conformance or F06 replay. No optional v2 loader, active-runtime cutover or storage migration is required here.
Provider check (2026-10-22): [EODHD's intraday documentation](https://eodhd.com/financial-apis/intraday-historical-data-api) identifies the timestamp as UTC bar start and prices as unadjusted for subsequent corporate actions. It also describes delayed finalization after market close and possible historical corrections. Retrieval therefore does **not** establish point-in-time publication availability. Interval-end availability remains an explicit simulation assumption, never provider evidence; frozen content hashes retain the actual retrieved revision. Provider choice is initially a storage API parameter, not a new web/run-configuration control.
## Exclusions
No unrelated refactor, new service or broker activation.

View file

@ -15,6 +15,16 @@ Scheduling source of truth: [manifest entry F02](../manifest.json). No task is a
Implement one owner-keyed ledger from its first version; absorb F03 rather than building aggregate cost basis and replacing it later. Adapt existing Rust position calculations. Store owned quantity and remaining cost amount; derive average price and account aggregates. For a partial disposal, round the proportional released basis at posting precision; final disposal releases the exact residual. Fees are separate postings. Use one internal apply(state,command) kernel for resident research and staged durable transactions.
### Seventh-wave implementation boundary
F01 is committed in `b4af840`. Keep this ledger additive: no replacement of active legacy position/accounting code, native binding, SQL transaction integration or paper migration. ADR-005 remains unapproved; F02 provides the in-memory transition/checkpoint seam, not its durable adapter.
- A ledger checkpoint is distinct from F01's economic projection. It retains genesis, books including closed-position realized P&L, cash/fees, marks, risk-session identity, revision and ordered accepted receipts/aliases. Restore verifies by replay and canonical state comparison. It is not an order/replay/strategy/RNG session snapshot.
- Exact multiplication and proportional release use maintained arithmetic with a single final half-away posting boundary, not precision-losing decimal intermediates. Account valuation sums owner-level marked postings; missing marks reject valuation instead of inventing zero or cost-based prices.
- Invalid commands fail atomically without changing balances, books, marks or receipts. Basic cash funding includes fees. Reservation and portfolio risk policies remain F04, including recording accepted risk-rejection outcomes.
- Identical command retry returns its original receipt even after later transitions. Identical fill under a new command ID aliases that receipt, explicitly marked replayed: compare event time and the entire canonical fill body, excluding only command ID. Different fill content or reuse of a fee ID by another fill rejects. Never emit duplicate economic deltas.
- Normal transitions stage only affected state; checkpoint serialization/replay is explicit. Record repeatable scoped transition and checkpoint/restore measurements without claiming end-to-end research throughput.
## Exclusions
No unrelated refactor, new service, broker enablement, or silent reinterpretation of historical results.