guard: add the guard package with its three effects #653

Closed
opened 2026-09-29 16:35:18 +00:00 by hexajon · 0 comments
Owner

What to build

A package in internal/service that decides whether a write may run, by what the write does:

  • A write to the default branch: refused. The one exception is the first push into an empty repo (no HEAD).
  • A write that destroys unrecoverable work: refused, unless madtea computes a proof that nothing unrecoverable is lost (ADR 0029).
  • A content write to a populated repo outside the session's scope: refused, with the scope rule of ADR 0043. The rule moves here from internal/mcp/forgewrite_guard.go.

The package takes no override of any kind. Each effect has one refusal text, which names the next step and never a way around the refusal.

Acceptance

  • Table tests cover each effect, the empty-repo exception, and a failed scope read.
  • No input, flag, or setting turns a refusal off.
## What to build A package in `internal/service` that decides whether a write may run, by what the write does: - A write to the default branch: refused. The one exception is the first push into an empty repo (no `HEAD`). - A write that destroys unrecoverable work: refused, unless madtea computes a proof that nothing unrecoverable is lost (ADR 0029). - A content write to a populated repo outside the session's scope: refused, with the scope rule of ADR 0043. The rule moves here from `internal/mcp/forgewrite_guard.go`. The package takes no override of any kind. Each effect has one refusal text, which names the next step and never a way around the refusal. ## Acceptance - Table tests cover each effect, the empty-repo exception, and a failed scope read. - No input, flag, or setting turns a refusal off.
Sign in to join this conversation.
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.

Reference
sixfold-space/madtea#653
No description provided.