Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/experiment_validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
permissions:
contents: read
issues: write
env:
DOWNLOAD_TOP_LIQUID: ${{ vars.DOWNLOAD_TOP_LIQUID || '90' }}

steps:
- name: Checkout
Expand Down Expand Up @@ -92,6 +94,11 @@ jobs:
cat data/output/experiment_validation/skip_reason.txt >> "$GITHUB_STEP_SUMMARY"
fi

- name: Download raw history for experiment validation
if: steps.experiment_payload.outputs.should_run == 'true'
run: |
python3 scripts/download_history.py --top-liquid "${DOWNLOAD_TOP_LIQUID}" --force-exchange-info

- name: Run monthly shadow build
if: steps.experiment_payload.outputs.should_run == 'true' && steps.experiment_payload.outputs.run_shadow_build == 'true'
run: |
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/monthly_optimization_planner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,44 @@ jobs:
gh workflow run experiment_validation.yml \
-f issue_number="${{ steps.upstream_experiment_target.outputs.issue_number }}"

- name: Resolve downstream experiment validation target
id: downstream_experiment_target
run: |
python3 - <<'PY'
import json
import os
from pathlib import Path

fanout = json.loads(
Path("data/output/monthly_optimization/fanout/binance_platform.json").read_text(encoding="utf-8")
)
plan = json.loads(
Path("data/output/monthly_optimization/optimization_plan.json").read_text(encoding="utf-8")
)
actions = plan.get("repo_action_summary", {}).get("BinancePlatform", {}).get("actions", [])
should_dispatch = bool(fanout.get("issue_number")) and fanout.get("status") in {"created", "updated"} and any(
action.get("experiment_only") for action in actions
)
with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as output:
print(f"should_dispatch={'true' if should_dispatch else 'false'}", file=output)
print(f"issue_number={fanout.get('issue_number') or ''}", file=output)
PY

- name: Dispatch BinancePlatform experiment validation
if: steps.downstream_experiment_target.outputs.should_dispatch == 'true'
env:
GH_TOKEN: ${{ secrets.CROSS_REPO_GITHUB_TOKEN }}
run: |
set +e
gh workflow run experiment_validation.yml \
-R "${{ inputs.downstream_repo }}" \
-f issue_number="${{ steps.downstream_experiment_target.outputs.issue_number }}"
status=$?
set -e
if [ "$status" -ne 0 ]; then
echo "Downstream experiment validation dispatch skipped: CROSS_REPO_GITHUB_TOKEN likely needs Actions write on ${{ inputs.downstream_repo }}." >> "$GITHUB_STEP_SUMMARY"
fi

- name: Upload planner artifact
uses: actions/upload-artifact@v7
with:
Expand Down
1 change: 1 addition & 0 deletions tests/test_experiment_validation_workflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def test_workflow_runs_shadow_build_and_posts_comment(self) -> None:
self.assertIn("workflow_dispatch:", workflow)
self.assertIn("issue_number:", workflow)
self.assertIn("prepare_experiment_validation.py", workflow)
self.assertIn("download_history.py", workflow)
self.assertIn("run_monthly_shadow_build.py", workflow)
self.assertIn("run_walkforward_validation.py", workflow)
self.assertIn("render_experiment_validation_summary.py", workflow)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_monthly_optimization_planner_workflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def test_planner_workflow_downloads_artifacts_posts_issue_and_fans_out_tasks(sel
self.assertIn("Fan out BinancePlatform task issue", workflow)
self.assertIn("Resolve upstream experiment validation target", workflow)
self.assertIn("Dispatch CryptoLeaderRotation experiment validation", workflow)
self.assertIn("Resolve downstream experiment validation target", workflow)
self.assertIn("Dispatch BinancePlatform experiment validation", workflow)
self.assertIn("gh workflow run experiment_validation.yml", workflow)
self.assertIn("--allow-permission-skip", workflow)
self.assertIn("Append fanout summary", workflow)
Expand Down