From 7e9705306fadc48239bb877dbcb9a2b069b706a6 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 29 Sep 2026 07:49:15 +0000 Subject: [PATCH] fix(ci): count registry runs client-side in maintenance watch Issue #171 reported "2 of the last 7 scheduled runs failed" while the actual last 7 scheduled registry-update runs (Sep 22-28) all succeeded. The `runs?event=schedule&per_page=7` query intermittently serves a stale result: one sampled response had total_count=78 (vs 209), newest run 2026-09-08, and included the 2026-08-03 and 2026-07-31 failures - exactly the "2 failed, latest success" the watch reported. The page was descending, so re-sorting alone would not fix it; the server-side event filter is the unreliable part. Fetch 100 unfiltered runs, select event=="schedule" client-side, sort by created_at, and take the 7 newest; derive `latest` from the same list. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01UX3uvgjRrv9uYuZxKjNF4o --- .github/workflows/maintenance-watch.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/maintenance-watch.yml b/.github/workflows/maintenance-watch.yml index 3394f3d..7092f31 100644 --- a/.github/workflows/maintenance-watch.yml +++ b/.github/workflows/maintenance-watch.yml @@ -120,10 +120,16 @@ jobs: # Checks the last 7 scheduled runs, not just the latest. A failure can # disappear on its own because `--since 2` stops selecting the broken # version once it ages out — the run goes green while the cause remains. - runs=$(api "https://api.github.com/repos/$REPO/actions/workflows/registry-update.yml/runs?event=schedule&per_page=7") + # Filter and order client-side: the `event=schedule` query has served a + # stale result (newest run weeks old, July/August failures included) + # and raised false alarms twice, so neither its filter nor its order + # is trusted. 100 unfiltered runs span well over 7 scheduled ones. + runs=$(api "https://api.github.com/repos/$REPO/actions/workflows/registry-update.yml/runs?per_page=100") expect_object "$runs" "registry-update runs" - failed=$(echo "$runs" | jq '[.workflow_runs[] | select(.conclusion=="failure")] | length') - latest=$(echo "$runs" | jq -r '.workflow_runs[0].conclusion // "unknown"') + recent=$(echo "$runs" | jq '[.workflow_runs[] | select(.event=="schedule")] + | sort_by(.created_at) | reverse | .[:7]') + failed=$(echo "$recent" | jq '[.[] | select(.conclusion=="failure")] | length') + latest=$(echo "$recent" | jq -r '.[0].conclusion // "unknown"') if [ "$failed" -gt 0 ]; then findings="${findings}**Nightly registry publish**"$'\n' findings="${findings}- ${failed} of the last 7 scheduled runs failed (most recent run: ${latest})"$'\n'