docs: add branch-protection runbook from src/zsh-eza audit findings - #477
Merged
Conversation
Adds runbooks/branch-protection.md, the checklist for provisioning and auditing repository settings and rulesets on next -> main repositories (decisions/0008-branching-model.md). Written from an audit of z-shell/src and z-shell/zsh-eza that found the same three gaps in both, independently: renovate.json missing baseBranches (Renovate bypassing next), no required check blocking direct-to-main PRs, and delete_branch_on_merge deleting the next branch itself after a promotion merge -- the ruleset deletion rule did not stop it under an admin bypass. Cross-links from dependency-management.md, new-repository.md, and ADR-0008's Consequences/References. Registers runbook-branch-protection in .github/instruction-surfaces.json. Closes #476
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new operational runbook to standardize how next → main repositories are provisioned and audited (rulesets + repo settings + automation defaults), based on real audit findings, and wires it into the routed instruction surfaces so it’s consistently applied during bootstrap and branch-protection tasks.
Changes:
- Add
runbooks/branch-protection.mdchecklist covering rulesets, repo settings (delete_branch_on_merge), and automation configuration (RenovatebaseBranches, main-branch guard check). - Cross-link the new runbook from
runbooks/new-repository.md,runbooks/dependency-management.md, and ADR-0008 (decisions/0008-branching-model.md). - Register the runbook as a required routed surface via
.github/instruction-surfaces.json(runbook-branch-protection).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| runbooks/new-repository.md | Adds explicit guidance to apply the branch-protection runbook for next → main repos during bootstrap. |
| runbooks/dependency-management.md | Clarifies Renovate baseBranches is mandatory for next → main repos and links to the runbook. |
| runbooks/branch-protection.md | New runbook documenting the audit/provisioning checklist and incident learnings. |
| decisions/0008-branching-model.md | Adds references tying the ADR policy to the enforcement/provisioning runbook. |
| .github/instruction-surfaces.json | Routes the new runbook as required for relevant tasks/consumers. |
ss-o
marked this pull request as ready for review
July 24, 2026 22:02
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Sal <59910950+ss-o@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (4)
runbooks/new-repository.md:129
- Same terminology consistency issue here: this section uses
next->main, while ADR-0008 and other guidance typically usenext→main. Aligning to→makes this easier to grep and reduces ambiguity.
If this repository uses the `next` -> `main` model
(`decisions/0008-branching-model.md`), follow `runbooks/branch-protection.md`
in full before opening the bootstrap pull request. Trunk-on-`main`
repositories still need a `main` ruleset, but can skip the `next`-specific
items (the guard workflow, `renovate.json` override).
runbooks/branch-protection.md:38
- For consistency with ADR-0008 and other docs in this repo, use
next→main(Unicode arrow) rather thannext->mainhere. This keeps terminology consistent and improves searchability.
Run every item below for a repository whose `decisions/0008-branching-model.md`
row is `next` -> `main`. Skip repositories that are trunk-on-`main`.
runbooks/branch-protection.md:43
- Same terminology consistency issue:
next->mainis inconsistent with ADR-0008’snext→mainwording. Using the same arrow symbol here makes searches and cross-references more reliable.
`gh api repos/<org>/<repo> --jq .delete_branch_on_merge`. If `true`,
any PR that uses `next` as its head branch (i.e. every `next` -> `main`
promotion) risks GitHub deleting `next` right after merge, regardless of
runbooks/branch-protection.md:76
- This line uses
next->main, but ADR-0008 and related docs usenext→main. Aligning on→keeps terminology consistent across the documentation set.
When squash-merging a `next` -> `main` promotion PR without an explicit
Copilot flagged 8 spots using ASCII -> instead of the Unicode -> already used by ADR-0008 and the rest of the runbook set.
Copilot review: AGENTS.md only disallows Co-authored-by; there is no blanket no-trailer policy and Signed-off-by is not itself prohibited.
…tion-runbook # Conflicts: # decisions/0008-branching-model.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #476. Impact review (per
runbooks/instruction-update.md) is in that issue.Summary
runbooks/branch-protection.md: the checklist for provisioning and auditing repository settings/rulesets onnext->mainrepos, written from an audit ofz-shell/srcandz-shell/zsh-ezathat found the same three gaps in both independently (missingrenovate.jsonbaseBranches, no guard against direct-to-mainPRs,delete_branch_on_mergedeleting thenextbranch itself after a promotion merge).runbooks/dependency-management.md,runbooks/new-repository.md, and ADR-0008's Consequences/References.runbook-branch-protectionin.github/instruction-surfaces.json.Opened as a draft: this documents a real incident and its fix, but the runbook content and the manifest route are a maintainer call, not something I should land unilaterally.
Test plan
python3 scripts/validate-agent-policy.py-- passespython3 -m unittest scripts/test_validate_agent_policy.py -v-- 68 tests passtrunk checkon all changed files -- no issues