Add CRCR downstream health metrics and critical tests with HUD metrics (L1/L2)#9
Add CRCR downstream health metrics and critical tests with HUD metrics (L1/L2)#9jewelkm89 wants to merge 6 commits into
Conversation
Introduce payload validators, JSON fixtures, and unit tests that run on push/PR to this repo. Enhance the dispatch-receiver and L2 workflows to assert payload shape, PyTorch checkout SHA, and deterministic relay callbacks instead of random pass/fail simulation. Test Plan: ``` python3 -m unittest discover -s tests -p 'test_*.py' -v ``` Authored with an AI assistant. Co-authored-by: Cursor <cursoragent@cursor.com>
Remove any scheduled-monitor direction from docs and strengthen L1/L2 workflows to record actual step outcomes, emit health-report.json artifacts per dispatch run, and assert closed-event cancel behavior. Test Plan: ``` python3 -m unittest discover -s tests -p 'test_*.py' -v ``` Authored with an AI assistant. Co-authored-by: Cursor <cursoragent@cursor.com>
Test Plan: ``` ./scripts/run-local-tests.sh ``` Authored with an AI assistant. Co-authored-by: Cursor <cursoragent@cursor.com>
Map each integration check to workflow.test_results (passed/failed/total) and post through the existing cross-repo-ci-relay-callback action. L1 now reports in_progress/completed callbacks as well as L2. Test Plan: ``` python3 -m unittest discover -s tests -p 'test_*.py' -v ``` Authored with an AI assistant. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Hi @atalman, can you please review the tests added for critical test check |
Default to the current gh repo with fallback to pytorch/crcr-test instead of a hardcoded personal fork. CRCR_TEST_REPO still overrides explicitly. Test plan: ``` ./scripts/trigger-test-dispatch.sh --help # N/A; script has no --help git diff scripts/trigger-test-dispatch.sh ``` Authored with an AI assistant. Co-authored-by: Cursor <cursoragent@cursor.com>
L1 runs a light probe (payload + checkout, no callbacks) on synchronize and push. L2 runs only on opened/reopened. Full L1+L2 HUD probes remain on low-volume PR events. Document tiered coverage in README. Test plan: ``` ./scripts/run-local-tests.sh ``` Authored with an AI assistant. Co-authored-by: Cursor <cursoragent@cursor.com>
| @@ -1,12 +1,12 @@ | |||
| name: OOT L2 CI | |||
There was a problem hiding this comment.
Lets change OOT -> CRCR here as well
|
|
||
|
|
||
| class TestPytorchCheckout(unittest.TestCase): | ||
| def test_checkout_matches_dispatch_sha(self) -> None: |
There was a problem hiding this comment.
Name says matches but this only tests the mismatch path (asserts non-zero + "checkout SHA mismatch"). The happy path (HEAD == dispatched SHA -> exit 0) is never covered, so a validator that always reported mismatch would still pass. Add a positive case.
| fi | ||
| echo "delivery_id=${DELIVERY_ID}" | ||
|
|
||
| - name: L1 — build health metrics for HUD |
There was a problem hiding this comment.
write_health_report.py is invoked twice per workflow with a near-identical --check list (also L1 line ~175, and L2 lines ~100/~128). Adding/renaming a check means editing 4 blocks that will drift — consider factoring the check list out.
|
|
||
| l2-critical: | ||
| if: >- | ||
| github.event.client_payload.payload.action != 'closed' && |
There was a problem hiding this comment.
Redundant: contains(["opened","reopened"], action) already excludes closed, so action != 'closed' && is dead. Drop it.
| --check "delivery_id=${{ steps.delivery.outcome }}" \ | ||
| --strict | ||
|
|
||
| - name: L1 — write full health report with callback outcome |
There was a problem hiding this comment.
This strict report overwrites health-report.json with 6 checks (incl. completed_callback), but HUD test_results came from the earlier health_metrics step (5 checks). Artifact total (6) won't match HUD total_tests (5) — worth a comment noting it's inherent to reporting the callback's own outcome.
|
|
||
| expect_status = sys.argv[1] | ||
| if expect_status not in ALLOWED_STATUSES: | ||
| print(f"::error::status arg must be in_progress or completed", file=sys.stderr) |
There was a problem hiding this comment.
f-string with no placeholder — drop the f.
Summary
Turns
pytorch/crcr-testinto a downstream CRCR test repo. This repo contains test workflows and validators that run on liverepository_dispatchevents from the relay.On upstream PyTorch PR
opened/reopened, workflows validate dispatch delivery, PyTorch checkout fidelity, and (for L2) relay callbacks. Health check outcomes are sent to HUD via the existingcompletedcallbacktest_resultsfield (each integration check maps to passed/failed/total).On
synchronizeandpush, L1 runs a light probe (payload + checkout only, no callbacks). L2 is skipped. This tiered model reduces relay HTTP 429 rate-limit hits (#8) while keeping dispatch coverage on high-volume events.flowchart TB PT[pytorch/pytorch PR or push] --> APP[CRCR GitHub App] APP --> RD[repository_dispatch to crcr-test] RD --> L1C{PR closed?} RD --> L2C{PR closed?} L1C -->|yes| L1X[L1 cancel-workflow] L1C -->|no| L1A{opened or reopened?} L1A -->|yes| L1F[L1 full probe + HUD] L1A -->|no| L1L[L1 light probe no callbacks] L2C -->|yes| L2X[L2 cancel-workflow] L2C -->|no| L2A{opened or reopened?} L2A -->|yes| L2[L2 full probe + HUD] L2A -->|no| L2S[L2 skipped] L1F --> RELAY[Callback lambda] L2 --> RELAY RELAY --> HUD[HUD crcr-test dashboard] OFF[Layer 0 offline unit tests] -.-> L1F OFF -.-> L2Test layers overview
crcr-unit-tests.ymlcrcr-dispatch-receiver.ymloot-l2-ci.ymlcrcr-testrepository_dispatch(pull_request+push)repository_dispatch(pull_request,opened/reopenedonly)opened/reopenedonlyopened/reopenedonlyopened/reopenedonlyEvent filtering (relay rate limits)
The callback Lambda enforces a per-repo sliding-window limit (~20/min in prod today; 60/min after test-infra#8203 deploy). A full L1+L2 probe costs 4 callbacks.
synchronizeis high volume and was tripping 429s when every event sent full callbacks.opened,reopenedsynchronizeclosedpushLight probe still validates dispatch payload, checks out PyTorch, verifies SHA, and uploads
health-report.json. Callback coverage remains on low-volumeopened/reopenedwhere the callback code path is identical.Tests and checks by layer
L0 — Offline (
crcr-unit-tests.yml)openedsynchronizeclosedpushdelivery_idpytorch/pytorchin_progressshapecompletedshapeconclusionconclusionvalidate_pytorch_checkout.pylogictest_resultsmappinghealthy,conclusionfieldsL1 — Live dispatch probe (
crcr-dispatch-receiver.yml)opened/reopened)synchronize/push)validate_dispatch_payloadin_progresscallbackvalidate_pytorch_checkoutdelivery_idcompletedcallback + HUD metricscancel-workflow(PR closed)L2 — Live callback probe (
oot-l2-ci.yml)Runs only on
opened/reopened.validate_dispatch_payloadin_progresscallbackvalidate_pytorch_checkoutwrite_health_report+completedcallbacktest_results+conclusionto HUDcompleted_callbackin final reportcancel-workflow(PR closed)closedOne upstream event — what runs?
opened/reopenedl1-criticalfulll2-criticalsynchronizel1-lightclosedcancel-workflowcancel-workflowl1-lightcrcr-unit-testsShared components by layer
validate_dispatch_payload.pyvalidate_pytorch_checkout.pyvalidate_callback_payload.pywrite_health_report.pycross-repo-ci-relay-callbackKey changes
tests/— payload validators, JSON fixtures,write_health_report.py, and 16 unit testswrite_health_report.py— shared health reporter used by both L1 and L2 probes; aggregates step outcomes intochecks, maps them to HUDtest_results, and feeds thecompletedcallback (separate report and HUD row per probe)crcr-dispatch-receiver.yml— L1 probe: full onopened/reopened, light onsynchronize/pushoot-l2-ci.yml— L2 probe:opened/reopenedonly; deterministic checks + callbackscrcr-unit-tests.yml— offline contract tests on push/PR to this reposcripts/—run-local-tests.shandtrigger-test-dispatch.shfor local/fork testingCRCR health is measured when the relay dispatches; offline unit tests guard validator/fixture drift on merge.
HUD health metrics
L1 and L2 full probes build a health report from step outcomes, then send it on the
completedcallback:test_resultssuccesspassed_testsfailure/cancelledfailed_testsskippedskipped_testsconclusionissuccessonly when all checks pass. Per-check names are in thehealth-report.jsonworkflow artifact. Verify rows at https://hud.pytorch.org/crcr/pytorch/crcr-testTest plan
Pre-merge (offline):
Pre-merge (CI):
crcr-unit-testsworkflow passes on this PRPost-merge (live CRCR):
openedtriggersL1 Health(full) andL2 Healthworkflowssynchronizetriggers L1 light only (no L2, no callbacks)completedcallback succeeds onopened/reopened(HTTP 2xx from relay)passed_tests/failed_tests/total_testsmatching probe checkshealth-report.jsonartifact uploaded per runAuthored with an AI assistant.