feat(backtest): enforce promotion-grade Purged WFA - #286
Conversation
Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0a0f69cdc6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Appended to preserve the positional order of every legacy field above. | ||
| validation_identity: BacktestValidationIdentity | None = None | ||
| cost_inputs: Mapping[str, float] = field(default_factory=dict) |
There was a problem hiding this comment.
Preserve promotion identity when loading persisted results
When promotion runs are saved and later retrieved through PerformanceStore.load_latest_backtest()/run_latest(), the new validation_identity and cost_inputs fields are silently dropped because performance_store._backtest_from_dict() still constructs BacktestResult without deserializing them. This means persisted promotion-grade fold/OOS records cannot be audited after reload even though the JSON contains the identity and cost inputs; for example, a saved promotion result reloads with validation_identity is None and empty cost_inputs. Please add the corresponding deserialization when introducing these persisted fields.
Useful? React with 👍 / 👎.
| embargo_days=embargo_days, | ||
| ) | ||
| fold_results.append( | ||
| self._persist_result( |
There was a problem hiding this comment.
Avoid overwriting promotion fold artifacts
If a promotion runner stamps all fold and locked-OOS results with the same computed_at value, this loop preserves that timestamp for every _persist_result() call. PerformanceStore._backtest_key() is derived from domain/strategy/param_version/computed_at and does not include the fold id, so those writes collide and only the final artifact remains persisted even though run_promotion() returned multiple results. This can happen with runners that use a single run timestamp or second-granularity timestamps; make the persisted key/timestamp unique per fold before saving.
Useful? React with 👍 / 👎.
Summary
run_promotion()pathBoundary
run()/walk_forward()remain non-promotionTests-first evidence
444f2a9da0117046b792374dffd99b37181ed97c:14 failed, 11 passed25 passed, 4 subtests passed809 passed, 1 skipped, 26 subtests passedCompatibility inventory
Read-only inventory of current local
origin/mainrefs found keyword-onlyBacktestResultconstruction in CN/HK/US/Crypto strategy and snapshot/pipeline consumers; no positional constructor call was found. Existing ordinary orchestrator signatures are unchanged. This is static inventory only and does not claim downstream suites pass.