Skip to content

ci: Publish a nightly code-ownership map - #1114

Open
ellemouton wants to merge 1 commit into
mainfrom
agent/code-owners-map
Open

ci: Publish a nightly code-ownership map#1114
ellemouton wants to merge 1 commit into
mainfrom
agent/code-owners-map

Conversation

@ellemouton

Copy link
Copy Markdown
Member

Adds a nightly workflow that measures who has been working on each package and
file in this repo — commits per author over a 12-month window — and commits the
result to .github/code-owners.json.

Why

It feeds issue triage. lumos has an assignment workflow (lightninglabs/lumos#766)
that routes a new issue to whoever owns the code it touches, and issues get filed
there that track work here — so it needs ownership data for this repo.

It fetches this published file rather than cloning and recomputing. A repo is
the only place that can authoritatively answer who works on its code, and doing
it elsewhere needed a cross-repo token to do something this repo can do for
itself. Hence: each repo publishes its own, nobody computes anyone else's.

The map is worth having independently too — its diff shows ownership moving
between people over time, and a wrong answer can be argued with in a PR rather
than rediscovered by hand.

Measurement choices worth reviewing

  • Packages are credited once per commit, not once per file touched, so one
    sweeping rename doesn't outweigh months of focused work.
  • Both per-package and per-file counts are kept, because they disagree often.
    Measured on the sibling repo, 28% of tracked files have a different top author
    than the package containing them — and the margin differs even where the winner
    doesn't.
  • Authors resolve through an explicit email→handle table, not name matching,
    which doesn't work on this history: one contributor's display name resembles
    their handle not at all, and two others each commit under more than one name.
    This table needs updating when someone joins or changes address.
  • Merge commits are excluded (they name whoever pressed the button), as are
    generated code and vendored trees.

Operational notes

  • Runs 03:42 UTC, an hour ahead of the consumer's 04:42 run, so the map it
    fetches is same-day rather than a day stale.
  • Opens a PR — it never pushes to a protected branch, and refuses at runtime
    if its branch is ever configured as one.
  • Most nights produce no diff and therefore no PR; ownership drifts slowly.
  • Needs BOT_GITHUB_TOKEN to exist in this repo, same as the other bot
    workflows. If it isn't set, the job fails at checkout.

🤖 Generated with Claude Code

Measures who has been working on each package and file in this repo --
commits per author over a twelve-month window -- and commits the result
to .github/code-owners.json.

It feeds issue triage. lumos runs an assignment workflow that routes a
new issue to whoever owns the code it touches, and issues are filed
there that track work here, so it needs ownership data for this repo. It
fetches this published file rather than cloning and recomputing: a repo
is the only place that can authoritatively answer who works on its code,
and computing it elsewhere would need a cross-repo token to do something
this repo can do for itself.

The map is also worth having on its own. Its diff shows ownership moving
between people over time, and a wrong answer can be argued with in a PR
rather than rediscovered by hand.

Two measurement choices worth knowing. Packages are credited once per
commit, not once per file touched, so one sweeping rename does not
outweigh months of focused work. And both per-package and per-file
counts are kept, because they disagree often -- measured on the sibling
repo, 28% of tracked files have a different top author than the package
containing them, and the margin differs even where the winner does not.

Authors are resolved through an explicit email-to-handle table rather
than by matching names, which does not work on this history: one
contributor's display name resembles their handle not at all, and two
others each commit under more than one name.

Runs at 03:42 UTC, an hour ahead of the consumer's run so the map it
fetches is same-day. Opens a PR; it never pushes to a protected branch,
and refuses at runtime if its branch is configured as one.
@ellemouton
ellemouton force-pushed the agent/code-owners-map branch from e5863c0 to 2a6f10e Compare August 11, 2026 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant