feat(execution): preserve durable recovery on canonical Rust core
This commit is contained in:
parent
5e9655de0b
commit
c01e96e4dd
27 changed files with 3644 additions and 182 deletions
|
|
@ -410,6 +410,18 @@ S03 is the next highest-priority code/ADR-ready task. [Its pinned execution cont
|
|||
|
||||
Preserve existing row locks, journal context, idempotency and rollback behavior. Canonical next-event timing and immutable policy differ explicitly from legacy execution; refuse implicit account conversion. Retain failed native prefixes atomically as terminal, and keep notification delivery separate from financial commit. No performance work, default switch, paper feed activation or other pending ADR approval is included. S04 owns feed readiness; R01/R11 still require ADR-006.
|
||||
|
||||
**Validated handoff:** S03 is `review` / `validated_uncommitted`. Twenty-two source/test files are integrated with recorded hashes and independent G1/G2 signoff. `stageFinancialTransaction` restores private state and applies the existing Rust matcher. Its ordered financial views are reconstructed through the same risk reducer and checked against the authoritative result. Replayed commands return their original outcome with the current checkpoint and no new effect journal.
|
||||
|
||||
The canonical host uses the existing PostgreSQL account row lock. It commits all due owners' state/RNG/checkpoints and one complete batch intent together, then dispatches the batch in a separate transaction. Native snapshots, per-effect views, journals, input status and admission feedback commit atomically. Mixed-cadence owners retain their unconsumed observations. The shared decision helper preserves S01 research behavior. One additive migration stores complete canonical batches; legacy accounts explicitly refuse canonical envelopes and retain their existing execution path.
|
||||
|
||||
Coverage includes competing hosts, SQL rollback, lost acknowledgements, frozen callback inputs, all four time-in-force policies, risk reservations, stale quotes, exact quote-cursor decisions, and terminal failures during both admission and execution. A real SMA program matches uninterrupted state and journals after repeated replacement. Four separate-process kill cases cover decision staging, checkpoint commit, admission commit and fill/fee commit; recovery matches uninterrupted execution exactly.
|
||||
|
||||
`CARGO_BUILD_JOBS=2 bun run check` passed build/types/contracts/audit/lint plus **82 tooling, 43 utility, 44 calculation, 432 integration and 150 Rust tests**. Four existing manual Rust measurements remain ignored. The complete disposable PostgreSQL/Redis suite passed **81 tests / 545 assertions**. Extra strict TypeScript exposed only test fixture typing issues; these were corrected without changing application behavior, then strict test compilation, scoped format/lint and **38 targeted tests / 281 assertions** passed. Browser/Python boundaries were unchanged and their suites were not rerun. No profiling, optimization or benchmark run occurred.
|
||||
|
||||
The native addon was built and verified against this checkout's debug library for the full gates, then rebuilt in release mode. Another **38 tests / 366 assertions** passed against the final release addon; no timing measurements were performed. Source archives, exact commands/hashes and logs are recorded in `manifest.json` → `sixteenth_wave_validation` and `/tmp/stock-bot-wave16.kgaZm4/`. Only the two exact disposable test containers were stopped; development services, worktrees and logs were retained.
|
||||
|
||||
Limits remain explicit: trusted SQL custody, new canonical account IDs, execution-series observations only, immutable declared program metadata rather than retained code artifacts, and invalid queued inputs that fail closed until diagnosed. Rust validates opaque financial receipts before each financial transition; startup alone is not a full receipt audit. **Next after acceptance/commit: S04**, feed scheduling, auxiliary observation manifests and operator readiness. S05 is independently code/ADR-ready; R01/R11 still require ADR-006. S03 does not activate paper/live execution or switch existing web/research defaults. No S03 commit, push or PR was created.
|
||||
|
||||
## Deferred and rejected
|
||||
|
||||
Conditional: shared feature cache D04; cross-trial resident datasets P03; large-detail pagination/storage P05; tiny DSL P06; expanded cross-service monitoring O02. Each has a measured/real-need trigger and is not a prerequisite for scheduled work.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Canonical development backlog
|
||||
|
||||
**First fifteen waves committed; S03 is in progress.** S02 is accepted as `ca5abdd`. The owner deferred performance work; P08 is on hold. S03 preserves durable execution/recovery while adopting the canonical Rust kernel. Consult manifest execution_scope and [current wave](../ROADMAP.md#sixteenth-wave-execution--2026-10-23). ADR-002/003/004/005 are approved; other policies/default cutovers remain gated.
|
||||
**First fifteen waves committed; S03 is validated for review.** S02 is accepted as `ca5abdd`. The owner deferred performance work; P08 is on hold. S03 preserves durable execution/recovery on the canonical Rust kernel, with full repository and disposable-database checks passing. Its changes remain uncommitted. Consult manifest execution_scope and [current wave](../ROADMAP.md#sixteenth-wave-execution--2026-10-23). ADR-002/003/004/005 are approved; other policies/default cutovers remain gated.
|
||||
|
||||
## One source of truth
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ Relative size: S narrow correction, M coherent boundary, L sensitive owner-contr
|
|||
| --- | --- | --- | --- | --- |
|
||||
| [S01 Run deterministic TypeScript decisions on Rust sessions](tasks/S01.md) | P0 / done | F07, ADR-004, ADR-005 | — | TypeScript trading infrastructure / M |
|
||||
| [S02 Adapt one SMA strategy for the first canonical path](tasks/S02.md) | P1 / done | S01 | — | TypeScript strategy/quant engineering / M |
|
||||
| [S03 Adapt durable paper transactions to Rust financial reducers](tasks/S03.md) | P0 / in_progress | S01, C06, ADR-005 | — | Durable execution/Rust integration / L |
|
||||
| [S03 Adapt durable paper transactions to Rust financial reducers](tasks/S03.md) | P0 / review | S01, C06, ADR-005 | — | Durable execution/Rust integration / L |
|
||||
| [S04 Establish a verified paper feed and operator safety gate](tasks/S04.md) | P1 / blocked | S02, S03 | — | TypeScript trading infrastructure / M |
|
||||
| [S05 Add a small composable multi-signal regime example](tasks/S05.md) | P2 / ready | S02, F08 | R08 | Quant strategy research / M |
|
||||
| [S06 Retire duplicate simulator paths after cutover proof](tasks/S06.md) | P2 / blocked | S03, S04, R05 | — | TypeScript trading infrastructure / M |
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"schema_version": 1,
|
||||
"plan_revision": "2026-10-23.35",
|
||||
"plan_revision": "2026-10-23.36",
|
||||
"repository_base": "b7aeca4",
|
||||
"plan_status": "sixteenth_wave_in_progress",
|
||||
"plan_status": "sixteenth_wave_validated",
|
||||
"execution_authorized": true,
|
||||
"execution_scope": {
|
||||
"authorized_by": "User: commit and continue, then stop performance work for now and continue remaining backlog (2026-10-23). S02 accepted and committed ca5abdd. S03 is the highest-priority ready non-performance task under approved ADR-005.",
|
||||
|
|
@ -1037,7 +1037,7 @@
|
|||
"epic": "E4",
|
||||
"priority": "P0",
|
||||
"severity": "Critical",
|
||||
"status": "in_progress",
|
||||
"status": "review",
|
||||
"dependencies": [
|
||||
"S01",
|
||||
"C06"
|
||||
|
|
@ -1066,7 +1066,7 @@
|
|||
"release_gates": [],
|
||||
"worktree": "/tmp/stock-bot-wave16.kgaZm4/durable",
|
||||
"integration_base": "ca5abdde0e131ef4ec8c60ff9a4de4e277fc0820",
|
||||
"integration_state": "isolated_implementation",
|
||||
"integration_state": "validated_uncommitted",
|
||||
"implementation_slices": [
|
||||
{
|
||||
"owner": "/root/s03_native",
|
||||
|
|
@ -1080,7 +1080,10 @@
|
|||
"branch": "wave16/s03-durable",
|
||||
"scope": "Versioned SQL custody, shared S01 decision staging, actual canonical strategy/RNG/pending-prefix recovery, one durable owner-batch outbox, migration and failure tests."
|
||||
}
|
||||
]
|
||||
],
|
||||
"reviewed_by": "/root/s03_review",
|
||||
"verification_reference": "ROADMAP.md#sixteenth-wave-execution--2026-10-23",
|
||||
"review_notes": "Integrated canonical native staging and SQL custody with actual strategy/RNG/mixed-cadence recovery. Independent G1/G2 review, full repository checks, full disposable PostgreSQL/Redis suites, strict test types and final targeted/release tests passed. Source remains uncommitted. No default, feed, paper/live activation or performance work."
|
||||
},
|
||||
{
|
||||
"id": "S04",
|
||||
|
|
@ -5894,6 +5897,166 @@
|
|||
"S03 reuses Rust financial semantics and existing SQL transaction/row-lock/journal guarantees. Native and durable owners have isolated worktrees; review is independent.",
|
||||
"Versioned new canonical accounts only. No implicit legacy migration, current service/default switch, operator reset, broker execution or paper feed activation.",
|
||||
"Native Failed outcomes with committed-prefix effects persist as terminal before surfacing error; SQL failure discards private state. Duplicate outcomes emit no duplicate effects.",
|
||||
"Persist all-owner checkpoint/intent batches and mixed-cadence observation prefixes; reuse S01 staging without changing its public research recovery semantics or inventing a paper dataset hash."
|
||||
]
|
||||
"Persist all-owner checkpoint/intent batches and mixed-cadence observation prefixes; reuse S01 staging without changing its public research recovery semantics or inventing a paper dataset hash.",
|
||||
"S03 is validated for review, with 22 integrated source/test files. Root added actual process-kill cases at decision/checkpoint/admission/fill boundaries.",
|
||||
"Exact consumed-quote decisions and persisted identity/revision checks were corrected during review. Canonical Failed prefixes persist terminal before errors surface, including failed admission batches.",
|
||||
"Full repository and all 81 disposable-database tests passed. Strict test-only typing corrections preserve runtime assertions; final targeted tests and release-addon checks passed.",
|
||||
"After S03 acceptance/commit, S04 is the next non-performance task. S05 is independently code/ADR-ready; R01/R11 still require ADR-006. P08 remains deferred."
|
||||
],
|
||||
"sixteenth_wave_validation": {
|
||||
"state": "validated_uncommitted",
|
||||
"work_root": "/tmp/stock-bot-wave16.kgaZm4",
|
||||
"committed_before_implementation": {
|
||||
"S02": "ca5abdde0e131ef4ec8c60ff9a4de4e277fc0820",
|
||||
"planning": "5e9655de0bf367ec4c740e13796dd84eb39ae6f2"
|
||||
},
|
||||
"scope": [
|
||||
"Stateless native transaction adapter on existing MatchingAccount/RiskAccount",
|
||||
"Exact per-effect native financial views and original replay outcomes with current checkpoints",
|
||||
"Versioned canonical SQL custody and complete all-owner batch intents",
|
||||
"Shared S01 strategy staging with durable JSON/RNG/pending-observation recovery",
|
||||
"Explicit refusal between legacy and canonical account envelopes",
|
||||
"Additive canonical batch migration and failure/recovery tests"
|
||||
],
|
||||
"source_integration": {
|
||||
"files": 22,
|
||||
"exact_hashes": {
|
||||
"apps/stock/engine/index.mjs": "cc9e8206880590baae8a988005f9bfb1b92e7dfe689ca47b81e89f2ca28ca7a3",
|
||||
"apps/stock/engine/src/api/mod.rs": "b04df31c1a67e88c2533579903267425e048b0ffc134727a7f80c8e79fe19f01",
|
||||
"apps/stock/engine/src/api/paper.rs": "1352a493eaa7684c06455f76a83d87e66463e3a400e33ea107f7b4a816f9766e",
|
||||
"apps/stock/engine/src/api/paper/tests.rs": "03e0e935467e7aec2d1b9cb309c35a907a25ad63bdaf660cdc9e304128e47b7e",
|
||||
"apps/stock/engine/src/financial/mod.rs": "66bc1a0d2455a345c4b796742ed188f85a79c04e660cce84121ae432008d205d",
|
||||
"apps/stock/orchestrator/src/backtest/strategy-runtime.ts": "d72cc4749847d2506d6808be364f16b465896063c04cb5434e6c1d412c96dc8a",
|
||||
"apps/stock/orchestrator/src/contracts/canonical-execution.ts": "9af274b41e8c3179d18776e249c8af1914dbb8091b63a38bc5871a4c5da7dfed",
|
||||
"apps/stock/orchestrator/src/contracts/native-replay.ts": "3fc0aac64767355121e232fd71be12c80327cb49b2f2496c92c41e622a3d7f0a",
|
||||
"apps/stock/orchestrator/src/execution/CanonicalPaperExecution.ts": "216f447a8922ebd328a0416aa76dfe2af0d4b22efb798a3b0b418152e8b28fe2",
|
||||
"apps/stock/orchestrator/src/execution/PostgresCanonicalExecutionRepository.ts": "f1b43a971325fc91c8857d4c0ede35a40acacce0d354ab4907cac67ecb0a55fe",
|
||||
"apps/stock/orchestrator/src/execution/PostgresExecutionRepository.ts": "992fdca2454ecf098c76ed97c8d444817ff0b939f0918b68aedeb2a6e44774d8",
|
||||
"apps/stock/orchestrator/src/execution/canonical-paper.ts": "252bb14103024ad364432ddd33792b188105989389194e0052cd9f0a5dcef7f4",
|
||||
"apps/stock/orchestrator/src/strategies/strategy-decision.ts": "a5c78e95447daa45d7f5fc8f5e2ab9ae1f8aa27eec5a0dd5460f8d0d4ac56b8f",
|
||||
"apps/stock/web-api/src/migrations/migration-runner.ts": "7d3fcdac4ce5f6dd14b20cf143f2c49f4a87a9401c564185b0bc9a5e5b3a3ff2",
|
||||
"database/postgres/init/15-canonical-paper-intents.sql": "5e4cd7b03f5194c4cd1a4d198f5dbfdbc4d7b7985ae30f848a34f4b929795bda",
|
||||
"scripts/test/architecture.test.ts": "edb5524f14c2cba29d3001ad53d26a43be4f0670c1b7f679d94922840b05707c",
|
||||
"scripts/test/native-bindings.test.ts": "af6a6fa3eb252d48d9cefb6e6d4fd9e87fccfd6f0075314835f6c7814f1ecf50",
|
||||
"test/fixtures/canonical-paper-crash-owner.ts": "e46478ffea29ef19ccd172dfcd2dfc736048ccc71e5822f9b957052fe5b037fb",
|
||||
"test/fixtures/canonical-paper.ts": "b627d3e7750b60670811d262796a2cb2fd072cf2d9cf10e2cb0572b633cd55a5",
|
||||
"test/postgres/canonical-paper-crash.test.ts": "6cef77f13032d4fa91e70d6ae0f548dd88cb9aef7a1b7d3f6aae9741ac97641d",
|
||||
"test/postgres/canonical-paper.test.ts": "89896f1e9635e491f4070e74be6dccb4424418ace5b1aa945093798050beab8e",
|
||||
"test/postgres/migration-runner.test.ts": "7b572cfca9914c85429ed7b6b8ad624ff7c4f75e99f726f907778d3f646e3fe3"
|
||||
},
|
||||
"source_archive": "/tmp/stock-bot-wave16.kgaZm4/s03-integrated-source.tar",
|
||||
"source_archive_sha256": "7f63dd118a7a8aacae5c406d1722f3ec6aef606de74e6eb6e209fbf3b237943c",
|
||||
"native_archive_sha256": "b6bb48ece6625b115bf28d1688b4425620a85945320dfd4a695817d2fa974e23",
|
||||
"durable_archive_sha256": "48ac2501fea24d609db11710871855ea22ec4c75a61c8bdc136ff9a426c93ecb",
|
||||
"test_overlays": {
|
||||
"native": "77f1efcbb17f0e2b9efda92cf203c98bc78a69f5d6f872aeb6a57fbfb8d44cfc",
|
||||
"durable": "38334e9cd25f4700654271bbad58f8b3867c7843db6f76b489c8e63535680b89"
|
||||
},
|
||||
"note": "Production source matches independently reviewed frozen slices. Root adds four-boundary crash tests; final test-only corrections use branded decimals, discriminator narrowing, correct fixture username and explicit migration logger. No application change followed full repository validation."
|
||||
},
|
||||
"review": {
|
||||
"reviewer": "/root/s03_review",
|
||||
"result": "G1/G2 accepted; final test-only delta reviewed with no signoff regression",
|
||||
"findings_resolved": [
|
||||
"Allow exact consumed Quote Execution key without same-quote fills",
|
||||
"Validate persisted envelope/context identity and revisions before callback",
|
||||
"Commit native failed execution/admission prefixes before surfacing errors",
|
||||
"Retain slow-owner observation prefixes and immutable callback context",
|
||||
"Test all four actual process-kill boundaries including committed fill and fee"
|
||||
]
|
||||
},
|
||||
"checks": [
|
||||
{
|
||||
"command": "CARGO_BUILD_JOBS=2 bun run check",
|
||||
"result": "passed",
|
||||
"counts": {
|
||||
"tooling": 82,
|
||||
"utilities": 43,
|
||||
"calculations": 44,
|
||||
"integration": 432,
|
||||
"rust": 150,
|
||||
"rust_manual_ignored": 4
|
||||
},
|
||||
"log": "/tmp/stock-bot-wave16.kgaZm4/integration-check.log"
|
||||
},
|
||||
{
|
||||
"command": "PIPELINE_TEST_DATABASE_URL=postgres://fixture:fixture@127.0.0.1:32816/stock_bot_safety BACKTEST_TEST_REDIS_URL=redis://127.0.0.1:32815/15 bun run test:postgres",
|
||||
"result": "passed",
|
||||
"tests": 81,
|
||||
"assertions": 545,
|
||||
"log": "/tmp/stock-bot-wave16.kgaZm4/integration-postgres.log"
|
||||
},
|
||||
{
|
||||
"command": "bunx --no-install tsc --project /tmp/stock-bot-wave16.kgaZm4/tsconfig.s03-tests.json --noEmit",
|
||||
"result": "passed",
|
||||
"log": "/tmp/stock-bot-wave16.kgaZm4/integration-test-types-final.log"
|
||||
},
|
||||
{
|
||||
"command": "Scoped Prettier --check and ESLint --no-ignore --max-warnings 0 over integrated TypeScript except the existing architecture test; full architecture tests pass through bun run check. git diff --check.",
|
||||
"result": "passed",
|
||||
"log": "/tmp/stock-bot-wave16.kgaZm4/integration-format-lint.log"
|
||||
},
|
||||
{
|
||||
"command": "PIPELINE_TEST_DATABASE_URL=postgres://fixture:fixture@127.0.0.1:32816/stock_bot_safety bun test test/postgres/canonical-paper.test.ts test/postgres/canonical-paper-crash.test.ts test/postgres/migration-runner.test.ts scripts/test/native-bindings.test.ts",
|
||||
"result": "passed after test-only typing corrections",
|
||||
"tests": 38,
|
||||
"assertions": 281,
|
||||
"log": "/tmp/stock-bot-wave16.kgaZm4/integration-final-focused.log"
|
||||
},
|
||||
{
|
||||
"command": "CARGO_BUILD_JOBS=2 bun run --cwd apps/stock/engine build:release",
|
||||
"result": "passed; final addon matches local target/release/libengine.so",
|
||||
"log": "/tmp/stock-bot-wave16.kgaZm4/integration-release-build.log"
|
||||
},
|
||||
{
|
||||
"command": "bun test scripts/test/native-bindings.test.ts test/integration/strategy-runtime.test.ts test/integration/canonical-sma.test.ts",
|
||||
"result": "passed against final release addon",
|
||||
"tests": 38,
|
||||
"assertions": 366,
|
||||
"log": "/tmp/stock-bot-wave16.kgaZm4/integration-release-focused.log"
|
||||
}
|
||||
],
|
||||
"native": {
|
||||
"debug_sha256": "75e33ffdd1e2738537879e62243a9d8f63665864835a58c46087bb4b78f274ff",
|
||||
"final_profile": "release",
|
||||
"final_addon_sha256": "ef00eed556f5c32332d36a9a00ef710682e90deb00b54552e4b5c8bfdfbe8103",
|
||||
"local_library_matches": true,
|
||||
"performance_measurements": false
|
||||
},
|
||||
"economic_and_recovery_evidence": [
|
||||
"Direct Rust command tape equals staged persisted checkpoints and ordered effects",
|
||||
"Same-revision owner batches reconcile shared cash reservations, owner fills and fees",
|
||||
"Restart and four hard-kill boundaries match uninterrupted complete snapshots/journals",
|
||||
"Actual canonical SMA buy and sell executions preserve checkpoint/journal parity after replacement",
|
||||
"Failed admission batch and failed execution prefix are terminal, committed exactly once, and refuse restart mutation",
|
||||
"DAY/GTC/IOC/FOK, stale quote rejection, cancellation, explicit daily risk rollover and reducing risk orders survive restart",
|
||||
"Old command and quote aliases retain current financial state without duplicate observations/effects"
|
||||
],
|
||||
"environment_notes": [
|
||||
"Initial NAPI sandbox EPERM required escalation; one native-owner approval wait was interrupted and root took over isolated builds.",
|
||||
"Restricted database connections failed; authorized disposable-fixture tests passed outside sandbox.",
|
||||
"Three initial PostgreSQL fixture expectations were corrected to existing native semantics: only supported quote events alias, stale marks reject orders requiring readmission, all owners have fee entries including zero.",
|
||||
"Extra strict test compilation found test-only decimal branding/narrowing/config errors and an existing incomplete migration test container; corrections preserve production behavior.",
|
||||
"Browser E2E and Python analytics were not rerun because those boundaries were unchanged.",
|
||||
"No profiling, optimization, benchmark measurements, default cutover, trading operations, push or PR."
|
||||
],
|
||||
"limitations": [
|
||||
"Only explicitly initialized new canonical accounts; incompatible legacy snapshots/config changes refuse conversion.",
|
||||
"Trusted SQL custody: outer metadata checked on reads; opaque native receipts replay-validated before each financial transition, not fully audited by initialization alone.",
|
||||
"Only configured execution-series observations; S04 owns auxiliary observation/cadence manifests, real feed alignment and operator readiness.",
|
||||
"Invalid queued commands fail closed and remain pending with drain diagnostics; no automatic skip/dead-letter framework.",
|
||||
"Program metadata/version/seed/initial-state binding is not retained immutable code provenance; R01/R05 own artifacts.",
|
||||
"Research keeps its resident native loop; no per-event paper snapshot transport added to research."
|
||||
],
|
||||
"cleanup": {
|
||||
"status": "completed",
|
||||
"stopped_container_ids": [
|
||||
"d915a0cd02120d8d09a7e2bb9b3fe4ad1b58e69ca6fd081fba003029f53ead23",
|
||||
"02c258682d95171a7e58740bb5d24c8ba544be6789fd1382e47367ad22d0f78d"
|
||||
],
|
||||
"development_resources_untouched": true,
|
||||
"worktrees_and_logs_retained": true
|
||||
},
|
||||
"next": "Accept/commit S03, then S04 verified paper feed/operator readiness. S05 independently ready; research-product R01/R11 require ADR-006. P08 remains deferred by owner request."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ No unrelated refactor, new service or broker activation.
|
|||
- apps/stock/orchestrator/src/services/ExecutionService.ts
|
||||
- apps/stock/engine/src/api/
|
||||
|
||||
Write locks: ts-execution-model, paper-transaction, financial-contract. One agent owns this change. Lock names do not override actual overlapping files.
|
||||
Write locks: ts-execution-model, paper-transaction, financial-contract. The integration owner coordinates disjoint native and durable custody slices; one designated owner controls each shared contract. Lock names do not override actual overlapping files.
|
||||
|
||||
## Dependencies and blockers
|
||||
|
||||
|
|
@ -68,12 +68,22 @@ At the paper boundary, intermediate views may be reconstructed by restoring the
|
|||
|
||||
**Durable custody:** retain the existing SQL account row lock and transaction mechanism. New explicitly canonical account IDs use a versioned outer envelope containing the opaque native checkpoint plus TS cursors/pending work. Reuse generic JSON journal/checkpoint/input storage where compatible; add only the all-owner batch-intent storage actually needed. Native order snapshots and ordered fill journal facts are authoritative persisted records; do not introduce UUID remapping or redundant financial projections. Legacy repository reads/initialization explicitly refuse canonical envelopes, and canonical initialization refuses legacy state or changed configuration. No implicit account conversion.
|
||||
|
||||
SQL custody is trusted. Account reads validate outer versions, identities, revision consistency and bound definitions. Rust replays and validates the opaque financial checkpoint before each financial transition; initialization alone does not certify every nested stored financial receipt. Do not introduce a second TypeScript ledger validator.
|
||||
|
||||
**Actual strategy recovery:** a canonical paper runner accepts trusted normalized input commands/observations and optional decision scheduling metadata. S04 supplies the real feed/calendar/scheduler; the caller cannot supply a portfolio or revision. Capture the committed native view for a decision. Restore program JSON state, RNG state/draws, decision cursors and pending observation prefixes for every owner before evaluating all due owners against that same view. Functionally extract/reuse S01 staging logic; preserve its public research diagnostics and complete-retry behavior. Never invent a historical dataset hash for paper.
|
||||
|
||||
Atomically save all next checkpoints and one complete decision-batch intent. Dispatch that batch in a subsequent locked transaction and persist actual admission feedback with its financial snapshot/effects. Drain pending batch, then pending decision, then next input; do not admit later financial input while recovery is pending. Reject caller-supplied Submit commands on the paper input path. Per-owner pending observations must survive mixed-cadence restarts. Trusted program definitions are bound by declared metadata/version/seed/mode/initial state; immutable code artifact retention remains R01/R05.
|
||||
|
||||
Ordinary decisions use a Decision-phase event key. Quote-driven decisions may use the exact consumed quote's Execution key, as the existing native matcher permits; they cannot fill against that consumed quote. Never invent a later timestamp to bypass event ordering.
|
||||
|
||||
This custody slice accepts observations only for configured execution series. An auxiliary feature/timeframe observation manifest and feed cadence/alignment belong to S04; this does not claim full research multi-timeframe parity. Invalid admitted commands fail closed at drain without financial advancement and remain pending for diagnosis; there is no automatic skip or dead-letter framework. S04 readiness must refuse incomplete/failed recovery, including a pending invalid input.
|
||||
|
||||
**Failures:** SQL failure discards all private staged changes. Native validation/restore errors with no returned transition roll back. A returned native `Failed` outcome can contain a committed financial prefix: save its failed snapshot and exact ordered effects atomically, mark the account/batch terminal, then surface failure after commit. Never report successful execution or keep a running retry state. Publication occurs after commit and cannot roll back finance; stable readable journal IDs recover notification gaps without claiming exactly-once delivery.
|
||||
|
||||
Port existing failure/recovery scenarios to approved canonical economics. Legacy immediate cached-quote fills, UTC implicit resets, shorts and mutable policy reloads are not canonical compatibility promises. Preserve DAY/GTC/IOC/FOK under next-eligible-event timing and explicit venue/risk sessions, and retain legacy tests unchanged. Required added cases include old-command/alias retries after later fills, failed-prefix custody, shared-revision owner batches, mixed-cadence restart, pending-input recovery, SQL decision/intent/effect failures, lost commit acknowledgement and competing producers.
|
||||
Port existing failure/recovery scenarios to approved canonical economics. Legacy immediate cached-quote fills, UTC implicit resets, shorts and mutable policy reloads are not canonical compatibility promises. Preserve DAY/GTC/IOC/FOK under next-eligible-event timing and explicit venue/risk sessions, and retain legacy tests unchanged. Required added cases include old-command/alias retries after later fills, failed-prefix custody, shared-revision owner batches, mixed-cadence restart, pending-input recovery, SQL decision/intent/effect failures, lost commit acknowledgement and competing producers. Kill a separate process before decision commit, after checkpoint/batch commit, after admission commit and after fill/fee commit; compare recovered checkpoints and ordered journals with uninterrupted execution.
|
||||
|
||||
Native and TypeScript owners work in separate worktrees with an accepted wire-schema overlay. The native owner controls the new API/schema and minimal existing-schema exports; the durable owner controls custody, shared strategy staging and canonical recovery. Root controls integration/migrations acceptance; independent review checks invariants. No default/service/feed activation or paper trading operation is authorized by this task.
|
||||
|
||||
## Validation handoff — 2026-10-23
|
||||
|
||||
Implementation and independent G1/G2 review passed. The manifest records the 22-file source hashes, native artifact, commands and raw logs. Full repository checks and all 81 disposable-database tests passed; strict new-test TypeScript and 38 final targeted tests passed after test-only typing corrections. The host and native adapter are integrated but uncommitted; S04 activation and feed work remain separate. See the [sixteenth-wave record](../../ROADMAP.md#sixteenth-wave-execution--2026-10-23).
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ Scheduling source of truth: [manifest entry S04](../manifest.json). No task is a
|
|||
|
||||
Verify the real paper feed path, recovery and stale-feed/kill controls on the canonical engine. Own the minimal paper-readiness endpoint/status needed to activate safely; do not wait for optional O02 cross-service dashboards. Reuse existing monitoring routes/components for actual state, unknown rather than fake zeros. Live remains disabled.
|
||||
|
||||
S03 supplies transaction custody and trusted command ingestion, not feed scheduling. Define the host's observation-series/cadence manifest before accepting auxiliary feature timeframes; retain the separate native execution-series configuration. Schedule ordinary completed observations and exact consumed-quote decisions without timestamp restamping. A durably admitted invalid input remains pending and drain rejects it: readiness must fail closed until recovery succeeds, without silently skipping data or resetting capital.
|
||||
|
||||
## Exclusions
|
||||
|
||||
No unrelated refactor, new service or broker activation.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue