Skip to content

ci: validate main after every merge and require branches up to date before merging (#679) - #685

Merged
bpalermo merged 1 commit into
mainfrom
ci/679-post-merge-main-validation
Sep 5, 2026
Merged

bpalermo merged 1 commit into
mainfrom
ci/679-post-merge-main-validation

Conversation

@bpalermo

@bpalermo bpalermo commented Sep 5, 2026

Copy link
Copy Markdown
Owner

The merge-skew instance

PR CI validates a PR head against that PR's merge-base. Nothing validated main after a merge. Two PRs that each pass against their own base can therefore combine into a state neither was ever tested in:

commit change registrations at CI time CI
#671 763f5b3 +1 (spiffe_id_override_rejected) 15 pass
#672 head f5d540a branched before #671 merged; +2 onto a file at 13 15 pass
#672 squash cf68f1b main = #671 + #672 16 (limit 15) never run

newCNIMetrics landed on main at gocognit 16/15 and no PR ever failed for it. It surfaced days later on two unrelated PRs — #676 (mesh-dns forward pool) and #677 — because //agent/internal/cni/server:server is in their reverse-transitive impact set via xds/cache. Cleared by #678; the class remained.

What this PR adds — main-post-merge (the detector)

New .github/workflows/main.yaml, workflow name main-post-merge, jobs diff + test. On every push to main it runs the same legs ci.yaml's test job runs:

Impact set = the merge commit vs its first parent (HEAD^), i.e. exactly what the merge added to main, evaluated against the tree that now exists. scripts/ci-impacted-targets.sh already falls back to a full //... build+test whenever bazel-diff cannot compute a set (no first parent, unreachable base, tool failure), so main is never silently under-validated.

Constraints preserved:

  • RBE via BuildBuddy: --config=ci → --config=remote; the same --remote_header=x-buildbuddy-api-key is passed on build and test.
  • Tests stay local — unchanged mechanism: build:remote --strategy=TestRunner=local in .bazelrc. Nothing here overrides it.
  • The pull_request path is untouched. ci remains the only required status check; this workflow reports nothing required, so a red main-post-merge is a red main, not a blocked PR.
  • No coarse paths-filter job: there is no required check to keep reporting on this trigger, and a proxy-only merge yields an empty impact set anyway (proxy/ is a sibling workspace outside //...), so test just skips.
  • integration / e2e are not repeated: e2e.yaml already covers main pushes.

scripts/ci-impacted-targets.sh

Read it — it takes BASE_SHA/HEAD_SHA from the environment and never computes a merge-base itself, so there was no functional PR assumption to fix. Its docs did assume one; retitled for the two callers. One real fix: .github/workflows/main.yaml added to the seed-file list, so editing the new workflow forces a full run, same as ci.yaml.

Dry run

BASE_SHA=a3cde6c^ HEAD_SHA=a3cde6c (the squash of #681) against the modified script:

  output: has_any=true
  output: has_unit=true
  output: has_integration=true
  output: has_e2e=false
>> impacted: build=33 unit=8 integration=1 e2e=false

The build set is exactly the packages #681 touched plus their reverse deps:

//agent/internal/cmd:cmd            //agent/internal/cni/server:server
//agent/internal/cniconflist:...    //agent/internal/node:node
//agent/cmd/agent:agent (+ image targets)
//charts/aether:...  //website:site  //:website_docs

unit = agent/internal/{cmd,cniconflist,cni/server,node} tests + agent/cmd/agent:image_test + chart lint/template + website:site_test; integration = //agent/internal/cni/server:server_integration_test.

actionlint v1.7.7 on the new file: clean (exit 0). Over all workflows it reports only the two pre-existing github.head_ref findings in ci.yaml and proxy.yml, untouched here.

Part B — branch protection (settings change, not code)

The issue's recommended fix is required_status_checks.strict = true ("require branches up to date before merging"). Findings:

  • repos/bpalermo/aether/branches/main/protection returns 404 Branch not protected — main is guarded by a repository ruleset (main, id 12650911, ~DEFAULT_BRANCH, enforcement active), not legacy branch protection. The PATCH in the issue therefore 404s.
  • In the ruleset, the equivalent field is already set: required_status_checks.strict_required_status_checks_policy: true, with contexts ci and proxy (unchanged, not touched). Also do_not_enforce_on_create: true, plus deletion, non_fast_forward, required_linear_history, and pull_request (1 approval, code-owner review, squash only).
  • So why did the skew still happen? bypass_actors: [{actor_id: 5 (RepositoryRole = admin), bypass_mode: "always"}], and current_user_can_bypass: "always". Rule-suite history confirms it: every recent push to refs/heads/main, including a3cde6c, e1b6557, 623c254, is recorded with result: bypass. The strict up-to-date requirement is configured but never evaluated for the only person who merges.

No protection field was changed: strict was already true, and narrowing bypass_actors is a different field and a policy call for the repo owner. To actually close the class, the admin bypass has to go (Settings → Rules → main → Bypass list → remove "Repository admin", or set its mode to "Pull requests only"); until then this PR's main-post-merge job is the working half — it turns the skew into an unmistakable red run on main instead of a mystery failure on a bystander PR days later.

Closes #679

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

…efore merging (#679)

PR CI validates a PR head against that PR's merge-base, and nothing validated
main after a merge. Two PRs that each pass against their own base can combine
into a state neither was ever tested in — #671 and #672 each added CNI metric
registrations against a base without the other, and the second squash put
newCNIMetrics at gocognit 16/15 on main, surfacing days later on the unrelated
PRs #676/#677.

Add .github/workflows/main.yaml (`main-post-merge`): on every push to main it
runs the same build+lint+unit-test leg ci.yaml runs, with the bazel-diff impact
set computed as the merge commit vs its first parent (HEAD^), falling back to a
full //... build+test when bazel-diff cannot compute it. --config=ci implies
--config=remote, which pins TestRunner to the local strategy, so tests stay
local exactly as they are on the PR path. The pull_request path is untouched
and `ci` remains the only required status check.

ci-impacted-targets.sh never assumed a PR merge-base functionally, but its
docs did; retitle them for the two callers and add the new workflow to the
seed-file list so editing it forces a full run.

The preventive half — branch protection required_status_checks.strict — is a
repo settings change applied alongside this PR, not code.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant