Repository navigation
Description
Protect main in hyperstructure/fctl, fctl-site and design once the repositories are public.
Why not now
GitHub Free has no branch protection or rulesets for private repositories: the API answers 403 Upgrade to GitHub Pro or make this repository public to enable this feature. Until then, main is protected by convention only: AGENTS.md, the commit skills, and CI checking pull request titles (fctl#21, design#1, fctl-site#1).
What to set up
One repository ruleset per repository, named main, on the default branch:
- Pull request required before merging, with 0 approvals while there's one maintainer (raise it when there are more). Squash is the only merge method.
- Required status checks:
- fctl:
cargo xtask checkandConventional Commits - fctl-site:
buildandConventional Commits - design:
checkandConventional Commits
- fctl:
- Linear history required; force pushes and deletion blocked.
- Bypass list:
- GitHub Actions (integration 15368),
always: the Release workflows in fctl and design push theirchore(release): vX.Y.Zcommits tomain. - In fctl-site, the
SITE_DEPLOY_KEYdeploy key (bypass actor typeDeployKey): fctl's CI pushesdocs: pin hyperstructure/fctl@…to it. - Repository admins,
pull_requestonly: they can still merge a pull request whose checks are stuck.
- GitHub Actions (integration 15368),
Plus a tag ruleset on v* in fctl and design: only the bypass actors (GitHub Actions) may create, move or delete release tags, because installed CLIs, hosts and lockfiles depend on them.
How
The fctl-sh GitHub App has administration: write on the organization, so an agent can apply these with POST /repos/hyperstructure/<repo>/rulesets. For fctl:
{
"name": "main",
"target": "branch",
"enforcement": "active",
"conditions": { "ref_name": { "include": ["~DEFAULT_BRANCH"], "exclude": [] } },
"bypass_actors": [
{ "actor_id": 15368, "actor_type": "Integration", "bypass_mode": "always" },
{ "actor_id": 5, "actor_type": "RepositoryRole", "bypass_mode": "pull_request" }
],
"rules": [
{ "type": "deletion" },
{ "type": "non_fast_forward" },
{ "type": "required_linear_history" },
{ "type": "pull_request", "parameters": {
"required_approving_review_count": 0, "dismiss_stale_reviews_on_push": true,
"require_code_owner_review": false, "require_last_push_approval": false,
"required_review_thread_resolution": false, "allowed_merge_methods": ["squash"] } },
{ "type": "required_status_checks", "parameters": {
"strict_required_status_checks_policy": false,
"required_status_checks": [ { "context": "cargo xtask check" }, { "context": "Conventional Commits" } ] } }
]
}Afterwards, check that each of these still works:
- fctl: a release from the Release workflow pushes its commit and tag (v0.7.0).
- fctl-site: a docs change in fctl pins
fctl-docs.ref, and fctl.sh deploys (#99 → eb9f7c1, deploy). - design: a release from the Release workflow pushes its commit and tag (v0.5.1).
- A direct push to
mainfrom an agent is refused (verified). - ADR 0006's note about convention-only protection is updated (by ADR 0021, which replaces it; kalaspuff decided that this settles it).
Activity
ci: check pull request titles in their own workflow (#25)
ci: check pull request titles in their own workflow (#2)
ci: check pull request titles in their own workflow (#2)
ci: keep production secrets in the production environment (#95)
ci: drop the design deploy key now that the repositories are public (#96
ci: protect main with rulesets and push releases with a deploy key (#97)
ci: protect main with rulesets and push releases with a deploy key (#13)
ci: protect main with a ruleset (#19)
ci: require a code owner's approval to merge to main (#5)
fctl-sh commentedon Oct 18, 2026
Rulesets are on in all four repositories. They differ from the plan above in two ways (ADR 0021, #97):
main, including one an agent writes on a branch. The Release workflows in fctl and design now push withRELEASE_DEPLOY_KEY, a deploy key kept in theproductionenvironment, and deploy keys bypass the rules.@kalaspuff), from someone who didn't push the last commit. With 0 approvals, an agent could merge its own pull request. fctl-sh[bot] can't be a code owner.The rules in force on
main(fromgh api repos/hyperstructure/<repo>/rules/branches/main):v*tagscargo xtask check,cargo xtask dev --smoke,Conventional Commitsv*tagscheck,Conventional Commitsbuild,Conventional CommitsConventional Commits,ShellCheck and actionlintEvery
mainruleset: squash-merged pull requests, a code owner's approval (last push approved, stale approvals dismissed), linear history, no force pushes or deletion. The files in.github/rulesets/are what was applied.Verified on 2026-10-18 by 21:41 UTC, as fctl-sh[bot]:
current_user_can_bypassisneveron all six rulesets.mainwas refused, andmainstayed ated7ab1d:refs/tags/v0.0.0-ruleset-checkin fctl was refused (422). Creatingrefs/tags/fctl-47-ruleset-controlworked, so the refusal is the tag ruleset's; I deleted that tag at once.codeowners/errorsreports nothing in any of the four repositories.productionand checked out over SSH with the deploy key ([email protected]:hyperstructure/fctl.git).Still to see:
productionenvironment. Since then, a dry run frommain(39169050203) ran inproductionand checked out over SSH withRELEASE_DEPLOY_KEY([email protected]:hyperstructure/design.git).gh api repos/hyperstructure/<repo>/actions/permissions/workflow:read can_approve=falsein each. An agent's token can't read that setting.docs: tell agents that only people with write access instruct them (#98)
docs: list hyperstructure/sandbox among the other repositories (#99)
fctl-sh commentedon Oct 18, 2026
Everything on the checklist is done and verified, so I'm closing this.
1f10669and tag over SSH withRELEASE_DEPLOY_KEY, throughmain's ruleset (ed7ab1d..1f10669 HEAD -> main).mainby itself, which aGITHUB_TOKENpush never does.0.7.0, and app.fctl.sh reports 0.7.0.878fa2aand its tag the same way.mainand on the tag. The tag check passed: run 39169573241.docs/, and CI run 39169980232 pinned fctl-site withSITE_DEPLOY_KEY:eb9f7c1landed at 21:57:26 UTC, through the ruleset that has been on fctl-site'smainsince 21:38:10.One thing unrelated to the rules: CI on fctl's release commit failed in
cargo xtask check, on a flaky host test. So that run's own deploy was skipped, and the next push tomaindeployed 0.7.0 a couple of minutes later. I'm filing that as its own issue.