The file that looks like a promise

Somewhere in your repository sits a file that reads like an oath. Names and teams line up beside paths, a green merge button glows above them, and a release note announces that “the owners reviewed it.” Everyone nods. Almost no one checks. The file is a routing table wearing a badge — and a routing table, however tidy, is not a witness.

GitHub’s CODEOWNERS mechanism does one job well: it lets a repository declare who is responsible for which code, then uses that declaration to send review requests when a qualifying pull request touches owned paths. That is genuinely useful machinery. What it is not is a historical record — not of who was selected for a given pull request, not of whether the eligible person received or finished a review, and not of whether every other condition for merge was ever satisfied. Treating a rule file as proof of an event is how configuration quietly acquires authority it never earned.

The short version

  • CODEOWNERS is a branch-scoped path-routing rule. It can trigger review requests to named owners when a qualifying pull request changes owned code — nothing more.
  • The result depends on the base-branch file, location precedence, path matching, line order and current owner eligibility. A file on screen today is not proof of the rule result for a pull request from last quarter.
  • A real review receipt keeps the base and head references, the changed paths, the applicable CODEOWNERS snapshot, the resolved owners, the request and review events, and separately evidenced merge controls. It is an editorial evidence pattern, not a GitHub requirement.

A routing rule has a time and a scope

“The owners reviewed it” conceals a stack of questions. Which branch supplied the ownership policy? Which files actually changed? Which pattern won? Were the named people or team eligible at that moment? Was a request sent, was a review submitted, and did a separately configured rule require that review at all? A repository browser will happily show a reassuring ownership label while answering exactly one of those questions.

GitHub’s own documentation is refreshingly blunt that CODEOWNERS is configuration. It defines people or teams responsible for code, and when a non-draft pull request changes owned code, GitHub automatically requests review from the applicable owners. Draft pull requests are the exception: they do not automatically request owners until they are marked ready for review. Useful routing — but routing is not an attestation that the recipient acted.

The rule also has a branch, and the branch has a memory. GitHub says each CODEOWNERS file assigns owners for a single branch, and that review requests use the version on the pull request’s base branch. A change aimed at main can resolve under a different ownership map than an identical change aimed at a maintenance branch. For a pull request from a fork to an upstream base, the upstream base branch supplies the file. A copy from the head branch, or a later file shown on the default branch, cannot substitute for that fact.

Location is part of the rule too. GitHub searches .github/, then the repository root, then docs/, and uses the first CODEOWNERS file it finds. The file must also be loadable: the documentation states a three-megabyte limit, and an oversized file simply does not load — ownership information is not shown and the appropriate owners are not requested. These are not exotic footnotes. They are the difference between a policy text that exists in a repository and a policy text that governed a particular event.

The last match changes the responsible surface

Pattern files look additive even when the resolution is selective. GitHub says that if the same pattern is assigned on separate lines, only the last-mentioned owner matches. Its own example makes the consequence plain: a general * owner can be displaced by a later *.js owner for a JavaScript-only change. Put two owners on the same pattern line and both are owners; put them on successive matching lines and the later line wins. A reviewer who cites the general line without reconstructing the later match is quoting a policy that never applied.

The constraints keep coming. Patterns are case-sensitive because GitHub evaluates them on a case-sensitive file system. An invalid line is skipped. A user or team that does not exist, or lacks sufficient access, is not assigned. A visible file can therefore contain a familiar name without producing a valid owner resolution. None of this implies a fault in any particular repository. It means configuration has conditions, and a conclusion about an event needs evidence of those conditions — not an unclipped screenshot of one file.

There is a security implication tangled into the audit one. GitHub recommends defining an owner for the CODEOWNERS file itself, to protect against unauthorized changes to the policy that selects every other owner. That recommendation quietly exposes the recursive governance problem: an ownership rule governs application code only if its own alteration path is legible. A repository that says “these are the owners” must also be able to show who could rewrite that sentence, under which base branch, and behind which controls.

Request, approval and merge are three different records

GitHub separates automatic review requests from a requirement that code owners approve before merge. Administrators or owners can opt into the latter. When that requirement applies, approval from any listed owner is enough for a pattern with several owners. The word “can” is doing real work: a CODEOWNERS file alone does not turn its owners’ review into a mandatory gate.

Nor does a code-owner approval exhaust a branch’s controls. GitHub’s rulesets can run alongside branch protection; applicable rules aggregate, and the most restrictive version of a shared rule wins. A ruleset can separately require a pull request, a set number of approvals, code-owner approval, status checks, a successful deployment, resolved comments or a specific merge method. Bypass permissions are yet another separately configured surface. GitHub even notes that an otherwise fully approved pull request can stay blocked when another open pull request at the same head commit carries a pending or rejected review.

None of this makes approval symbolic. An approval is a real review disposition — GitHub describes it as signalling that the changes are ready to merge. The discipline is simply to keep the qualifier attached. Ready according to whom, for which diff, under which review policy, and alongside which remaining gates? Those questions are not hostile to review. They stop a bounded technical judgment from being retold as a complete history of authority.

Preserve a configuration-to-review receipt

For any consequential claim, the smallest useful record is a configuration-to-review receipt. It opens with the pull request identifier, the base and head commit or tree references, and the changed path set. It then preserves the applicable base-branch CODEOWNERS location and content identity — not a pointer to the file as it appears today. It states the matching rule or rules and the resolved owner set, including any known absence of eligibility.

The next layer is event evidence: the review-request event, the reviewer’s response, its timestamp, and the diff or commit it covered. A request should never be written as a review; a review should never be written as a successful gate. If a statement climbs all the way to merge readiness, it must name the applicable protection and ruleset conditions, their observed states, and any documented bypass. Where no evidence exists for a handoff, the public account should stop there.

The receipt creates no new authority. It makes existing boundaries reconstructable. The point is not to turn every pull request into legal paperwork; it is to avoid the cheaper fiction in which a static file, a notification and a green label get compressed into “the owners approved the change” long after the branch and the diff have moved on.

Sources

  1. GitHub Docs — About code owners
  2. GitHub Docs — Pull request reviews
  3. GitHub Docs — About rulesets
  4. GitHub Docs — Available rules for rulesets