Skip to content

ci(compat): block on BQL query regressions - #1533

Merged
robcohen merged 2 commits into
mainfrom
chore/compat-regression-gate
Jun 23, 2026
Merged

robcohen merged 2 commits into
mainfrom
chore/compat-regression-gate

Conversation

@robcohen

Copy link
Copy Markdown
Member

What

Makes the Compatibility check block on BQL query regressions. Today the compat job records results but never exits non-zero — which is how #1506 dropped BQL JOURNAL from 90/90 → 12/90 (BQL compat 93%→77%) and still merged.

How

  • scripts/compat-bql-test.py gains --baseline <prev-results.jsonl>. After the run it compares against the baseline and exits non-zero if any (file, query) pair that matched in the baseline now fails — a true→false regression. The CI annotation lists exactly what regressed (REGRESSED: <query> | <file>).
  • compat.yml fetches main's compat-bql-results.jsonl from the compatibility branch and passes it as --baseline.

Why per-pair, not percentage: comparing the overall % is fragile when the corpus or the eligible-file set changes. Per-(file, query) only flags an actual result flip — a pair that drops out of the run (coverage change) or a brand-new failure (never passed before) is not counted. Verified with a standalone test (catches the flip; ignores coverage-drops and new failures).

Safety / ordering

  • On PRs: a regression fails the BQL step → red check → blocks merge. The baseline-commit step is already if: github.event_name != 'pull_request', so PRs never write the baseline.
  • On main / nightly: a regression fails the job before the later "Commit results to compatibility branch" step, so a regression is not blessed into the baseline (the next run still compares against the last-good baseline).
  • First run after merge: main is at ~93% (post-JOURNAL-fix) vs a ≤93% baseline → only improvements (false→true), no regressions → gate passes and the baseline advances.

Scope note

This gates BQL query regressions (the JOURNAL class). The file-level regression_count is also computed but is intentionally not gated here — synthetic test files are regenerated each run, so a hard file gate needs determinism handling first. Tracked as a follow-up.

🤖 Generated with Claude Code

The Compatibility job recorded results but never failed, so #1506 dropped BQL
JOURNAL 90->12 and merged unblocked. Add --baseline to compat-bql-test.py: exit
non-zero if any (file, query) pair that matched on the baseline now fails (a
true->false flip; robust to corpus/coverage changes). compat.yml fetches mains
BQL results as the baseline and passes --baseline. Baseline-commit is already
PR-gated and runs after, so a regression is never blessed into the baseline.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI review requested due to automatic review settings June 23, 2026 01:58
@robcohen
robcohen requested a review from a team as a code owner June 23, 2026 01:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes the Compatibility CI job fail (exit non-zero) when there are BQL query regressions compared to a stored baseline, preventing “recorded but non-blocking” BQL drops from merging.

Changes:

  • Adds --baseline <prev-results.jsonl> to scripts/compat-bql-test.py and implements a per-(file, query) true→false regression gate that exits non-zero and emits CI error annotations.
  • Updates .github/workflows/compat.yml to download compat-bql-results.jsonl from the compatibility branch and pass it as --baseline to the BQL compat step.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
scripts/compat-bql-test.py Adds baseline-driven regression detection and failing exit code for per-pair BQL regressions.
.github/workflows/compat.yml Fetches the baseline BQL results from the compatibility branch and wires it into the BQL compat step.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/compat-bql-test.py Resolved
Comment thread .github/workflows/compat.yml Resolved
@github-actions

github-actions Bot commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ Compatibility Test Results

Metric Result
Check Compatibility 100%
BQL Compatibility 100%
Full AST Match 100%
Total Files 792
What's tested
  • Check: Exit codes and error counts match bean-check
  • BQL: Query results match bean-query
  • Files: ~800 test files downloaded from 10+ beancount repositories

Full results available in workflow artifacts

Copilot on #1533: a truncated/corrupt baseline JSONL line crashed json.loads
with a traceback. Skip unparsable lines; a wholly-unparsable baseline yields an
empty passing-set (no gate that run) rather than a spurious block.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@robcohen
robcohen merged commit f83d2d9 into main Jun 23, 2026
48 checks passed
@robcohen
robcohen deleted the chore/compat-regression-gate branch June 23, 2026 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants