feat(guard): #659 route every git push and commit through the write guard #775

Merged
hexajon merged 1 commit from issue-659-guard-git-writes into main 2026-10-15 20:38:42 +00:00
Owner

Summary

Push, commit, and finish now go through a guarded Writer (ADR 0046).
internal/git/writer.go holds a Guard interface and a Writer that refuses every
write when built with no guard (fail closed); internal/service/git/writer.go
adapts guard.DefaultBranchWrite, resolving the default branch and whether it
already exists on the remote. push gains a default-branch guard it never had;
commit and finish keep their existing messages and the allow_default_branch
override (its removal is #665) and route only the decision through the guard.
The orchestrate revert and the empty-repo first push still work.

Closes #659

## Summary Push, commit, and finish now go through a guarded Writer (ADR 0046). internal/git/writer.go holds a Guard interface and a Writer that refuses every write when built with no guard (fail closed); internal/service/git/writer.go adapts guard.DefaultBranchWrite, resolving the default branch and whether it already exists on the remote. push gains a default-branch guard it never had; commit and finish keep their existing messages and the allow_default_branch override (its removal is #665) and route only the decision through the guard. The orchestrate revert and the empty-repo first push still work. Closes #659
feat(guard): #659 route git pushes through a guarded writer
All checks were successful
drift / surface-diff (push) Successful in -33s
drift / forgejo-smoke (push) Has been skipped
ci / gate (push) Successful in 11m4s
ci / gate (pull_request) Successful in 21m6s
drift / govulncheck (pull_request) Has been skipped
drift / surface-diff (pull_request) Successful in 53s
drift / forgejo-smoke (pull_request) Has been skipped
ci / mcp-conformance (pull_request) Successful in 1m31s
ci / mcp-conformance (push) Successful in -30s
drift / govulncheck (push) Has been skipped
a702760669
Wire the ADR 0046 guard into the git write path. internal/git gains a
Writer that holds a Guard interface and refuses every write when built with
no guard (fail closed). A service-layer adapter resolves the default branch
and whether it already exists on the remote, then applies
guard.DefaultBranchWrite.

Every push entry point builds its writer through the adapter, so push
refuses the default branch on the CLI and MCP and no push path skips the
guard: the push service (normal, force, tags), finish's push step, the
orchestrate revert and merge pushes, and both revert-PR paths.

Consolidate the scattered default-branch checks onto the one guard
decision: commit and finish route their comparison through
guard.DefaultBranchWrite while keeping their own refusal messages. The
allow_default_branch commit override stays for now. The first push into an
empty repo and the non-default orchestrate revert branch still go through.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sixfold-space/madtea!775
No description provided.