Skip to content

feat(standardize-repo): guard against CODEOWNERS owner drops on adopt#43

Merged
evanharmon1 merged 1 commit into
mainfrom
chore/codeowners-guardrail
Jun 28, 2026
Merged

feat(standardize-repo): guard against CODEOWNERS owner drops on adopt#43
evanharmon1 merged 1 commit into
mainfrom
chore/codeowners-guardrail

Conversation

@evanharmon1

Copy link
Copy Markdown
Owner

Problem: a Path-B adopt renders .github/CODEOWNERS from the single code_owner answer (* @owner), which can't represent a second owner or a team — so adopting over a repo with more owners silently drops them. This dropped @AdmiralFraggle from sommerlawn-web's CODEOWNERS. That's an access-control regression that should be confirmed with the user, not auto-applied.

Two safeguards (complementing harmon-init#149, which freezes CODEOWNERS via _skip_if_exists):

  1. verify-applied.sh guardrail — a new §7 check that diffs the @owners in the pre-adopt CODEOWNERS (git show main:.github/CODEOWNERS) against the current one and FAILS if any owner present on main is now missing. Skips cleanly when there's no main, no CODEOWNERS, or it's not a git tree. Portable to macOS bash 3.2 (comm + process substitution).
  2. mode-adopt-existing.md guidance — the restore-from-main step now flags CODEOWNERS as access control: restore/merge owners and confirm any change with the user; dropping a code owner is a security regression, not a tooling sync.

Verified: shellcheck --severity=error + shfmt -d clean; owner-drop detection logic unit-tested (@AdmiralFraggle detected when dropped, empty when preserved); markdownlint clean.

🤖 Generated with Claude Code

A Path-B adopt renders CODEOWNERS from the single `code_owner` answer
(`* @owner`), which can't represent a second owner or a team — so adopting over
a repo with more owners silently dropped them (it dropped @AdmiralFraggle from
sommerlawn-web). That's an access-control regression, not a tooling sync.

- verify-applied.sh: new check that FAILS if any CODEOWNERS @owner present on
  `main` is missing post-adopt (skips cleanly with no main/CODEOWNERS).
- mode-adopt-existing.md: restore-step note — CODEOWNERS is access control;
  restore/merge owners and confirm any change with the user.

Pairs with harmon-init #149 (freezes CODEOWNERS via _skip_if_exists).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@evanharmon1 evanharmon1 merged commit 0a318ce into main Jun 28, 2026
4 of 5 checks passed
@evanharmon1 evanharmon1 deleted the chore/codeowners-guardrail branch June 28, 2026 18:22
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