flake-update-cascade: read protected-branches by the same rule as the rails #237
Labels
No labels
blocked
bug
decision
duplicate
enhancement
help wanted
invalid
landed?
question
ready-to-merge
stale
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/tools#237
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bring
flake-update-cascadeup to the same standard asallod changeand theprotected-refs-policyhook when it decides whether a repository's default branch is protected, so a direct run cannot commit and push to a protected branch because of how a line in the list is written or where the repository is checked out.Primary goals:
owner/repothatoriginnames.--prmode.tests/fixtures/protection-cases.tsv, the table that already holds the Go tool and the bash hook together.Current state and specifics
cmd/flake-update-cascade/main.go:416decides protection withfileHasLine(c.protectedFile, "work/"+repo+" "+defaultBranch).fileHasLine(main.go:306) compares each whole line of~/.config/git/protected-brancheswith that string, byte for byte.work/allod/tools master(two spaces) or a tabwork/allod/tools/ masterwork/<name>In a direct run a repository judged unprotected is committed to and pushed on its default branch. For an agent the forge rejects that push. For a repository admin it does not: branch protection on the forge does not restrain an admin, so for a human running the cascade the local list is the only thing in the way.
The rule to share is
lookupProtectionincmd/allod/workspace.go, withreadBranchListbeside it andRepoFromURLininternal/gitremote. The default is to move the lookup into an internal package that both commands import, since both are Go; duplicating it a third time is the alternative only if the move turns out to dragcmd/allodplumbing with it.Validation
tests/fixtures/protection-cases.tsvthat applies to it.tests/flake/flake-update-cascade/stay green.Scope
In scope: how
flake-update-cascadereadsprotected-branches, and the package move that lets it share the rule. Out of scope: the contents ofprotected-branches, which stay a hand-maintained copy of the forge's rules;active-pr-branchesandallowed-external-remotes, which the cascade already reads by remote.