feat(paper): gate canonical execution on durable feed readiness
This commit is contained in:
parent
c01e96e4dd
commit
75abae2cfc
24 changed files with 3720 additions and 66 deletions
|
|
@ -6,8 +6,9 @@ Scheduling source of truth: [manifest entry S04](../manifest.json). No task is a
|
|||
|
||||
## Evidence and root cause
|
||||
|
||||
- **OPS-02 — Needs Investigation:** Paper/live operational readiness is not demonstrated end-to-end. Live is deliberately disabled; preserve that gate until feed, reconciliation and broker-specific recovery are verified. [apps/stock/orchestrator/src/core/ModeManager.ts:33](../../../../apps/stock/orchestrator/src/core/ModeManager.ts#L33); [apps/stock/orchestrator/src/container.ts:152](../../../../apps/stock/orchestrator/src/container.ts#L152).
|
||||
- **FIN-06 — Verified:** Native simulation fills complete requested quantities at the latest price without bar-volume participation; current risk must be enforced at acceptance and fill, including pending exposure. [apps/stock/engine/src/backtest/engine.rs:374](../../../../apps/stock/engine/src/backtest/engine.rs#L374); [apps/stock/engine/src/backtest/engine.rs:414](../../../../apps/stock/engine/src/backtest/engine.rs#L414).
|
||||
- **OPS-02 — Verified:** `MarketDataService.initialize()` creates a Socket.IO client, but `data-ingestion/src/routes/create-routes.ts` mounts no stream producer. The unmounted live route queues an absent handler. Connection logging is not feed readiness.
|
||||
- **FIN-06 — Addressed by F04/F05/S03:** Canonical Rust already enforces quantity/cash/risk and quote capacity. S04 must connect that tested engine to explicit market-data timing and retain its durable recovery, rather than fix or duplicate financial arithmetic. See `execution/CanonicalPaperExecution.ts` and `PostgresCanonicalExecutionRepository.ts`.
|
||||
- **OPS-02 composition evidence — Verified:** Existing composition constructs legacy execution/mode/order gateways; canonical activation requires an isolated graph and a persisted operator/feed gate, not just another boolean in a route.
|
||||
|
||||
## Intended behavior and implementation scope
|
||||
|
||||
|
|
@ -21,13 +22,13 @@ No unrelated refactor, new service or broker activation.
|
|||
|
||||
## Likely files and ownership
|
||||
|
||||
- apps/stock/orchestrator/src/paper/PaperTradingManager.ts
|
||||
- apps/stock/orchestrator/src/services/MarketDataService.ts
|
||||
- apps/stock/orchestrator/src/services/ExecutionService.ts
|
||||
- apps/stock/orchestrator/src/api/rest/
|
||||
- apps/stock/data-ingestion/src/
|
||||
- apps/stock/orchestrator/src/paper/{feed,CanonicalPaperRuntime}.ts
|
||||
- apps/stock/orchestrator/src/execution/{canonical-paper,CanonicalPaperExecution,PostgresCanonicalExecutionRepository}.ts
|
||||
- apps/stock/orchestrator/src/{contracts/paper-runtime,api/rest/paper,container,simple-container,index,routes/create-routes,types}.ts
|
||||
- apps/stock/config/src/schemas/stock-app.schema.ts
|
||||
- test/{integration,postgres,fixtures}/paper-*.ts
|
||||
|
||||
Write locks: paper-runtime. One agent owns this change. Lock names do not override actual overlapping files.
|
||||
Write locks: paper-runtime. Root owns shared contracts/composition/API; disjoint feed and custody slices have one owner each. Lock names do not override actual overlapping files.
|
||||
|
||||
## Dependencies and blockers
|
||||
|
||||
|
|
@ -58,3 +59,24 @@ 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.
|
||||
|
||||
## Execution contract — 2026-10-23
|
||||
|
||||
Base `c01e96e` contains accepted S03. This wave implements an opt-in canonical composition; no default cutover or trading activation. Inspection found no usable quote producer behind the legacy Socket.IO client: ingestion does not serve that protocol, the live route is not mounted, and its queued handler is absent. Do not manufacture provider readiness. The implemented ingress is an authenticated normalized HTTP frame boundary; a real provider adapter and verified operational calendar remain prerequisites for running it.
|
||||
|
||||
- Rust alone owns matching, financial state and risk. Host control state shares the existing SQL account row lock; no additional service/table. Immutable policy binds target-mode built-ins, explicit raw-price quote series, auxiliary completed-bar manifests/cadence, versioned UTC sessions and account risk boundaries.
|
||||
- Each process generation fences prior hosts. Startup/reconnect disconnects or revokes activation. Initial and persisted human halt stop decisions, submissions and fills without finish/cancel/liquidation/reset. Every drain step rechecks controls under the account lock; old shutdown cannot stop a replacement.
|
||||
- Feed frames carry original physical quote timestamps/sequences and explicit atomic release time. All quotes execute in native key order before the final synchronized decision; new intents cannot fill on those quotes. Completed bars are supplied, never synthesized. Session-open anchored bars may clip at declared session close. Auxiliary observations do not mark prices or create liquidity.
|
||||
- Frame admission persists original receipt/disposition and every input atomically. Exact retries never change health-only/admitted meaning. Physical quote/bar receipts prevent conflicting or recycled observations, including inactive probes. New active frames cannot plan against pending recovery; producer retries after prior request drains.
|
||||
- Fresh transport and every configured asset must be ready. Check the old deadline before refreshing health. Missing/stale/future/regressing/out-of-session data fail closed; no time repairs. A late fresh frame cannot silently resume execution. Native daily/drawdown risk remains authoritative and separate from the host pause.
|
||||
- Previously admitted crash-recovery inputs retain their original times. Activation defaults to `recoverPending:false`; explicit `true` is required for pending historical work. Acknowledgement follows successful recovery and final fresh readiness. Invalid durable work remains pending with diagnostics; never skip/restamp/reset it.
|
||||
- With HTTP authentication enabled, human operator credentials alone activate/halt; verified service credentials may submit feed frames. Existing explicit loopback development auth bypass maps to operator and remains supported; readiness in bypass mode is not authenticated-feed certification. Legacy order/position gateways and WebSocket controls are unavailable in canonical composition. Research uses its existing isolated worker. `/health` is liveness; `/api/paper/readiness` reports actual readiness or explicit unknown state. Live remains disabled.
|
||||
|
||||
Mandatory added scenarios: actual HTTP → built-in SMA → later quote fill → SQL → restart; service activation denial; initial/persisted halt; locked halt race; stale generation/shutdown; idle-before-refresh; stale second asset; pending recovery status; old quote after fresh probe; immutable retry dispositions; explicit historical recovery; cross-session controls; physical observation conflicts; configured capital; canonical/research isolation. No performance work or benchmark is included.
|
||||
|
||||
|
||||
## Validated handoff — 2026-10-23
|
||||
|
||||
Implementation and independent G1/G2/API isolation review accepted; manifest remains `review` until owner acceptance/commit. Full repository and PostgreSQL gates pass; the release-addon suite covers real SMA HTTP-to-fill restart, isolated research, all control regressions and native binding checks. See [wave17 validation](../manifest.json) and [roadmap](../../ROADMAP.md#seventeenth-wave-execution--2026-10-23) for exact commands, counts, hashes and limits.
|
||||
|
||||
Canonical configuration is opt-in at `services.orchestrator.canonicalPaper`, validated before opening connections. `/api/paper/readiness` exposes state; operator `/activate` and `/halt` are separate from trusted producer `/feed/connect`, `/feed/frames`, `/feed/disconnect`. No provider connectivity is claimed and no account was operationally activated. All configured assets currently require covered sessions and fresh quotes; arbitrary callbacks, broker execution and automatic calendar/provider discovery remain outside this slice.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue