feat(guard): #654 declare the effects of every operation and spec endpoint #779

Merged
hexajon merged 2 commits from issue-654-effect-declarations into main 2026-10-15 22:29:27 +00:00
Owner

Summary

Every first-class operation and every endpoint in the vendored Forgejo and Gitea
specs declares its write effects in one registry (internal/opspec); a Go test
fails the gate on any undeclared operation or endpoint, naming it. Every raw
DELETE endpoint declares unrecoverable-destroy except DELETE /contents (a
recoverable content write); the pure-toggle allowlist is deferred to #774. The
ADR 0029 destructive table, docs/reference/destructive.md, and the parity pin
test now read the single registry - the three hand-maintained maps are deleted.

Refs #654

## Summary Every first-class operation and every endpoint in the vendored Forgejo and Gitea specs declares its write effects in one registry (internal/opspec); a Go test fails the gate on any undeclared operation or endpoint, naming it. Every raw DELETE endpoint declares unrecoverable-destroy except DELETE /contents (a recoverable content write); the pure-toggle allowlist is deferred to #774. The ADR 0029 destructive table, docs/reference/destructive.md, and the parity pin test now read the single registry - the three hand-maintained maps are deleted. Refs #654
Add the effect-declaration mechanism of ADR 0046. Each guard effect and each
operation and endpoint that carries one is now declared in one place, and the
gate fails on an undeclared operation or endpoint.

- guard.Effect names the three effects the guard reasons about, with
  ValidateEffects for the declaration registries.
- opspec endpointEffects declares the effects of every write endpoint (POST,
  PUT, PATCH, DELETE) in the vendored Forgejo and Gitea specs, keyed by method
  and path. Reads classify by method. TestEveryEndpointDeclaresEffects fails on
  an undeclared write endpoint or a stale declaration, naming it.
- opspec operationEffects declares the effects and destroy disposition of every
  effect-bearing or destructive-shaped first-class operation.
  TestEveryOperationDeclaresEffects fails on an undeclared destructive-shaped
  operation, naming it.
- The destructive views now read these declarations as their single source: the
  parity destructive-surface pin test reads the dispositions, destructive.md
  derives its omitted-delete list from opspec.Omit, and a consistency test holds
  the ADR 0029 omission table to the declarations.

Refs #654.
refactor(guard): #654 use slices.Contains in effect membership checks
All checks were successful
drift / govulncheck (pull_request) Has been skipped
drift / surface-diff (push) Successful in -31s
ci / mcp-conformance (push) Successful in -21s
drift / forgejo-smoke (push) Has been skipped
drift / surface-diff (pull_request) Successful in 40s
drift / forgejo-smoke (pull_request) Has been skipped
drift / govulncheck (push) Has been skipped
ci / mcp-conformance (pull_request) Successful in 2m8s
ci / gate (push) Successful in 18m50s
ci / gate (pull_request) Successful in 29m36s
4109bc7ea5
The gofix/modernize analyzer flags the hand-rolled membership loops. Use
slices.Contains in Valid and HasEffect, and strings.SplitSeq in the ADR 0029
consistency test, so the gate's gofix step passes.

Refs #654.
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!779
No description provided.