Repository navigation
fix(ci): skip the backend gate on a zero-file PR, and fail it instead - #793
Merged
Merged
Conversation
A pull request that changes no files ran the whole Rust gate — lint, entities, every test shard, cargo-deny and both DuckLake e2e matrices — to prove a tree identical to `main`. ~10m of wall clock across the compile matrix and ~0.6 GB of sccache S3 egress per run, for nothing. `claim-ticket` opens exactly that shape on purpose: a draft PR pushed from an empty commit, so a ticket claim is visible on GitHub before any code exists. Every claim paid the bill. The cause is that `rust.yml`'s is the only `detect` in the repo built as a DENYLIST, and an empty path list inverts through it. The counting pipelines re-expand the changed list with `printf '%s\n' "$changed"`, which for an empty string emits ONE BLANK LINE; a blank line matches no exemption, so `grep -cv` reported one non-exempt path and `detect` classified `code=true erd=true drift=true`. The four allowlist detects — frontend, infra, images, devcontainer — never had the bug, because zero paths is zero matches there; measured, those four already skipped. `detect_classify` now guards the case ahead of the counting, and the test is a plain `-z` because `changed="$(cat)"` has already dropped the trailing newline. An empty `base...head` means head's tree equals the merge base, so the skip is safe in the direction that matters: there is provably nothing to compile. A skip alone would leave such a PR GREEN, with every required context satisfied having proved nothing, so `detect` also publishes `empty` and a new `empty pull request` job fails on it. It is deliberately NOT a required status check: a draft is already unmergeable, adding a required context is only safe after the job has reported on `main`, and non-required is what lets the red clear itself — the first real commit flips `empty` to false and the gate takes over. Mutation-tested: neutering the guard fails exactly the new case (pass=35 fail=1), and HEAD's classifier really does answer `code=true` on an empty diff. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Two of these three are PRE-EXISTING DRIFT ON `main`, not a consequence
of this branch. `a241585b` ("enable skill") set
`disable-model-invocation: false` on `claim-ticket` without re-running
the generator, so the skill-inventory rows in `CLAUDE.md` and the
agent-skills standard still carry the `(user-invoked only)` tail the
generator now drops. Verified against an untouched `git archive` of
`origin/main`: regen there changes exactly those two lines, so the
required `lint` job's drift step is red on `main` and every branch cut
from it inherits that.
The third, `required-checks.md`, IS this branch's: its generated table
enumerates every job in every hand-written workflow, so the new
`empty pull request` job has to appear in it.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This was referenced Nov 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A pull request that changes no files ran the entire Rust gate —
lint,entities, everytestshard,cargo-denyand both DuckLake e2e matrices — to prove a tree byte-identical tomain. ~10m of wall clock across the compile matrix and ~0.6 GB of sccache S3 egress per run, for nothing.claim-ticketopens exactly that shape on purpose: a draft PR pushed from an empty commit, so a ticket claim is visible on GitHub before any code exists. Every claim paid that bill.Why it happened
rust.yml's is the onlydetectin the repo built as a denylist, and an empty path list inverts through it. The counting pipelines re-expand the changed list withprintf '%s\n' "$changed", which for an empty string emits one blank line; a blank line matches no exemption, sogrep -cvreported one non-exempt path:The four allowlist detects —
frontend,infra,images,devcontainer— never had the bug, because zero paths is zero matches there. Measured: those four already skipped a zero-file PR correctly, sorust.ymlwas the whole cost.The change
detect_classifyguards the empty case ahead of the counting. The test is a plain-zbecausechanged="$(cat)"has already dropped the trailing newline — an empty stdin and a single-newline stdin both arrive as the empty string. The compile jobs then reportskipped, which branch protection accepts, same as a skills-only PR.Safe in the direction that matters: an empty
base...headmeans head's tree equals the merge base, so there is provably nothing to compile.A new
empty pull requestjob fails on it. The skip alone would leave such a PR green, with every required context satisfied having proved nothing.detectpublishesemptyas its own output because the two answers go to opposite places: the compile tier skips, this job fails.Deliberately not a required status check. A draft is already unmergeable so there is nothing for it to block; adding a required context is only safe after the job has reported on
main; and non-required is what lets the red clear itself — the first real commit flipsemptyto false, the job skips, and the gate takes over.Verification
detect-paths-test.sh: 36/36, with the newa pull request that changes nothingcase.[ -z "$changed" ] && falsefails exactly one case (pass=35 fail=1), so the guard is load-bearing rather than decoration.rust-detect.shdriven end-to-end on all three events: empty PR →code=false empty=true; this branch vsmain→code=true empty=false;push→code=true empty=false.workflow-shell-check(the 2-linerun:is inside the 3-line budget, no control flow),actionlint+ S9 pins (438uses:, all pinned — the new job adds none, it needs no checkout),scripts-home-check,skills-check.One unrelated commit, and why it is here
4699821cregenerates two skill-inventory blocks that are already stale onmain:a241585b("enable skill") setdisable-model-invocation: falseonclaim-ticketwithout re-running the generator. Verified against an untouchedgit archiveoforigin/main— regen there changes exactly those two lines, solint's drift step is red onmainand every branch cut from it inherits that. It cannot be separated out without leaving this PR red.The third file in that commit,
required-checks.md, is this branch's: its generated table enumerates every job in every hand-written workflow, so the new job has to appear there.