feat(guard): #653 add the guard package with its three write effects #772

Merged
hexajon merged 1 commit from issue-653-guard-package into main 2026-10-15 19:39:59 +00:00
Owner

Summary

Adds the guard package (internal/service/guard): three pure, table-testable
write-effect decisions - DefaultBranchWrite, UnrecoverableDestroy,
OutOfScopeContentWrite. Each takes no override, and every refusal names the next
step, never a way around it. The default-branch and destroy effects have no
production caller yet; that wiring is the later #670 children. The
out-of-scope content-write rule moves out of internal/mcp/forgewrite_guard.go
into the package with its behavior unchanged, and the mcp wrapper now delegates.
Per ADR 0046.

Closes #653

## Summary Adds the guard package (internal/service/guard): three pure, table-testable write-effect decisions - DefaultBranchWrite, UnrecoverableDestroy, OutOfScopeContentWrite. Each takes no override, and every refusal names the next step, never a way around it. The default-branch and destroy effects have no production caller yet; that wiring is the later #670 children. The out-of-scope content-write rule moves out of internal/mcp/forgewrite_guard.go into the package with its behavior unchanged, and the mcp wrapper now delegates. Per ADR 0046. Closes #653
feat(guard): #653 add the guard package with its three write effects
All checks were successful
drift / govulncheck (pull_request) Has been skipped
drift / surface-diff (pull_request) Successful in 46s
drift / forgejo-smoke (pull_request) Has been skipped
ci / mcp-conformance (pull_request) Successful in 1m39s
ci / mcp-conformance (push) Successful in -16s
drift / govulncheck (push) Has been skipped
drift / surface-diff (push) Successful in -33s
drift / forgejo-smoke (push) Has been skipped
ci / gate (push) Successful in 9m38s
ci / gate (pull_request) Successful in 20m22s
9dedee7141
A new internal/service/guard package decides a write by its effect: a write
to the default branch, a destroy of unrecoverable work, or a content write
outside the session scope. Each effect is a pure, table-tested function with
one refusal string and no override of any kind. The out-of-scope scope rule
moves here from internal/mcp/forgewrite_guard.go, which now supplies the
forge reader and delegates the decision. Existing callers and behavior stay
the same.
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!772
No description provided.