Learning center

Who should own lockfiles, generated code and vendored directories?

Give lockfiles to the team that owns dependency policy, and generated output to no one, with a check that regenerates it. Give vendored code to the team that runs vendor updates. An owner asked to approve thousands of lines they cannot read learns to approve without reading, a habit that can carry over to the code they should read.

Why these files are different#

A CODEOWNERS line asks its owner to judge a diff. That works for code a person wrote. It fails for three kinds of file that most large repositories contain: generated output, whose content is decided by a generator and its inputs; lockfiles, which record the dependency versions a tool resolved; and vendored directories, which hold a copy of another project's source. A directory pattern such as /services/payments/ catches all three when they live inside a team's tree, so the payments team is asked to approve a regenerated client or a lockfile change thousands of lines long.

Owners matter here for a specific reason. With code owner review required, "any pull request that modifies content with a code owner must be approved by that code owner." Require a pull request before merging A path with no owner can instead be approved by "any user who has write access to the repository." About code owners: example file The choice for each kind of file is who, if anyone, adds information by approving it.

How public projects assign them#

Grafana gives its Go module files no owner, with the reason in a comment: "Reviewers come from // @team comments via .github/workflows/modowners-reviewers.yml. Empty owners so GitHub does not request a squad." grafana/grafana .github/CODEOWNERS, read on 2026-11-23.

/go.mod
/go.sum

The same file has a section headed "Generated files not requiring owner approval," which assigns generated feature toggle files to a bot account rather than a squad, for example /pkg/services/featuremgmt/toggles_gen.go @grafanabot. Its JavaScript lockfile goes to the frontend platform team: /pnpm-lock.yaml @grafana/grafana-frontend-platform. Vendored packages sit under a "Vendored" heading with the same team as owner.

Kibana marks generated files as unowned and names what covers them instead:

# No owner - generated files covered by CI checks
**/moon.yml

elastic/kibana .github/CODEOWNERS, read on 2026-11-23. CPython's exclusions section removes owners from its Argument Clinic output directories, such as Modules/**/clinic/, while the Argument Clinic tool itself, Tools/clinic/, keeps its maintainers. python/cpython .github/CODEOWNERS, read on 2026-11-23. Sentry assigns package.json and pnpm-lock.yaml to a dedicated @getsentry/owners-js-deps team, and writes a bare line with no owner for a generated file, knownSentryApiUrls.generated.ts, under the comment "This file is auto-generated on endpoint changes." getsentry/sentry .github/CODEOWNERS, read on 2026-11-23.

These files follow a common pattern. Generated output loses its team owner, and the generator keeps one. Dependency manifests and lockfiles go to a platform or dependency team, not to whichever team's directory they sit in.

A fictional repository#

Suppose the fictional acme/shop repository has an OpenAPI spec, a client generated from it, a lockfile and a vendored copy of a small parsing library:

*                               @acme/platform
/api/                           @acme/api
/web/                           @acme/web

# Dependencies: owned by the team that sets dependency policy.
/package.json                   @acme/deps
/pnpm-lock.yaml                 @acme/deps
/third_party/                   @acme/deps

# Generated from api/openapi.yaml by tools/gen-client. The check
# "generated-client" regenerates and fails on any difference.
/web/src/client/

A change to api/openapi.yaml requests @acme/api, who reviews the contract. The regenerated client under web/src/client/ requests nobody. A dependency bump requests @acme/deps for the lockfile and @acme/web only if the bump also touches code in web/. The generator, tools/gen-client, falls to the default owner, @acme/platform.

The empty line is only half of the arrangement. The other half is a required status check that runs the generator and fails when the committed output differs:

name: generated-client
on: pull_request
permissions:
  contents: read
jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: ./tools/gen-client api/openapi.yaml web/src/client
      - run: |
          git add --intent-to-add -- web/src/client
          git diff --exit-code -- web/src/client

The git add --intent-to-add line makes the diff include files the generator creates that were never committed; without it, git diff ignores untracked files, and a pull request that leaves out a generated file would pass.

Without that check, the empty line lets anyone with write access hand-edit the generated client and merge it with one unrelated approval.

What these choices do not catch#

An unowned generated directory with a regeneration check proves only that the output matches the generator. It says nothing about whether the generator or its input is right, which is why both keep owners. Lockfile ownership routes the review to people who know the dependency policy, but a lockfile diff shows version numbers and hashes, not the code those versions bring in. Reviewing what a new dependency version does needs other tools, and dependency bot pull requests raise their own questions about which updates need a person at all.

What each choice costs#

A dependency team on every lockfile is a queue on every dependency change in the repository. In a monorepo with frequent bumps, that team needs enough members, or auto assignment, to keep up. Removing owners from generated output costs a CI job per pull request and the discipline to keep the generator owned. Leaving everything with directory owners costs the most, though it never shows up as a blocked merge: teams approve generated diffs without reading them, and that habit can carry over to the diffs they should read.

The decision#

Search your CODEOWNERS for the directories that hold generated output, lockfiles and vendored code, and check which team each one falls to. Then:

  1. Give generated output an empty line, placed after the directory line it overrides, with a comment naming the generator and the check that covers it. Leaving a path unowned explains the ordering.
  2. Add the regeneration check as a required status check before you remove the owner, not after.
  3. Give manifests, lockfiles and vendored directories to the team that decides dependency policy.
  4. Keep the generator, its templates and its input owned by the team that maintains them.

One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. Eligibility and fair-use terms.

Start free with GitHub

Related reading