Skip to content

L4472: split Saturday Backtester SF state into 3 (simulate / predictor / optimizer)#351

Merged
cipher813 merged 1 commit into
mainfrom
feat/l4472-sf-phase-split
May 31, 2026
Merged

L4472: split Saturday Backtester SF state into 3 (simulate / predictor / optimizer)#351
cipher813 merged 1 commit into
mainfrom
feat/l4472-sf-phase-split

Conversation

@cipher813
Copy link
Copy Markdown
Owner

Context — ROADMAP L4472 (⏰ soft deadline: 2026-06-06 09:00 UTC Saturday SF)

The single Saturday Backtester state ran simulate+param_sweep+predictor-backtest+Phase4+optimizer/cov/gamma in one SSM command whose summed runtime exceeded the SSM execution timeout on a fresh date (L4470) → no backtester/parity/evaluator completion → config auto-apply froze (L4473). Each post-sweep phase re-runs the predictor pipeline (GBM inference + 10y ArcticDB read), so it was death-by-sum-of-runtime with no single per-phase cap tripped. The 06-06 run repeats this failure unless this lands first.

The split

Decompose the backtest stage by --mode into three sequential SF states, each with its own SSM execution timeout + independent redrive (mirrors the 2026-05-07/05-16 simulate/parity/evaluator split precedent):

State Invocation Runs
Backtester --mode=param-sweep --no-pit-parity simulate + param_sweep
PredictorBacktest (new) --mode=predictor-backtest predictor pipeline + Phase 4a/b/c; pit_parity here
PortfolioOptimizerBacktest (new) --mode=portfolio-optimizer-backtest --no-pit-parity optimizer_gate + cov_sweep + gamma_sweep

Happy path: CheckSkipBacktester → Backtester → PredictorBacktest → PortfolioOptimizerBacktest → CheckSkipParity → Parity → CheckSkipEvaluator → Evaluator.

  • skip_backtester still skips the whole backtest-family (routes past CheckSkipParity to CheckSkipEvaluator) — unchanged.
  • pit_parity fires exactly once (default-ON in PredictorBacktest; the other two pass --no-pit-parity).
  • Each new state mirrors Backtester's Retry / Catch(HandleFailure) / Timeout posture, distinct ResultPaths; on failure the next state is not entered (anti-auto-promote-garbage). Decouples Backtester→Parity so pit_parity.json finally lands.
  • No backtester-repo logic change needed for dispatch — spot_backtest.sh already threads --mode/--no-pit-parity/--skip-stages.

Safety verified before wiring

  • Each --mode is self-contained (re-reads from S3/ArcticDB; no in-memory handoff between phases) → 3 sequential processes == 1 --mode=all process for artifacts.
  • The one semantic fork (executor-recommendation artifact collision) is closed by the companion alpha-engine-backtester PR (gate predictor's executor-apply on mode=="all").

Testing

  • Updated SF pins: test_sf_backtest_parity_split_wiring (3-way split + new TestL4472PhaseSplit), test_sf_eval_judge_wiring, test_sf_payload_uniqueness (spot-state count 8→10), test_sf_friday_shell_run_wiring (_SPOT_STATES + main-thread trace).
  • Regenerated tests/fixtures/sf_prekeystone_spot_commands.json (documented workflow for a deliberate spot-command change).
  • SF graph validated (62→72 states, no dangling transitions). Full data suite: 1731 passed, 1 skipped.

Deploy

SF deploy is a manual operator step (infrastructure/deploy_step_function.shaws stepfunctions update-state-machine). Must be deployed before the 06-06 09:00 UTC Saturday cron.

Companion PRs

  • alpha-engine-backtester#269: executor-apply mode-gate + simulation cap (correctness).
  • alpha-engine-config: enable assembler.cutover_enabled + ROADMAP follow-ups.

🤖 Generated with Claude Code

…r / optimizer)

The single `Backtester` state ran simulate+param_sweep+predictor-backtest+Phase4
+optimizer/cov/gamma in ONE SSM command whose SUMMED runtime exceeded the SSM
execution timeout on a fresh date (L4470) -> no backtester/parity/evaluator
completion -> config auto-apply froze (L4473). Each phase re-runs the predictor
pipeline (GBM inference + 10y ArcticDB read), so it was death-by-sum-of-runtime
with no single per-phase cap tripped.

Decompose the backtest stage by --mode into THREE sequential SF states, each
with its own SSM execution timeout + independent redrive (mirrors the
2026-05-07/05-16 simulate/parity/evaluator split precedent):

  Backtester                 --mode=param-sweep --no-pit-parity   (simulate+sweep)
  PredictorBacktest          --mode=predictor-backtest            (predictor+Phase4; pit_parity HERE)
  PortfolioOptimizerBacktest --mode=portfolio-optimizer-backtest --no-pit-parity

Happy path: CheckSkipBacktester -> Backtester -> PredictorBacktest ->
PortfolioOptimizerBacktest -> CheckSkipParity -> Parity -> CheckSkipEvaluator
-> Evaluator. skip_backtester still skips the whole backtest-family (routes
past CheckSkipParity to CheckSkipEvaluator). pit_parity fires exactly once
(default-ON in PredictorBacktest; the other two pass --no-pit-parity). Each new
state mirrors Backtester's Retry/Catch(HandleFailure)/Timeout posture with
distinct ResultPaths; on failure the next state is NOT entered
(anti-auto-promote-garbage).

Tests: updated test_sf_backtest_parity_split_wiring (now pins the 3-way split
+ new TestL4472PhaseSplit class), test_sf_eval_judge_wiring (walk the new
chain), test_sf_payload_uniqueness (spot-state count 8->10),
test_sf_friday_shell_run_wiring (_SPOT_STATES registry + main-thread trace);
regenerated the sf_prekeystone_spot_commands.json baseline for the deliberate
spot-command change. Full SF suite + full data suite green (1731 passed).

Pairs with alpha-engine-backtester executor-apply mode-gate fix (the
correctness piece) + alpha-engine-config assembler cutover.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cipher813 cipher813 merged commit ed1c5ea into main May 31, 2026
1 check passed
@cipher813 cipher813 deleted the feat/l4472-sf-phase-split branch May 31, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant