Repository navigation
fix(ci): restore the nightly compat budget and stop a false stale report - #2247
Conversation
Two unrelated problems behind the same health issue (#2232). ## compat.yml was timing out -- my regression #2223 added a second CSV invocation per run to compare column names. Measured at ~1.7x on a 71-file sample and judged acceptable; I never checked it against the job's cap. On the full corpus the BQL step went 18m37s -> 34m36s and the job hit `timeout-minutes: 45`. The 09-02 and 09-03 nightlies were killed after BQL and never reached "Commit results to compatibility branch", so the trend lost two days -- the exact failure the concurrency comment in that workflow warns about. Headers are compared on a SAMPLE of files per query now. A header is the rendered target expression, so it depends on the query and not the ledger: measured across the corpus, every query yields exactly one distinct header pair however many files it runs on, which is also why the divergence registry keys these `("*", query)`. The cost is `queries x N` regardless of corpus size -- 380 header passes against 735 files rather than ~14000 -- so the sample is generous rather than minimal. Two guards, because a cap that hides a divergence is worse than the runtime it saves: * If a query's sampled files disagree about its headers, the property the sample rests on is false and the run errors. That is what would happen if a `PIVOT BY` query were added, since a pivot names its columns after the data. * If a query ends up with NO usable comparison -- every sampled file failing in one of the tools, which ~28% of runs do -- the run errors rather than reporting a silent zero. Verified: verdicts unchanged (58/0/21 over 71 files), the same four queries still report header divergences, and both guards fire when forced. Runtime went from 1m44s back to 1m10s against a 1m02s baseline. ## nightly-health called a healthy workflow stale Separately, the report claimed `bench.yml` had not run in 10 days and linked a real run from 2026-08-24. It had in fact run six hours earlier, successfully, as it had every day. `latest_scheduled_run` took element zero of `gh run list`; it now takes the maximum by `createdAt`. This does NOT claim to fix a diagnosed bug: the same command by hand returns the correct run, so the cause was not reproducible. What it removes is the dependence on list ORDER, the only assumption that could produce that output. The self-test feeds a deliberately out-of-order page, since a correctly-ordered fixture cannot tell the two implementations apart. A false alarm matters more here than the diff size suggests: a health reporter exists to be believed, and one that cries wolf gets muted -- which is the failure it was written to prevent.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
🟡 Changes recommended
The new header-sampling “guards” in compat-bql-test.py currently only print ::error:: annotations and do not reliably fail the step with a non-zero exit code when they trigger.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR addresses two CI reliability issues affecting scheduled workflow health: it reduces the runtime cost of the nightly BQL compatibility header comparison (to stay within the job timeout budget) and fixes a false “stale workflow” report by selecting the newest scheduled run by timestamp rather than list position.
Changes:
- Sample CSV header comparisons per query in
compat-bql-test.pyto avoid an expensive full corpus cross-product while adding guards for sampling soundness. - Update
nightly-health.pyto pick the latest scheduled run viamax(createdAt)(with a self-test for out-of-order results). - Improve reporting around header-check coverage and sampling assumptions.
File summaries
| File | Description |
|---|---|
| scripts/nightly-health.py | Fetches multiple scheduled runs and selects the newest by createdAt, plus a self-test to prevent regressions due to run-list ordering. |
| scripts/compat-bql-test.py | Samples per-query header comparisons to restore nightly runtime budget; adds reporting and guardrails around header sampling coverage/validity. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
|
Ran the full uncapped corpus locally, because the PR's own compat run does not prove this: PR and push runs pass Full corpus, 735 files: 380 rather than ~10,000 is the whole point — the header cost is Sizing the nightly from the measured numbers: the header pass added ~16 minutes for ~10,000 successful runs, so ~0.1s each; 380 of them is roughly 36 seconds. That puts the BQL step back near its 18m37s baseline and the job near 29 minutes against the 45-minute cap. I am calling that a well-grounded prediction rather than a fact — the nightly runs on GitHub's runners, not mine. The real confirmation is the next scheduled |
Both guards printed `::error::` and returned 0. An annotation does not fail a GitHub Actions step, so a run whose header sampling was unsound would have reported SUCCESS -- and the comments I wrote beside them said "the run errors", which was simply untrue. That is the failure this harness exists to prevent, reintroduced by the change meant to protect it: a check that cannot fail. `main` now returns 1 when either guard trips, last so every other diagnostic still prints. Verified by exit code rather than by reading the output: a healthy run exits 0, a query with no usable header comparison exits 1, and headers varying across sampled files exits 1. Caught in review of #2247.
|
You're right, and it's the worst version of the mistake: the comments I wrote beside those guards said "the run errors" and it didn't. A guard that only annotates is a check that cannot fail — which is the exact failure this harness exists to prevent, reintroduced by the change meant to protect it. Fixed in a2c9fea. Verified by exit code, not by reading the output — which is the only way this could have been caught in the first place: |
Two unrelated problems behind the same health issue (#2232).
1. compat.yml was timing out — my regression
#2223 added a second CSV invocation per run to compare column names. I measured ~1.7× on a 71-file sample, judged it acceptable, and never checked it against the job's cap. On the full corpus:
timeout-minutes: 45, cancelledBoth nightlies were killed after BQL and never reached "Commit results to compatibility branch", so the trend lost two days — the exact failure the concurrency comment in that workflow warns about.
Headers are now compared on a sample of files per query. A header is the rendered target expression, so it depends on the query, not the ledger. Measured across the corpus: every query yields exactly one distinct header pair however many files it runs on — which is also why the divergence registry keys these
("*", query)rather than enumerating files.The cost is
queries × Nregardless of corpus size — 380 header passes against 735 files instead of ~14,000 — so the sample is generous rather than minimal. That property is what makes this a fix rather than a trade.Two guards, because a cap that hides a divergence is worse than the runtime it saves:
PIVOT BYquery were added, since a pivot names its columns after the data.Verified: verdicts unchanged (58/0/21 over 71 files), the same four queries still report header divergences, and both guards fire when forced. Runtime 1m44s → 1m10s against a 1m02s baseline. A pleasant accident: forcing zero coverage also trips the existing stale-mask check, so that registry independently notices a query losing header coverage.
2. nightly-health called a healthy workflow stale
Separately, the report claimed
bench.ymlhad not run in 10 days, linking a real run from 2026-08-24. It had in fact run six hours earlier, successfully, as it had every day for weeks.latest_scheduled_runtook element zero ofgh run list; it now takes the maximum bycreatedAt.This does not claim to fix a diagnosed bug. The same command by hand returns the correct run, so I could not reproduce the cause and I am not going to invent one. What it removes is the dependence on list order — the only assumption that could produce that output. The self-test feeds a deliberately out-of-order page, since a correctly-ordered fixture cannot tell the two implementations apart; reverting to
runs[0]fails it.A false alarm matters more here than the diff size suggests: a health reporter exists to be believed, and one that cries wolf gets muted — which is the failure it was written to prevent.
Note
The issue closes itself when everything is green, so it should clear on the next nightly if both fixes hold. Worth watching the next
compat.ymlscheduled run to confirm the job completes and publishes.