Skip to content

fix(ci): run CI on a pull request whose base is not main (#512) - #526

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/512-ci-on-stacked-prs
Sep 18, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/512-ci-on-stacked-prs

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Closes #512.

The defect

ci.yml and security.yml both filtered their pull_request trigger on branches: [main]. A pull
request stacked on a feature branch therefore started none of their jobs — not test, not
lint, not coverage, not Security Scan, not one of the twelve build-tags/cross-build cells.

Nothing failed, and that is what made it invisible. The checks never existed, so gh pr checks
returned a single row — dependabot skipping, the one workflow with no base filter — and the pull
request read as green because nothing was red rather than because anything passed. #511 was reviewed
in exactly that state.

The window also closes at precisely the moment it stops being useful: GitHub retargets a stacked pull
request to main when its parent merges, so CI first runs after review has already happened against
zero signal. The gap is invisible while it matters and gone by the time anyone would look for it.

Beyond the issue's scope

#512 names ci.yml only. security.yml carried the same filter, and it matters more there:
Security Scan is a required status check on main, so the trigger being filtered out meant a
check that is supposed to be able to block a merge could not report at all on a stacked PR.

The push trigger keeps its branches: [main] in both files. That is a different question with a
correct answer — it stops a feature-branch push from duplicating the pull request's own run — so it is
left alone rather than removed for symmetry.

The test

TestNoPullRequestTriggerFiltersItsBaseBranch walks .github/workflows/ and fails on a branches:
or branches-ignore: filter under pull_request or pull_request_target.

Walked rather than enumerated on purpose: naming ci.yml and security.yml checks the two files that
already had the bug, while the next workflow to arrive with branches: [main] copied out of a README
is the case a hard-coded list cannot see. It carries a floor on the file count (< 4 fails) and a
non-vacuity guard on the trigger count — the latter because yaml.v2 parses the key on as the
boolean true, not the string "on", so a map[string]any lookup finds nothing and passes every
file without inspecting one.

Verification

The test passes (checked 3 pull-request triggers across 5 workflow files), and five mutations were
run against it, each of which it caught:

mutation result
M1 restore branches: [main] on ci.yml's pull_request caught, names ci.yml
M2 restore it on security.yml caught, names security.yml
M3 branches-ignore: [docs/**] instead of branches: caught
M4 filter on pull_request_target (dependabot-automerge.yml) caught
M5 drop the true key from the on: lookup caught by the non-vacuity guard, rather than passing

M5 is the one worth having: without the guard it is the mutation that would have made this test
useless and green.

go test -race ./... passes for every package that builds on this machine. Six packages — cmd/objectfs,
internal/adapter, internal/metrics, sdks/c, sdks/go/objectfs, tests — fail to build locally
with runtime/cgo: You have not agreed to the Xcode license agreements, which is a local toolchain
state unrelated to this change and does not affect the Linux runners. CGO_ENABLED=0 go build ./... is
clean, golangci-lint reports 0 issues on internal/config, and every pre-commit hook passes except
the two that are blocked by the same cgo failure.

ci.yml and security.yml both filtered their pull_request trigger on
`branches: [main]`, so a pull request stacked on a feature branch started
none of their jobs — not test, not lint, not coverage, not Security Scan,
not one of the twelve build-tags/cross-build cells.

Nothing failed, and that is what made it invisible for as long as it
lasted. The checks never existed, so `gh pr checks` returned one row,
`dependabot  skipping`, and the pull request read as green because nothing
was red rather than because anything had passed. #511 was reviewed in that
state.

The window also closes at exactly the moment it stops being useful.
GitHub retargets a stacked pull request to main when its parent merges, so
CI first runs after review has already happened against zero signal — the
gap is invisible while it matters and gone by the time anyone would look.

security.yml is not named in #512 but carried the same filter, and it
matters more there: Security Scan is a required status check on main, so
the filtered-out trigger was a check that is supposed to be able to block
a merge and could not report at all.

The push trigger keeps its `branches: [main]` in both files. That one is a
different question with a correct answer — it stops a feature-branch push
from duplicating the pull request's own run — so it is left alone rather
than removed for symmetry.

TestNoPullRequestTriggerFiltersItsBaseBranch walks .github/workflows/ and
fails on a branches or branches-ignore filter under pull_request or
pull_request_target. Walked rather than enumerated on purpose: naming the
two files that had the bug checks the two files that had the bug, and the
next workflow to arrive with `branches: [main]` copied out of a README is
the case a hard-coded list cannot see. It carries a floor on the file
count and a non-vacuity guard on the trigger count, the latter because
yaml.v2 parses the key `on` as the boolean true — a map[string]any lookup
finds nothing and passes every file.
@scttfrdmn scttfrdmn added type: bug Something isn't working as expected priority: high Important issue that should be addressed soon area: ci-cd CI workflows, gates, and release automation labels Sep 18, 2026
@scttfrdmn
scttfrdmn merged commit c47eacf into main Sep 18, 2026
48 checks passed
@scttfrdmn
scttfrdmn deleted the fix/512-ci-on-stacked-prs branch September 20, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci-cd CI workflows, gates, and release automation priority: high Important issue that should be addressed soon type: bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI runs no jobs on a pull request whose base is not main, so every stacked PR is unverified at review time

1 participant