ci: require maintainer review for gate files through CODEOWNERS #278

Merged
Defame1297 merged 2 commits from ci/codeowners into main 2026-11-21 18:34:22 +00:00
Owner

Closes #144

What

  • CODEOWNERS (new, at the root). One owner, the maintainer, with the 25 patterns from #144. The file owns itself. Gitea reads the root path before docs/ and .gitea/, so no other CODEOWNERS file can shadow it.
    • requirements-dev.txt, requirements-dev.lock, requirements.yml, README.md and the roles stay unowned.
  • galaxy.yml build_ignore gets CODEOWNERS. scripts/check_tarball.py refuses an unknown top-level file in the Collection tarball. The issue did not list this edit.
  • scripts/select_molecule_scenarios.py IGNORED gets CODEOWNERS, because no scenario reads it. This takes effect only after the merge: the selector runs from the base branch, so this pull request still runs every scenario.
  • REUSE.toml needs no edit: its path = "**" default covers the new file.
  • No changelog fragment: the file is tooling, kept out of the Collection.

Why the patterns say \\. where the issue says \.

Gitea v28.0.0, models/issues/pull.go:

  • TokenizeCodeOwnersLine treats \ as an escape and drops it, so \\ becomes \ and \. becomes .. An unescaped # starts a comment.
  • ParseCodeOwnersLine then compiles ^<pattern>$ with regexp2.

Written as in the issue, \.gitea/.* would reach the engine as ^.gitea/.*$, with . matching any character. Writing \\. delivers \., a literal dot. The file's header comment says this.

Regex test (acceptance)

Not committed, per the issue. A Python copy of Gitea's tokenizer and its ^…$ anchoring, run against CODEOWNERS:

  • Every non-comment line yields exactly two tokens: a pattern and @Defame1297.
  • The patterns, after tokenizing, are exactly the issue's 25.
  • Each pattern matches its sample path. Examples: .gitea/workflows/lint.yml, tests/sanity/ignore-common.txt, .ansible-lint, docs/adr/0001-threat-model.md, AGENTS.md, .claude/settings.json, .mcp.json.
  • These are also owned: .ansible-lint-ignore, roles/docker/AGENTS.md, .claude/skills/tdd/SKILL.md, tests/sanity/ignore-2.18.txt.
  • These match no rule: requirements-dev.txt, requirements-dev.lock, requirements.yml, README.md, roles/docker/tasks/main.yml, changelogs/fragments/x.yml, docs/images/ci.md, plus the look-alikes renovateXjson and xgitea/workflows/a.yml, which shows every dot is literal.
  • Five patterns match no tracked file today, because those paths don't exist yet: docs/adr/.*, docs/contributing/.*, (.*/)?AGENTS\.md, \.claude/.*, \.mcp\.json.

Result: PASS.

Once code-owner approval is on

These pull requests then wait for the maintainer's approval:

  • Renovate's own-image pin-follow pull requests, which edit .gitea/workflows/.
  • Its Dockerfile FROM bumps, which edit images/.
  • Skills bumps, Renovate's or by hand, which edit .claude/, apm.yml and apm.lock.yaml.

Interim, as #144 accepts: until #165 removes Renovate's post-upgrade task, Python pin bumps also wait, because they edit the owned .gitea/workflows/image.yml.

Verified

  • The regex test above.
  • python3 -m unittest discover -s tests/scripts: 201 tests, OK. This includes the selector's IGNORED test and the tarball tests.
  • The commit hooks (gitleaks, yamllint, ruff, REUSE, changelog lint, ansible-lint, Conventional Commits) and the pre-push ansible-test sanity all passed.
  • code-review, both axes:
    • Spec: no findings.
    • Standards: no hard violations. One finding fixed in the second commit: the header now says approval is enforced only by branch protection, not by the file.

Not verified

  • Gitea's regexp2 itself. The test used Python's re. The patterns use only ., *, ?, groups and escaped dots, which both engines read the same way.
  • Gitea's own parse warnings, and the live required-code-owner check. These need the file on main, and the "Require approval from code owners" setting belongs to #192.

For the maintainer (not changed here)

The code-review flagged files that are not in #144's list:

  • CLAUDE.md: it carries agent rules, but #185 replaces it with AGENTS.md, which is owned.
  • .python-version
  • .gitignore
  • meta/
  • extensions/
  • COPYING, NOTICE, LICENSES/

The issue says everything else stays unowned. Adding any of these is a decision, not part of this pull request.

🤖 Generated with Claude Code

Closes #144 ## What - **`CODEOWNERS`** (new, at the root). One owner, the maintainer, with the 25 patterns from #144. The file owns itself. Gitea reads the root path before `docs/` and `.gitea/`, so no other CODEOWNERS file can shadow it. - `requirements-dev.txt`, `requirements-dev.lock`, `requirements.yml`, `README.md` and the roles stay unowned. - **`galaxy.yml` `build_ignore`** gets `CODEOWNERS`. `scripts/check_tarball.py` refuses an unknown top-level file in the Collection tarball. The issue did not list this edit. - **`scripts/select_molecule_scenarios.py` `IGNORED`** gets `CODEOWNERS`, because no scenario reads it. This takes effect only after the merge: the selector runs from the base branch, so this pull request still runs every scenario. - `REUSE.toml` needs no edit: its `path = "**"` default covers the new file. - No changelog fragment: the file is tooling, kept out of the Collection. ### Why the patterns say `\\.` where the issue says `\.` Gitea v28.0.0, `models/issues/pull.go`: - `TokenizeCodeOwnersLine` treats `\` as an escape and drops it, so `\\` becomes `\` and `\.` becomes `.`. An unescaped `#` starts a comment. - `ParseCodeOwnersLine` then compiles `^<pattern>$` with `regexp2`. Written as in the issue, `\.gitea/.*` would reach the engine as `^.gitea/.*$`, with `.` matching any character. Writing `\\.` delivers `\.`, a literal dot. The file's header comment says this. ## Regex test (acceptance) Not committed, per the issue. A Python copy of Gitea's tokenizer and its `^…$` anchoring, run against `CODEOWNERS`: - Every non-comment line yields exactly two tokens: a pattern and `@Defame1297`. - The patterns, after tokenizing, are exactly the issue's 25. - Each pattern matches its sample path. Examples: `.gitea/workflows/lint.yml`, `tests/sanity/ignore-common.txt`, `.ansible-lint`, `docs/adr/0001-threat-model.md`, `AGENTS.md`, `.claude/settings.json`, `.mcp.json`. - These are also owned: `.ansible-lint-ignore`, `roles/docker/AGENTS.md`, `.claude/skills/tdd/SKILL.md`, `tests/sanity/ignore-2.18.txt`. - These match no rule: `requirements-dev.txt`, `requirements-dev.lock`, `requirements.yml`, `README.md`, `roles/docker/tasks/main.yml`, `changelogs/fragments/x.yml`, `docs/images/ci.md`, plus the look-alikes `renovateXjson` and `xgitea/workflows/a.yml`, which shows every dot is literal. - Five patterns match no tracked file today, because those paths don't exist yet: `docs/adr/.*`, `docs/contributing/.*`, `(.*/)?AGENTS\.md`, `\.claude/.*`, `\.mcp\.json`. Result: PASS. ## Once code-owner approval is on These pull requests then wait for the maintainer's approval: - Renovate's own-image pin-follow pull requests, which edit `.gitea/workflows/`. - Its Dockerfile `FROM` bumps, which edit `images/`. - Skills bumps, Renovate's or by hand, which edit `.claude/`, `apm.yml` and `apm.lock.yaml`. Interim, as #144 accepts: until #165 removes Renovate's post-upgrade task, Python pin bumps also wait, because they edit the owned `.gitea/workflows/image.yml`. ## Verified - The regex test above. - `python3 -m unittest discover -s tests/scripts`: 201 tests, OK. This includes the selector's `IGNORED` test and the tarball tests. - The commit hooks (gitleaks, yamllint, ruff, REUSE, changelog lint, ansible-lint, Conventional Commits) and the pre-push `ansible-test sanity` all passed. - `code-review`, both axes: - Spec: no findings. - Standards: no hard violations. One finding fixed in the second commit: the header now says approval is enforced only by branch protection, not by the file. ## Not verified - **Gitea's `regexp2` itself.** The test used Python's `re`. The patterns use only `.`, `*`, `?`, groups and escaped dots, which both engines read the same way. - **Gitea's own parse warnings, and the live required-code-owner check.** These need the file on `main`, and the "Require approval from code owners" setting belongs to #192. ## For the maintainer (not changed here) The code-review flagged files that are not in #144's list: - `CLAUDE.md`: it carries agent rules, but #185 replaces it with `AGENTS.md`, which is owned. - `.python-version` - `.gitignore` - `meta/` - `extensions/` - `COPYING`, `NOTICE`, `LICENSES/` The issue says everything else stays unowned. Adding any of these is a decision, not part of this pull request. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Claude added this to the Open to contributors milestone 2026-11-21 17:32:58 +00:00
Defame1297 was assigned by Claude 2026-11-21 17:32:58 +00:00
Claude added 2 commits 2026-11-21 17:32:58 +00:00
Add the root CODEOWNERS with one owner, the maintainer, over the gate files:
workflows, scripts, images, lint and REUSE configs, sanity ignores, the
changelog config, galaxy.yml, the contributor and agent docs and the apm
setup. It owns itself, and Gitea reads the root path first.

Gitea drops one backslash before compiling a pattern, so literal dots are
written \\. and reach the engine as \.

The pin files and README.md stay unowned. CODEOWNERS joins galaxy.yml
build_ignore, so the tarball check does not refuse it, and the molecule
selector's IGNORED, since no scenario reads it.

Refs #144

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
ci: say in CODEOWNERS when its approval is enforced
Build / build (pull_request) Successful in 12s
Lint / lint (pull_request) Successful in 41s
Molecule / molecule (pull_request) Successful in 16m18s
844c152d6a
The file only requests the maintainer's review; branch protection makes
the approval required. Also say why some patterns match nothing yet, and
that everything else is unowned.

Refs #144

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
Defame1297 merged commit 96a090cead into main 2026-11-21 18:34:22 +00:00
Defame1297 deleted branch ci/codeowners 2026-11-21 18:34:22 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#278