carlos / platform Public

grouproll: probe refuses group writes other than minimum, enter, exit

In probe mode, call refuses a desired or terminate write with
probe_read_only before its intent row, the one choke point every group
write passes, as box does for sessions. A test pins the refusal and
that a whole probe pass writes only minimum, enter and exit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev a80ad7034fa20da23f299172661a8719638e7637 parent b3b6e25
2 files changed, +44 −0
  • internal/grouproll/engine.go +5 −0
  • internal/grouproll/probe_test.go +39 −0

Intent

Human

<task-notification> <task-id>a7dd9051f94c868b4</task-id> <tool-use-id>toolu_01HjXwWeSwzy6XB9r62b7LGh</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/669506ff-23ec-45f1-9035-1d29593f2c37/tasks/a7dd9051f94c868b4.output</output-file> <status>completed</status> <summary>Agent "Implement Task 10: probe" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Status: DONE_WITH_CONCERNS. Task 10 is built and committed; the concerns are small and listed below. Commit: `b3b6e25c grouproll: the Standby observation probe` on `group-roll-verb` (base ff64cdca), not pushed. Tests: - All `go test ./internal/grouproll/... ./internal/grouprollaws/...` suites pass (about 135 s and 12 s). This includes 26 new `TestProbe*` tests porting every test in `region_group_probe_test.py`, and the five probe mutations, all caught. - The new CLI tests (`TestCLIProbeLeaves`, `TestCLIProbeRegistry`), the golden replay, the boundary, parity and docsite tests, and the census tests (after re-proposing) all pass. - vet, gofmt and the darwin and windows cross-builds are clean. - Each probe behaviour, switched off in turn, makes its tests fail. Concerns and deviations: - `docs/site/cli.md` is not edited, per your ruling that it belongs to Task 12 (the brief lists it). - The census was re-proposed with 24 claims (new: `Engine.Probe`; `runSystemGroup`'s claim now names the probe verbs). The reviewer's verdict belongs to Task 14. - **Deviation:** the probe records the caller identity (V9) before creating its journal, as `Roll` does. The script made no such call. - **Deviation:** the `instance` journal rows use provider-neutral keys, and a return hook in them is detected by phase rather than the raw AWS state. - **Deviation:** a missing `--member` or `--transaction` is a refusal with exit 1, following Task 5's convention, not argparse's exit 2. - The roll `status` still reads probe journals, as the script's did. - Go ran outside the sandbox (the build cache is read-only inside it), with GOCACHE at its default. No live AWS calls. The full report, with the Python→Go test map and the exported API, is at `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/.superpowers/sdd/2026-11-09-group-roll-verb/task-10-report.md`.</result> <usage><subagent_tokens>330098</subagent_tokens><tool_uses>77</tool_uses><duration_ms>1219101</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>ac4d9db9aa32c8550</task-id> <tool-use-id>toolu_01GVrWvbsL3kDhrDkJnniA82</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/669506ff-23ec-45f1-9035-1d29593f2c37/tasks/ac4d9db9aa32c8550.output</output-file> <status>completed</status> <summary>Agent "Review Task 10 (spec + quality)" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>### Spec Compliance - ✅ Spec compliant for the focus areas: every point below was checked against the diff and the script. - ⚠️ Cannot verify from the diff: - `docs/site/cli.md` is not touched. The controller assigned it to Task 12, so it is not a defect here. - The report's test results (26 `TestProbe*` tests, the mutation table) are the implementer's claims. I did not re-run them. ### Strengths - Box verbs are gated at the single choke point. `engine.go:281` refuses any non-`status` verb with `probe_read_only` before the intent row is journaled. A grep shows `"session"` reaches `e.call` only from `engine.go:296`, inside `box`, so no path bypasses the gate. `TestProbeReadOnlySessions` (`probe_test.go:1357`) covers nine write verbs and asserts no provider calls and no intent row. - Journal-kind isolation matches the script in both directions. All four probe leaves go through `checkJournalKind` (`roll.go:321-327`): `ProbeResume` via `probeResume`, `ProbeAbandon` and `ProbeCloseLost` via `abandon` and `closeLost` (`roll.go:1458`, `roll.go:1501`), `ProbeStatus` via `status.go:74`. A probe engine accepts only `probe`. A roll engine (`e.probe` false) accepts only `roll` or the depart kinds, so it refuses `probe` with `journal_kind`. The roll `Status` still reads a probe journal, as the script's `status` did. - Membership reconciliation matches `Probe.call("group")` (`probe.go:210-250` against the script): - The member's row is read through the journaled `instance` call, and the raw `group` response is journaled unchanged first. - `scope` is checked on iid and group, and `members` on template equality. The nil-versus-non-nil template guard mirrors Python `==`. - State and health are replaced only if the iid is in the group's members, as in Python. A missing row removes the member, and `activities` follows. - Health uppercasing lives in the adapter (`grouprollaws/group.go:335-338`). - `closeLost` calls `describe` directly, not `snapshot`, so it reads the raw group, as the script's close-lost did. - Identity, readiness, facts and finish all match the script: - `probeIdentity` requires an absent permit and the unchanged binary and edge process, with the `header != nil` guard. - `readinessFor` forces `maintenance=false`. - `probeFacts` sets the three true facts and detects a hook from `ReturnHeld`. `MapPhase` maps `Pending:Wait` to `ReturnHeld` only, which matches the script's single-state check. - `probeFinish` follows the script's order, and the record is printed as sorted-key JSON. - `provider-observation.json` is never written, and tests assert it. The seam mutants (`skipFreshness`, `anyJournalKind`) are test-only and default to off. ### Issues #### Critical (Must Fix) None. #### Important (Should Fix) None. #### Minor (Nice to Have) - **No group-write gate in probe mode.** - The brief says to "refuse writes outside the probe's set", but only box verbs are gated (`engine.go:281`). Probe mode does not restrict the group writes (`SetMinimum`, `Park`, `Unpark`; `Terminate` and `RaiseDesired` at `depart.go:774` and `depart.go:788`). - This matches the script, which inherits the whole `Operator`. Today the depart writes are unreachable because every depart entry needs a depart-kind journal and the probe accepts only `probe`. The guarantee therefore rests on journal-kind isolation alone. - A cheap guard would be `if e.probe` in the `Terminate` and `RaiseDesired` call sites, or a single check in the group write helper. A test could then assert that the probe's recorded provider writes are a subset of {minimum, enter, exit}. `TestProbePassOrder` and `TestProbeMembershipReconciles` only assert write order and "no writes" for refusals. - **`instance` journal rows differ from the script's.** - The Go rows are `{iid, group, template, state, phase, healthy}` (`probe.go:244-258`), not the raw AWS rows. This is consistent with `probeFacts`' own reader and with Go conventions, so no action is needed. Mention it in Task 12 or the cli docs if journals are compared across implementations. ### Assessment **Task quality:** Approved **Reasoning:** The probe cannot send a box write verb, since the single `box` choke point refuses it before journaling. Reconciliation and identity match the script line for line. Journal-kind isolation holds in both directions, covering every probe leaf and every roll leaf. The only gap is that group writes are not independently gated beyond what the script already allows.</result> <usage><subagent_tokens>77823</subagent_tokens><tool_uses>14</tool_uses><duration_ms>96923</duration_ms></usage> </task-notification>

diff --git a/internal/grouproll/engine.go b/internal/grouproll/engine.go
index e9fe510cd..eddd4cef6 100644
--- a/internal/grouproll/engine.go
+++ b/internal/grouproll/engine.go
@@ -166,6 +166,11 @@ func errorName(err error) string {
// the intent's fsync. For a box call, onSession journals each session id.
func (e *Engine) call(ctx context.Context, op string, args map[string]any, fresh time.Time,
request func(ctx context.Context, onSession func(string)) (any, error)) (any, error) {
+ // The probe's group writes are minimum, enter and exit only; any other
+ // group write is refused before its intent, as its box sessions are.
+ if e.probe && (op == "desired" || op == "terminate") {
+ return nil, refuse("probe_read_only")
+ }
// H4: only this transaction's member may enter Standby, with decrement.
if op == "enter" {
iid, _ := e.header["iid"].(string)
diff --git a/internal/grouproll/probe_test.go b/internal/grouproll/probe_test.go
index 81dd77552..3f14474f8 100644
--- a/internal/grouproll/probe_test.go
+++ b/internal/grouproll/probe_test.go
@@ -1492,3 +1492,42 @@ func TestProbeMutations(t *testing.T) {
})
}
}
+
+// The probe's group writes are minimum, enter and exit only: any other
+// group write (raise desired, terminate) is refused probe_read_only at
+// call, before its intent row or the provider sees it.
+func TestProbeGroupWritesAreMinimumEnterExit(t *testing.T) {
+ h := newProbeHarness(t)
+ must(t, probeEngine(h, func(e *Engine) error {
+ must(t, h.createProbe(e, "probe-"+strings.Repeat("f", 32)))
+ defer e.close()
+ if err := e.raiseDesired(bg, 2); refusalKey(err) != "probe_read_only" {
+ t.Errorf("desired = %v", err)
+ }
+ if _, err := e.terminate(bg, fakeIID); refusalKey(err) != "probe_read_only" {
+ t.Errorf("terminate = %v", err)
+ }
+ if len(h.f.calls) != 0 || e.has("intent", nil) {
+ t.Fatalf("calls %v", h.f.ops())
+ }
+ return nil
+ }))
+
+ // A whole probe pass writes only minimum, enter and exit.
+ h = newProbeHarness(t)
+ must(t, h.runProbe())
+ allowed := map[string]bool{"minimum": true, "enter": true, "exit": true}
+ for _, c := range h.f.calls {
+ if isWrite(c.Op, c.Args) && c.Op != "session" && !allowed[c.Op] {
+ t.Errorf("probe group write %s %v", c.Op, c.Args)
+ }
+ }
+ for _, w := range h.f.writes {
+ if !allowed[w] {
+ t.Errorf("probe write %s", w)
+ }
+ }
+ if len(h.f.writes) == 0 {
+ t.Fatal("the probe made no write")
+ }
+}