docs(development): accept F08 and pin stateful strategy runtime scope
This commit is contained in:
parent
3838295eec
commit
0870b55830
5 changed files with 76 additions and 28 deletions
|
|
@ -57,3 +57,19 @@ 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
|
||||
|
||||
The owner accepted F08 and requested continuation after the handoff explicitly named S01 and linked ADR-005. Base `3838295`; manifest revision `2026-10-23.31`. Root reserves the strategy contract/shared pull driver/native feedback parser to one owner; independent test author owns disjoint test/measurement files after the API is pinned. No Rust financial semantics, worker request protocol, active legacy registry, SQL/paper operation or default cutover changes.
|
||||
|
||||
- Add `runStrategyReplay(load, programs, options)` as a trusted host primitive. Programs have owner ID, strategy ID/version, fixed target/orders mode, explicit uint32 seed, initial JSON state and a synchronous `decide(context) -> {nextState, intent}`. Owner IDs are unique and exactly match native configuration; strategy IDs/versions may repeat for independent instances. Capture/detach inputs at attempt creation. Do not pass execution services, native handles, future data or state belonging to other owners into author callbacks.
|
||||
- Context contains the engine time/barrier, the same frozen portfolio view for every due callback, owned positions, newly available observations since that owner's prior decision, previous admission feedback, readonly typed state and a scoped `random()`. Cadence controls scheduling; it must not discard another owner's pending observations. Warmup is consumed through the same prefix. Account information remains visible for portfolio-aware strategies; isolated state/feedback belongs only to its owner.
|
||||
- Extract one internal pull loop used by the existing conformance wrapper and the new runtime. Keep existing trace IDs, output hashes, observation delivery and format defaults stable for conformance. The runtime stages all due decisions/states before one native batch; only a validated successful response commits all prepared state/RNG/observation/sequence slots. A native risk rejection is a valid state transition; a failed/ambiguous submit disposes the attempt.
|
||||
- Per-owner RNG uses versioned `lcg32-v1`, the existing unsigned 32-bit `Math.imul(state,1664525)+1013904223` recurrence, divided by 2^32. Track state/draw count and safe decision counters. Invalidate the scoped RNG function immediately after the synchronous callback, including exceptions. This is reproducible fixture randomness, not a cryptographic or statistical-independence claim.
|
||||
- Reject non-JSON, lossy/nonfinite state, async outputs, invalid intents and wrong modes before admission. Detach/freeze input and returned state; do not let caller mutation or retained callback references rewrite a committed snapshot. Copying small strategy state is acceptable; never clone native financial history per observation.
|
||||
- Admission feedback copies validated native `Order` effects for the owner, including native rejection reasons and cancellation of that owner's earlier decisions. `Running` is not proof of order acceptance. Feedback is available at that owner's next decision and retained in terminal diagnostics. This is not a complete fill-event stream: subsequent fills appear in authoritative positions/open orders; S01 does not invent execution events or accounting.
|
||||
- Return `{result, metrics, diagnostics}`. Versioned diagnostic snapshots contain identity, committed barrier count/last ID, sorted owner records with state, next decision sequence, RNG state/draw count, consumed observation count and previous admission feedback. `StrategyReplayError` carries the last confirmed committed diagnostics and cause, never a successful financial result. Fault tests may spy on the native host submit method; no generic session factory is needed.
|
||||
- Retry means an entirely fresh native session with the original frozen inputs, detached initial states and per-owner seeds. Recompute every cursor and decision. Diagnostic TS snapshots are **not resumable financial checkpoints**. Do not expose a TS-only restore API or add native checkpoint transport for this task. Existing Rust reconstruction and paper checkpoints remain intact.
|
||||
- Direct trusted program objects suffice here. S02 supplies the first real SMA strategy and trusted worker composition; R01/A02 own immutable/untrusted artifacts and isolation. Keep the existing legacy `StrategyRegistry` instead of broadening its execution-service factory into the canonical author API.
|
||||
|
||||
Required regression scenarios include mixed owner cadence/warmup, reversed callback order and independent RNG draws, prefix/future-suffix integrity, late callback failure after a committed barrier, ambiguous post-native-submit failure, risk-rejection feedback with state advancement, repeated/partial targets, owned cancellation feedback, frozen/retained-reference isolation, invalid state/Promise/mode rejection, and compile-time absence of financial mutation services. Fresh retries must equal uninterrupted decision/state/RNG/economic results. Preserve existing conformance/result hashes and paper recovery tests. Measure deterministic strategy staging on representative release workloads without a DSL/cache or an unrelated hot-loop optimization.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue