Skip to content

Branch protection ruleset defaults — recommend strict_required_status_checks_policy: false for fast-moving repos #6

@mabry1985

Description

@mabry1985

Context

While setting up branch protection on protoLabsAI/escape-from-qud (which currently has the most active sprint cadence in the org), discovered a friction pattern worth capturing as a default recommendation across org repos.

The friction

GitHub rulesets with `required_status_checks.strict_required_status_checks_policy: true` enforce that a PR's branch must be up-to-date with the base before merge. The intent (prevent stale-branch regressions slipping into main) is sound for multi-collaborator repos with frequent conflicting changes.

For solo-dev or small-team repos with linear sprint stacks (PR A → PR B stacked on A → PR C stacked on B), strict mode forces this loop after every merge:

  1. Merge PR A → main advances
  2. PR B is now `mergeState: BEHIND`
  3. `gh pr update-branch B` → CI re-runs on B
  4. Wait ~4 min for CI (Rust workspace builds)
  5. Merge PR B → main advances
  6. PR C now BEHIND → repeat

For a stack of N PRs, that's N × CI-cycle of serial waiting. Observed on escape-from-qud during Phase 5 game-loop work: 5-PR stack took ~25 min of CI-wait instead of ~5 min for a single cycle.

Recommendation for org defaults

For repos in the `protoLabsAI` org with these characteristics, flip strict to false:

  • 1-3 contributors
  • Linear sprint cadence (rare conflicting parallel work)
  • Strong test coverage (the actual safety net — stale branches that would break main usually fail their own CI)
  • Active PR-stacking workflow
# Update the ruleset on a single repo
gh api -X PUT repos/protoLabsAI/<repo>/rulesets/<id> --input ruleset.json
# where ruleset.json has:
#   required_status_checks.strict_required_status_checks_policy: false

For larger repos (5+ contributors, parallel feature branches, frequent semantic-conflict potential), keep strict on.

What this PRESERVES even with strict: false

  • PR required before merging to main ✓
  • All required status checks must pass on the PR's last CI run ✓
  • Force-push to main blocked ✓
  • Branch deletion blocked ✓
  • Auto-delete head branch on merge ✓

What it CHANGES:

  • `mergeState: BEHIND` no longer blocks merge
  • The PR can merge whenever its OWN CI is green, regardless of how far main has advanced since
  • Slight risk: stale branch + new main change could combine to break main if (a) merge succeeds silently AND (b) post-merge regression isn't caught by an existing test. In practice this is rare for linear-stack workflows.

Proposed action items for this repo

  • Add `docs/branch-protection-defaults.md` capturing the recommendation + a sample ruleset JSON
  • Add a section to the README under "Defaults" linking to the new doc
  • Optionally: a `scripts/apply-branch-protection.sh` that takes a repo + applies the recommended ruleset (loose vs strict mode flag)

Reference

🤖 Filed by Claude Code during escape-from-qud Phase 5 sprint work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions