Skip to content

Commit 10ed16a

Browse files
Pigbibicodex
andcommitted
fix(ci): seed lifecycle backtests before drift checks
Co-Authored-By: Codex <noreply@openai.com>
1 parent 9a700c8 commit 10ed16a

3 files changed

Lines changed: 69 additions & 6 deletions

File tree

.github/workflows/drift-check.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,55 @@ permissions:
1313
id-token: write
1414

1515
jobs:
16+
preflight_backtests:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 15
19+
env:
20+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
21+
LIFECYCLE_PERFORMANCE_BUCKET: ${{ vars.LIFECYCLE_PERFORMANCE_BUCKET || '' }}
22+
LIFECYCLE_LOCAL_ROOT: ${{ github.workspace }}/data/lifecycle_store
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v6
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v6
29+
with:
30+
python-version: "3.11"
31+
32+
- name: Install dependencies
33+
run: |
34+
set -euo pipefail
35+
python -m pip install --upgrade pip
36+
python -m pip install -e . pandas
37+
38+
- name: Persist lifecycle backtests
39+
run: |
40+
python - <<'PY'
41+
import json
42+
import subprocess
43+
44+
profiles = json.loads(
45+
subprocess.check_output(
46+
["python", "scripts/run_walk_forward_backtest.py", "--list-profiles"],
47+
text=True,
48+
)
49+
)["profiles"]
50+
for profile in profiles:
51+
subprocess.check_call(
52+
[
53+
"python",
54+
"scripts/run_walk_forward_backtest.py",
55+
"--profile",
56+
profile,
57+
"--store-root",
58+
"data/lifecycle_store",
59+
]
60+
)
61+
PY
62+
1663
drift:
64+
needs: preflight_backtests
1765
uses: QuantStrategyLab/QuantPlatformKit/.github/workflows/reusable-drift-check.yml@335c7a22bc3f570bd5705427ccc40172eda6b289
1866
with:
1967
strategy_domain: crypto

scripts/run_walk_forward_backtest.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@ def _build_runner(*, profile: str, synthetic_days: int, panel: Any = None, marke
6565
)
6666

6767

68+
def _run_baseline(runner: Any, profile: str, params: dict[str, Any]) -> Any:
69+
try:
70+
return runner.run(
71+
profile,
72+
params,
73+
start_date=None,
74+
end_date=None,
75+
)
76+
except TypeError as exc:
77+
message = str(exc)
78+
if "start_date" not in message and "end_date" not in message:
79+
raise
80+
return runner.run(profile, params)
81+
82+
6883
def run_walk_forward(
6984
*,
7085
profile: str,
@@ -92,12 +107,7 @@ def run_walk_forward(
92107
synthetic_days=synthetic_days,
93108
)
94109
orchestrator.register_runner("crypto", runner)
95-
baseline_raw = runner.run(
96-
profile,
97-
copy.deepcopy(baseline_params),
98-
start_date=None,
99-
end_date=None,
100-
)
110+
baseline_raw = _run_baseline(runner, profile, copy.deepcopy(baseline_params))
101111
wf_params = copy.deepcopy(params)
102112
wf_results = orchestrator.walk_forward(
103113
profile,

tests/test_drift_workflow_config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
def test_drift_workflow_wires_pipeline_repo_and_lifecycle_env() -> None:
55
workflow = (Path(__file__).resolve().parents[1] / ".github" / "workflows" / "drift-check.yml").read_text(encoding="utf-8")
66

7+
assert "preflight_backtests:" in workflow
8+
assert "needs: preflight_backtests" in workflow
9+
assert "scripts/run_walk_forward_backtest.py" in workflow
10+
assert '"--list-profiles"' in workflow
11+
assert '"data/lifecycle_store"' in workflow
712
assert "uses: QuantStrategyLab/QuantPlatformKit/.github/workflows/reusable-drift-check.yml@335c7a22bc3f570bd5705427ccc40172eda6b289" in workflow
813
assert "strategy_domain: crypto" in workflow
914
assert "caller_event_name: ${{ github.event_name }}" in workflow

0 commit comments

Comments
 (0)