ADR-0050: A pull request is read against the branch it merges into
Status: Accepted Date: 2026-11-01 Amends: 0022: its CODEOWNERS base Amends: 0040: its lowered-floor base
Context
What the gate reads a pull request against, read at source:
-
The base branch in ADR-0003. A pull request that lowers a floor has to carry
loweredagainst the base branch’s baseline. -
The default branch in the code. The lowered-floor check (ADR-0040’s decision 5), the base CODEOWNERS is read at (ADR-0022), the fallback of
last-runoff the default branch, and the lines a pull request’s new code is judged on where the run does not know them all readorigin/<default branch>. -
The CI templates fetch the target. The Bitbucket, Jenkins, Azure and Buildkite templates fetch the branch a pull request merges into and pass it as
--changed-since, and the GitHub action passes the pull request’s base (ADR-0005). So a pull request intorelease/2.xis mutated for its change againstrelease/2.x, but its floors, its owners and its new code are read against the default branch, which the checkout may not have fetched. -
What each CI names.
CI The branch a pull request merges into GitHub Actions the event payload’s pull_request.base.ref, andGITHUB_BASE_REFGitLab CI_MERGE_REQUEST_TARGET_BRANCH_NAMEBitbucket Pipelines BITBUCKET_PR_DESTINATION_BRANCHAzure DevOps SYSTEM_PULLREQUEST_TARGETBRANCH, asrefs/heads/<branch>Jenkins CHANGE_TARGETBuildkite BUILDKITE_PULL_REQUEST_BASE_BRANCHCircleCI none
Decision
This amends ADR-0022’s decision on the CODEOWNERS base and ADR-0040’s decision 5.
- A run on a pull request knows the branch it merges into, where its
CI names it, as the table above reads it. The plan records it as
target, so every shard and the verdict read the same branch. - A pull request is read against that branch, fetched from
origin:- the baseline a lowered floor is checked against, in the file that branch’s own config names;
- the CODEOWNERS file its survivors are routed by;
- the lines its new code is judged on, where the run does not know them;
- the change
last-runfalls back to.
- Every other run is read against the default branch, as before, and so is a pull request whose CI names no branch it merges into.
Alternatives considered
| Option | Why it lost |
|---|---|
| The default branch for every pull request | A pull request into a release branch is held to another branch’s floors and owners, and read against a branch its checkout may not have fetched. |
| A config key naming the branch to read against | One key for every pull request, where each names its own target. |
The merge base of HEAD and the target, computed by git | The baseline and CODEOWNERS are read as the target holds them now, which is what the merge lands on. |
Consequences
A pull request into a release branch is judged against that branch’s floors and owners.
A CircleCI pull request is read against the default branch, since CircleCI names no target.