docs: explain strategy replay and durable execution code

This commit is contained in:
Boki 2026-10-25 11:31:23 -04:00
parent 8587c71cf3
commit dd7ac53c51
19 changed files with 494 additions and 41 deletions

View file

@ -32,6 +32,7 @@ type StrategyRun<Result extends ReplayOutput> = {
diagnostics: DeepReadonly<StrategyDiagnosticSnapshot>;
};
/** Replay failure plus the last confirmed callback diagnostics for investigation. */
export class StrategyReplayError extends Error {
constructor(
cause: unknown,
@ -43,6 +44,16 @@ export class StrategyReplayError extends Error {
}
/* eslint-disable no-redeclare -- Keep selected native result formats precise. */
/**
* Run trusted synchronous programs against a newly constructed Rust session.
* The shared replay driver advances to a barrier, asks StrategyController for
* decisions, submits them together, then confirms callback state on admission.
*
* Prepared market input is copied into Rust before callbacks can run. Result
* format selects trace, projection or report output, not different economics.
* Replay failures carry confirmed diagnostics; retries start from original inputs
* and initial program state, not from those diagnostic snapshots.
*/
export function runStrategyReplay(
load: ReturnType<typeof prepareReplayLoad>,
programs: readonly StrategyProgram[],