Skip to content

fix(ci): refuse a PR whose detect jobs died — its green verified nothing - #490

Merged
athvin merged 1 commit into
mainfrom
bm/ci-merge-bus-detect-failed
Nov 5, 2026
Merged

athvin merged 1 commit into
mainfrom
bm/ci-merge-bus-detect-failed

Conversation

@athvin

@athvin athvin commented Nov 5, 2026

Copy link
Copy Markdown
Owner

A green that verified nothing

skipped is only trustworthy when the job that decided to skip SUCCEEDED.

Every expensive job is gated on needs.detect.outputs.*. When a detect job fails, its dependents report skipped — and branch protection accepts skipped as satisfied. So a PR can show all twelve required contexts satisfied with not one of them having run.

Found on #473 while hunting for a merge-bus candidate:

  • two Rust files changed (er-cli/src/lib.rs, er-cli/tests/lake_e2e.rs)
  • all three detect jobs failure — starved in the Actions-minutes outage, steps=0
  • all 12 required contexts skipped
  • mergeStateStatus: CLEAN

It was mergeable, by hand or by the bus, with nothing compiled or tested. I scanned every open PR: #473 is the only one left in that state, because the others have been pushed to since.

This is a known failure mode arriving by a new route

It's the same "a false skip is the worst failure mode available" that the grep -c-not-grep -q rule exists for. There the detect job lies; here it dies. Same consequence.

It also defeats the aggregator gates. test and DuckLake + extensions e2e carry if: !cancelled() && needs.detect.outputs.code == 'true' — with detect failed that output is empty, so the gate is skipped before its fail-closed case can run. The aggregator pattern assumes detect succeeds.

Why not just require the detect contexts

Three jobs under two names (detect changes ×2, detect infra changes), and a required context that legitimately doesn't report blocks every PR forever — the exact trap the plan (<env>) episode already cost. Checking at the point of use is cheap and precise:

gh api repos/:owner/:repo/commits/<head_sha>/check-runs --paginate \
  --jq '[.check_runs[]|select(.name|startswith("detect"))|select(.conclusion=="failure")]|length'

The bus now does this and refuses such a candidate, naming the remedy:

#109   skip   its detect jobs failed, so every gate reported skipped
               without running — re-run CI before batching

Also in here

The skill section hit the enforced 500-line body limit (527). The merge-bus detail moved to references/merge-bus.md (105 lines, with the ## Contents a long reference requires), leaving a tight summary and a link — the repo's own convention rather than trimming prose.

Verification

Simulator scenario detect-died: the unverified candidate is skipped with its reason, the genuinely-verified members still ride, the unverified one is never merged. Mutation-tested by deleting the check — caught. Suite now 67 assertions. skills-check all → exit 0.

Operational note

Anyone merging by hand after an Actions outage should run the query above first. A PR whose CI was starved reads green.

🤖 Generated with Claude Code

`skipped` is only trustworthy when the job that decided to skip SUCCEEDED.

Every expensive job is gated on `needs.detect.outputs.*`. When a `detect` job
FAILS, its dependents report `skipped` — and branch protection accepts `skipped`
as satisfied. So a PR can show all twelve required contexts satisfied with not
one of them having run.

Found on #473 while looking for a merge-bus candidate: two Rust files changed,
all three detect jobs failed in the Actions-minutes outage, all 12 required
contexts `skipped`, `mergeStateStatus` CLEAN. It was mergeable — by hand or by
the bus — with nothing compiled or tested. A scan of every open PR found it was
the only one left in that state; the others had been pushed to since.

This is the same "a false skip is the worst failure mode available" that the
`grep -c`-not-`grep -q` rule exists for, reached by a different route: there the
detect job lies, here it dies. It also defeats the aggregator gates, since
`test` and `DuckLake + extensions e2e` gate on `needs.detect.outputs.code ==
'true'` and an empty output skips the gate before its fail-closed `case` can run.

Requiring the detect contexts in protection is not the fix — three jobs under
two names, and a required context that legitimately does not report blocks every
PR forever. Checking it at the point of use is cheap and precise, so the bus now
reads the candidate's check-runs and refuses one whose detect jobs concluded
`failure`, naming the remedy ("re-run CI before batching").

Simulator covers it as `detect-died`: the unverified candidate is skipped with
its reason, the genuinely-verified members still ride, and the unverified one is
never merged. Mutation-tested by deleting the check. Suite now 67 assertions.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin force-pushed the bm/ci-merge-bus-detect-failed branch from 4c354f4 to 7fea3f1 Compare November 5, 2026 11:36
@athvin

athvin commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto main (2d2a0fcd), which now carries the RUSTSEC-2026-0441 ignore — so the cargo-deny red here was never this diff.

I'd opened #492 for that advisory before noticing another session had landed the same fix concurrently. Closed it as redundant: main's justification is the better of the two (it also drops the stale "two entries" count, and adds that core::pin::pin! has been stable since 1.68, that the crate parses no input and touches no network, and that pinning the AWS crates back would trade an unmaintained-notice for real missed security updates in credential-handling code).

Local gates after the rebase: skills-check all exit 0, skill body 482 lines (under the 500 limit), merge-bus suite 67/67.

@athvin
athvin merged commit 8482454 into main Nov 5, 2026
39 checks passed
athvin added a commit that referenced this pull request Nov 5, 2026
… not data (#543)

The third live attempt at a real landing was refused:

    #510   skip   its detect jobs failed, so every gate reported skipped
                   without running — re-run CI before batching

#510 was fine. All three of its detect jobs had completed `success` twenty
minutes earlier and the PR was CLEAN; the `14:18:16` timestamp that looked like
a push was `updated_at` moving when the `merge-bus` label was added.

The check I added in #490 was this:

    [ "$(gh api ... --paginate --jq '...|length' 2>/dev/null || echo 0)" != "0" ]

`--paginate` emits one jq result per page and `|| echo 0` appends another on
failure, so a call that emits a page and THEN errors — a secondary rate limit
being the obvious candidate, given how many calls this loop makes per
candidate — yields the two-line string "0\n0", which is `!= "0"`. A healthy PR
is then refused as unverified. This is exactly the defect the pre-flight was
fixed for in #482, reintroduced here one commit later.

Replaced with a `detect_failures` function that reads the status explicitly,
requires one line of three bare integers, and FAILS OPEN on anything else —
consistent with the pre-flight, because `mergeStateStatus == CLEAN` remains the
gate and a rate limit must not block every merge. It also compares `total_count`
against what it fetched, so a commit with more than a page of check-runs says so
instead of answering from a prefix.

Two further traps hit while fixing it, both the same shape as the original:

Whitespace-collapsing is NOT a fix. `"0\n0"` with the newline stripped is
`"00"` — still numeric, still `!= "0"`.

And the function's own warnings went to STDOUT, so `$(detect_failures …)`
captured the warning text along with the count and skipped the PR anyway. A
function whose stdout IS its return value must put diagnostics on stderr. My
isolation test printed the warning and I read it as informational rather than as
contamination; the simulator scenario is what caught it.

Covered by `detect-read-flaky`, which asserts a healthy PR still rides when the
check-runs read emits output and then fails. Mutation-tested both ways: putting
the warnings back on stdout is caught, and restoring the original one-liner is
caught. `detect-died` still skips, so the real guard is intact. Suite now 72
assertions.

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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