chore: apply the recommended repository settings, account permissions and branch protection #192

Open
opened 2026-11-15 20:55:02 +00:00 by Claude · 11 comments
Owner

Spec: Recommended repository settings and branch protection, resolution comment, as changed by Agent credentials and what unattended agents can do, Code-owner approval against Renovate automerge, and where secrets live, Pushes onto a pull request that has a scheduled merge and Where the maintainer's own procedures live, and what "held by review" means for them.

What

The maintainer applies the settings in the web UI. Do the steps in order: each account gets its new access and is tested before it leaves Owners.

0. Gitea upgrade

1. New access, tested

  • Package push bot: organisation team with Packages: write and no repositories; new token with write:package only; replace PACKAGE_PUSH_TOKEN. Test: one image push from image.yml (or a manual docker push of an existing tag).
  • Renovate bot: write collaborator on this repository; token with write:repository, write:issue, read:package; replace RENOVATE_BOT_TOKEN. Test: one Renovate run that rebases or opens a pull request.
  • Agent account: not a write collaborator. Put it in an organisation team on this repository with per-unit access: Code, Issues and Pull requests write, Actions read, nothing else. Create the team with per-unit access from the start: in Gitea 28.0.0 an API edit with units_map keeps a team's earlier general access mode. Token with write:issue, write:repository, read:organization. Tests, before the account leaves Owners: it pushes a branch and opens a pull request (succeeds), and it tries to approve a fork workflow run (refused).
  • Each agent account's Gitea profile (full name or description) names its one accountable person by role. Held by aspirational.

The release bot's access is not part of this issue: the bot account issue creates the account and gives it its access, tag allowlist entry, the addition to the release/* allowlist and its repository secret. It belongs to the Continuous delivery milestone, so this issue does not wait for it and has no release-bot step.

2. Remove from Owners

  • Remove the agent account, the package push bot and the Renovate bot from the Owners team. Owners holds only the maintainer.

3. Branch rules

main rule:

  • Turn on "Require approval from code owners" (after ci: require maintainer review for gate files through CODEOWNERS is merged; this issue is blocked by it). It stays on knowing that Renovate's own-image pin-follow and Dockerfile FROM pull requests then wait for the maintainer.
  • Turn on "Dismiss stale approvals"; required approvals stay at zero. The records say it is already on: confirm it is on. Test: approve a test pull request touching a code-owned file, push to it, and see the approval dismissed.
  • Turn on the merge allowlist: the maintainer, each trusted contributor by name, the Renovate bot. Save, reload and check that every name survived (Gitea drops accounts without write).
  • Everything else unchanged.

release/* rule:

  • Create a branch protection rule for release/* with push and force-push allowed to the maintainer only (the release bot is added by #174). Its branch cannot be deleted, which is fine: release/next is reused.
  • No renovate/* rule: Renovate branches stay unprotected so they are deleted after merge.

4. Repository

  • Wiki off. Projects stay on.

Acceptance

  • The three tests in step 1 passed and are noted on this issue.
  • Owners has one member.
  • A Renovate pull request touching a gate file shows the maintainer as required code owner and merges itself after approval.
  • A test pull request touching one file under each CODEOWNERS pattern shows the maintainer as required code owner. Done 2026-11-21 (comment of that date).
  • The agent account sees no merge button on a green pull request.

Notes

  • A new secret (the release bot's token) is created as a repository secret. Moving the existing secrets to repository level is chore: move Kamino's secrets to repository level when a second repository joins the organisation; the consequence is recorded in ADR 0001.
  • Standing steps live in docs/contributing/maintaining.md (the maintaining.md issue filed from #250), which this issue links to once the file exists: the intended settings as a checklist, granting a trusted contributor (merge allowlist as well as collaborator), withdrawing one (remove the collaborator and the merge-allowlist entry, and rotate every secret), creating agent and bot accounts, the secret rotation list, and keeping the runner registered for this repository only.
  • Python pin bumps wait for the maintainer between code-owner approval going on and the CI image versions landing, accepted as an interim: until #165 removes Renovate's post-upgrade task, a pin bump also edits the owned image.yml.
  • There are no Restricted accounts.

Open proposals

  • With Actions read, the agent account can no longer dispatch, rerun or cancel workflows through the API (all three need write on the Actions unit); the Renovate and release bots keep Actions write. Whether both are intended is asked, not answered (comment of 2026-11-17).
  • Split this issue into "accounts, teams and tokens" and "branch rules" (comment of 2026-11-17, proposed, not done).
Spec: [Recommended repository settings and branch protection](https://git.rkdr.net/Mortis/Kamino/issues/179), resolution comment, as changed by [Agent credentials and what unattended agents can do](https://git.rkdr.net/Mortis/Kamino/issues/209), [Code-owner approval against Renovate automerge, and where secrets live](https://git.rkdr.net/Mortis/Kamino/issues/210), [Pushes onto a pull request that has a scheduled merge](https://git.rkdr.net/Mortis/Kamino/issues/248) and [Where the maintainer's own procedures live, and what "held by review" means for them](https://git.rkdr.net/Mortis/Kamino/issues/250). ## What The maintainer applies the settings in the web UI. Do the steps in order: each account gets its new access and is tested before it leaves Owners. ### 0. Gitea upgrade - [ ] The Gitea server is on 28.4.0 or later: [chore: upgrade the Gitea server to 28.4.0 or later before opening to contributors](https://git.rkdr.net/Mortis/Kamino/issues/223) blocks this issue. ### 1. New access, tested - [ ] Package push bot: organisation team with Packages: write and no repositories; new token with `write:package` only; replace `PACKAGE_PUSH_TOKEN`. Test: one image push from `image.yml` (or a manual `docker push` of an existing tag). - [ ] Renovate bot: write collaborator on this repository; token with `write:repository`, `write:issue`, `read:package`; replace `RENOVATE_BOT_TOKEN`. Test: one Renovate run that rebases or opens a pull request. - [ ] Agent account: not a write collaborator. Put it in an organisation team on this repository with per-unit access: Code, Issues and Pull requests write, Actions read, nothing else. Create the team with per-unit access from the start: in Gitea 28.0.0 an API edit with `units_map` keeps a team's earlier general access mode. Token with `write:issue`, `write:repository`, `read:organization`. Tests, before the account leaves Owners: it pushes a branch and opens a pull request (succeeds), and it tries to approve a fork workflow run (refused). - [ ] Each agent account's Gitea profile (full name or description) names its one accountable person by role. Held by aspirational. The release bot's access is not part of this issue: [the bot account issue](https://git.rkdr.net/Mortis/Kamino/issues/174) creates the account and gives it its access, tag allowlist entry, the addition to the `release/*` allowlist and its repository secret. It belongs to the *Continuous delivery* milestone, so this issue does not wait for it and has no release-bot step. ### 2. Remove from Owners - [ ] Remove the agent account, the package push bot and the Renovate bot from the Owners team. Owners holds only the maintainer. ### 3. Branch rules `main` rule: - [x] Turn on "Require approval from code owners" (after [ci: require maintainer review for gate files through CODEOWNERS](https://git.rkdr.net/Mortis/Kamino/issues/144) is merged; this issue is blocked by it). It stays on knowing that Renovate's own-image pin-follow and Dockerfile `FROM` pull requests then wait for the maintainer. - [ ] Turn on "Dismiss stale approvals"; required approvals stay at zero. The records say it is already on: confirm it is on. Test: approve a test pull request touching a code-owned file, push to it, and see the approval dismissed. - [ ] Turn on the merge allowlist: the maintainer, each trusted contributor by name, the Renovate bot. Save, reload and check that every name survived (Gitea drops accounts without write). - [ ] Everything else unchanged. `release/*` rule: - [ ] Create a branch protection rule for `release/*` with push and force-push allowed to the maintainer only (the release bot is added by [#174](https://git.rkdr.net/Mortis/Kamino/issues/174)). Its branch cannot be deleted, which is fine: `release/next` is reused. - [ ] No `renovate/*` rule: Renovate branches stay unprotected so they are deleted after merge. ### 4. Repository - [ ] Wiki off. Projects stay on. ## Acceptance - The three tests in step 1 passed and are noted on this issue. - Owners has one member. - A Renovate pull request touching a gate file shows the maintainer as required code owner and merges itself after approval. - A test pull request touching one file under each CODEOWNERS pattern shows the maintainer as required code owner. **Done 2026-11-21** (comment of that date). - The agent account sees no merge button on a green pull request. ## Notes - A new secret (the release bot's token) is created as a repository secret. Moving the existing secrets to repository level is [chore: move Kamino's secrets to repository level when a second repository joins the organisation](https://git.rkdr.net/Mortis/Kamino/issues/239); the consequence is recorded in [ADR 0001](https://git.rkdr.net/Mortis/Kamino/issues/143). - Standing steps live in `docs/contributing/maintaining.md` (the maintaining.md issue filed from #250), which this issue links to once the file exists: the intended settings as a checklist, granting a trusted contributor (merge allowlist as well as collaborator), withdrawing one (remove the collaborator and the merge-allowlist entry, and rotate every secret), creating agent and bot accounts, the secret rotation list, and keeping the runner registered for this repository only. - Python pin bumps wait for the maintainer between code-owner approval going on and the CI image versions landing, accepted as an interim: until [#165](https://git.rkdr.net/Mortis/Kamino/issues/165) removes Renovate's post-upgrade task, a pin bump also edits the owned `image.yml`. - There are no Restricted accounts. ## Open proposals - With Actions read, the agent account can no longer dispatch, rerun or cancel workflows through the API (all three need write on the Actions unit); the Renovate and release bots keep Actions write. Whether both are intended is asked, not answered (comment of 2026-11-17). - Split this issue into "accounts, teams and tokens" and "branch rules" (comment of 2026-11-17, proposed, not done).
Claude added the
Status
Ready for Human
label 2026-11-15 20:55:02 +00:00
Claude added this to the Open to contributors milestone 2026-11-15 22:21:20 +00:00
Author
Owner

Review of the map (2026-11-15): corrections to this issue.

Review of the map (2026-11-15): corrections to this issue. - **This issue cannot close inside its milestone.** It is in *Open to friends*, but step 1 contains "Release bot (when [the bot account issue](https://git.rkdr.net/Mortis/Kamino/issues/174) is done)", and that issue is in *Continuous delivery*. The acceptance "The four tests in step 1 passed" therefore waits on a later milestone. Proposal for the maintainer: move the release-bot step (write collaborator, `v*` tag allowlist, repository secret, and its test) into [chore: create the kamino-release bot account, its token, the v* tag allowlist entry and the repository secret](https://git.rkdr.net/Mortis/Kamino/issues/174), and change the acceptance here to "The three tests in step 1 passed". Steps 2 to 4 do not depend on the release bot.
Author
Owner

Scope from The friend boundary once the approval facts are known: step 0 is the Gitea upgrade to ≥ 28.4.0, chore: upgrade the Gitea server to 28.4.0 or later before opening to friends, which now blocks this issue. No Restricted friend accounts: friends are ordinary accounts, approved until their first merged pull request.

Scope from [The friend boundary once the approval facts are known](https://git.rkdr.net/Mortis/Kamino/issues/205): step 0 is the Gitea upgrade to ≥ 28.4.0, [chore: upgrade the Gitea server to 28.4.0 or later before opening to friends](https://git.rkdr.net/Mortis/Kamino/issues/223), which now blocks this issue. No Restricted friend accounts: friends are ordinary accounts, approved until their first merged pull request.
Author
Owner

Scope added by Agent credentials and what unattended agents can do (resolution 1 and 4):

  • The agent account is not a write collaborator. It goes into an organisation team on this repository with per-unit access: Code, Issues and Pull requests write, Actions read, nothing else. Create the team with per-unit access from the start: in Gitea 28.0.0 an API edit with units_map keeps a team's earlier general access mode.
  • Test before the account leaves Owners: it pushes a branch (succeeds), and it tries to approve a fork workflow run (refused).
  • Each agent account's Gitea profile (full name or description) names its one accountable person by role.
  • The "Agent accounts do not approve fork workflow runs" rule is now this control, no longer review-held.
Scope added by [Agent credentials and what unattended agents can do](https://git.rkdr.net/Mortis/Kamino/issues/209) (resolution 1 and 4): - The agent account is **not** a write collaborator. It goes into an organisation team on this repository with per-unit access: Code, Issues and Pull requests write, **Actions read**, nothing else. Create the team with per-unit access from the start: in Gitea 28.0.0 an API edit with `units_map` keeps a team's earlier general access mode. - Test before the account leaves Owners: it pushes a branch (succeeds), and it tries to approve a fork workflow run (refused). - Each agent account's Gitea profile (full name or description) names its one accountable person by role. - The "Agent accounts do not approve fork workflow runs" rule is now this control, no longer review-held.
Author
Owner

Scope added by Code-owner approval against Renovate automerge, and where secrets live (resolution, points 1, 4, 6):

  • Branch protection rules for renovate/* and release/*: push and force-push allowed only for the Renovate bot plus the maintainer (renovate/*) and the release bot plus the maintainer (release/*).
  • "Require approval from code owners" stays on, knowing that Renovate's own-image pin-follow and Dockerfile FROM pull requests then wait for the maintainer.
  • Secrets: a new secret (the release bot's token) is created as a repository secret. Moving the existing ones is #239.
Scope added by [Code-owner approval against Renovate automerge, and where secrets live](https://git.rkdr.net/Mortis/Kamino/issues/210) (resolution, points 1, 4, 6): - Branch protection rules for `renovate/*` and `release/*`: push and force-push allowed only for the Renovate bot plus the maintainer (`renovate/*`) and the release bot plus the maintainer (`release/*`). - "Require approval from code owners" stays on, knowing that Renovate's own-image pin-follow and Dockerfile `FROM` pull requests then wait for the maintainer. - Secrets: a new secret (the release bot's token) is created as a repository secret. Moving the existing ones is [#239](https://git.rkdr.net/Mortis/Kamino/issues/239).
Claude added a new dependency 2026-11-17 22:25:25 +00:00
Author
Owner

Review of the map (2026-11-17).

Changed: this issue is now blocked by ci: require maintainer review for gate files through CODEOWNERS, because the code-owner acceptance cannot be met before the file is on main.

Proposed, not done: rewrite the body once (five amending comments now), or split it into "accounts, teams and tokens" and "branch rules".

Review of the map (2026-11-17). - **Agent account.** The body's step 1 still says "Agent account: write collaborator on this repository". The third comment replaces it: an organisation team on this repository with Code, Issues and Pull requests write and Actions read, created with per-unit access. Decided in [Agent credentials and what unattended agents can do](https://git.rkdr.net/Mortis/Kamino/issues/209). Tick the comment's version, not the body's. - **Secrets.** The body's Notes say "Secrets stay organisation-level". That is withdrawn: they move to repository level in [chore: move Kamino's secrets to repository level when a second repository joins the organisation](https://git.rkdr.net/Mortis/Kamino/issues/239), decided in [Code-owner approval against Renovate automerge, and where secrets live](https://git.rkdr.net/Mortis/Kamino/issues/210), point 4. - **Release bot.** The fourth comment says the `release/*` rule allows "the release bot plus the maintainer" and that the release bot's token is created as a repository secret. The release bot does not exist when this issue runs. Create the `release/*` rule with the maintainer only; [chore: create the kamino-release bot account, its token, the v* tag allowlist entry and the repository secret](https://git.rkdr.net/Mortis/Kamino/issues/174) adds the bot and creates the secret. This issue has no release-bot step. - **Wait before creating the two bot-branch rules.** In Gitea's source a branch that matches a protection rule cannot be deleted by anyone, and "delete head branch after merge" is skipped for it. Merged `renovate/*` and `release/*` branches would stay. Read, not tested. Whether the rules are kept is open in [Pushes onto a pull request that has a scheduled merge](https://git.rkdr.net/Mortis/Kamino/issues/248). - **Acceptance addition**, moved here from the CODEOWNERS issue as its review comment asked: a test pull request touching one file under each CODEOWNERS pattern shows the maintainer as required code owner. - **Side effect to expect.** With Actions read, the agent account can no longer dispatch, rerun or cancel workflows through the API (all three need write on the Actions unit, like run approval). The Renovate and release bots stay write collaborators and keep Actions write. Say here whether both are intended. - **Standing step.** "When a new trusted contributor is added, add them to the merge allowlist" is a procedure, and this issue will close. Its home is open in [Where the maintainer's own procedures live, and what "held by review" means for them](https://git.rkdr.net/Mortis/Kamino/issues/250). Changed: this issue is now blocked by [ci: require maintainer review for gate files through CODEOWNERS](https://git.rkdr.net/Mortis/Kamino/issues/144), because the code-owner acceptance cannot be met before the file is on `main`. Proposed, not done: rewrite the body once (five amending comments now), or split it into "accounts, teams and tokens" and "branch rules".
Author
Owner

Scope changed by Pushes onto a pull request that has a scheduled merge (resolution, points 3 to 5). This answers the "wait before creating the two bot-branch rules" item of the review comment.

  • No renovate/* rule. Drop the renovate/* push and force-push allowlist from the fourth comment: Renovate branches stay unprotected so they are deleted after merge. The ride-along risk goes into ADR 0001 (#143).
  • release/* rule stays, created with the maintainer only (the release bot is added by #174). Its branch cannot be deleted, which is fine: release/next is reused.
  • main: "Dismiss stale approvals" on, and required approvals stay at zero. Code-owned files then wait for approval again after a push onto an approved pull request. Test: approve a test pull request touching a code-owned file, push to it, and see the approval dismissed.
Scope changed by [Pushes onto a pull request that has a scheduled merge](https://git.rkdr.net/Mortis/Kamino/issues/248) (resolution, points 3 to 5). This answers the "wait before creating the two bot-branch rules" item of the review comment. - **No `renovate/*` rule.** Drop the `renovate/*` push and force-push allowlist from the fourth comment: Renovate branches stay unprotected so they are deleted after merge. The ride-along risk goes into ADR 0001 ([#143](https://git.rkdr.net/Mortis/Kamino/issues/143)). - **`release/*` rule stays**, created with the maintainer only (the release bot is added by [#174](https://git.rkdr.net/Mortis/Kamino/issues/174)). Its branch cannot be deleted, which is fine: `release/next` is reused. - **`main`: "Dismiss stale approvals" on**, and required approvals stay at zero. Code-owned files then wait for approval again after a push onto an approved pull request. Test: approve a test pull request touching a code-owned file, push to it, and see the approval dismissed.
Author
Owner

Scope change from Where the maintainer's own procedures live, and what "held by review" means for them (2026-11-20)

This answers the "Standing step" point of the review comment of 2026-11-17.

  • Standing steps move to docs/contributing/maintaining.md (the maintaining.md issue filed from #250): the intended settings as a checklist, granting and withdrawing a trusted contributor, creating agent and bot accounts, the secret rotation list, and keeping the runner registered for this repository only. When that file exists, this issue links to it; the body's Notes sentence "When a new trusted contributor is added, add them to the merge allowlist as well as to collaborators" lives there, not here.
  • Withdrawing a trusted contributor: remove the collaborator and the merge-allowlist entry, and rotate every secret.
  • "No Restricted friend accounts" (comment of 2026-11-16) is moot: the friend position is removed. There are no Restricted accounts.
  • The accountable person named in each agent account's profile (comment of 2026-11-16) stays a step here, but is held by aspirational, not review.
  • Step 0, the Gitea upgrade to ≥ 28.4.0, stays.
## Scope change from [Where the maintainer's own procedures live, and what "held by review" means for them](https://git.rkdr.net/Mortis/Kamino/issues/250) (2026-11-20) This answers the "Standing step" point of the review comment of 2026-11-17. - **Standing steps move to `docs/contributing/maintaining.md`** (the maintaining.md issue filed from #250): the intended settings as a checklist, granting and withdrawing a trusted contributor, creating agent and bot accounts, the secret rotation list, and keeping the runner registered for this repository only. When that file exists, this issue links to it; the body's Notes sentence "When a new trusted contributor is added, add them to the merge allowlist as well as to collaborators" lives there, not here. - **Withdrawing a trusted contributor:** remove the collaborator and the merge-allowlist entry, and rotate every secret. - **"No Restricted friend accounts" (comment of 2026-11-16) is moot:** the friend position is removed. There are no Restricted accounts. - The accountable person named in each agent account's profile (comment of 2026-11-16) stays a step here, but is held by aspirational, not review. - Step 0, the Gitea upgrade to ≥ 28.4.0, stays.
Author
Owner

Body rewritten on 2026-11-20 to the final state of the comments above (final validation round of the map, #87 (comment)). The body is the spec; the earlier comments are history.

  • Decision 3: Python pin bumps wait for the maintainer until #165 lands, accepted interim; added as a Note.
  • Agent account in a team with Actions read; secrets no longer "organisation-level"; release/* allowlist with the maintainer only; no renovate/* rule; "dismiss stale approvals" as a confirm-it-is-on step with its test.
  • Two open questions from the comment of 2026-11-17 are listed under "Open proposals", not decided.
Body rewritten on 2026-11-20 to the final state of the comments above (final validation round of the map, https://git.rkdr.net/Mortis/Kamino/issues/87#issuecomment-12281). The body is the spec; the earlier comments are history. - Decision 3: Python pin bumps wait for the maintainer until #165 lands, accepted interim; added as a Note. - Agent account in a team with Actions read; secrets no longer "organisation-level"; `release/*` allowlist with the maintainer only; no `renovate/*` rule; "dismiss stale approvals" as a confirm-it-is-on step with its test. - Two open questions from the comment of 2026-11-17 are listed under "Open proposals", not decided.
Author
Owner

Live CODEOWNERS check (2026-11-21)

#144 is merged (#278), so the root CODEOWNERS is on main. The maintainer ran the live check by hand and reports that it works: a test pull request showed the maintainer as code owner.

This also confirms the escaping in the file. Gitea's tokenizer drops one backslash before compiling a pattern, so the file writes \\. where it means a literal dot. A wrong spelling would have matched nothing.

Not recorded with the report, and so not ticked here:

  • Whether the test pull request touched one file under each pattern, as the acceptance item "A test pull request touching one file under each CODEOWNERS pattern shows the maintainer as required code owner" asks.
  • Whether "Require approval from code owners" (step 3) was already on, that is, whether the maintainer showed as a required code owner or only as a requested reviewer.

The maintainer ticks the acceptance item and the step 3 box once those are confirmed.

## Live CODEOWNERS check (2026-11-21) #144 is merged (#278), so the root `CODEOWNERS` is on `main`. The maintainer ran the live check by hand and reports that it works: a test pull request showed the maintainer as code owner. This also confirms the escaping in the file. Gitea's tokenizer drops one backslash before compiling a pattern, so the file writes `\\.` where it means a literal dot. A wrong spelling would have matched nothing. Not recorded with the report, and so not ticked here: - Whether the test pull request touched one file under **each** pattern, as the acceptance item "A test pull request touching one file under each CODEOWNERS pattern shows the maintainer as required code owner" asks. - Whether "Require approval from code owners" (step 3) was already on, that is, whether the maintainer showed as a *required* code owner or only as a requested reviewer. The maintainer ticks the acceptance item and the step 3 box once those are confirmed.
Author
Owner

Follow-up to the comment above: the maintainer confirmed both open points. The test pull request covered every CODEOWNERS pattern, and "Require approval from code owners" was on. The step 3 box and the CODEOWNERS acceptance item are now marked done in the body.

Follow-up to the comment above: the maintainer confirmed both open points. The test pull request covered every CODEOWNERS pattern, and "Require approval from code owners" was on. The step 3 box and the CODEOWNERS acceptance item are now marked done in the body.
Author
Owner

The standing steps now live in docs/contributing/maintaining.md (#359, for #262). These include adding a new trusted contributor to the merge allowlist as well as to collaborators, rotating every secret on withdrawal, and the intended settings checklist. Once #359 merges, follow that file for those steps; this issue covers only applying the settings once.

The standing steps now live in `docs/contributing/maintaining.md` (#359, for #262). These include adding a new trusted contributor to the merge allowlist as well as to collaborators, rotating every secret on withdrawal, and the intended settings checklist. Once #359 merges, follow that file for those steps; this issue covers only applying the settings once.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: Mortis/Kamino#192