carlos / platform Public

grouproll: classify and terminate deciders, golden from the script

Classify and TerminateDecision port the script's classify() and
terminate_decision() branch for branch. scripts/grouproll-golden/record.py
wrapped both while the roll, held and probe suites ran with
REGION_GROUP_ROLL_SIM_SEEDS=3000 (wall 739 s): 321 distinct classify
cases and 439 terminate cases. The 92,169-row terminate grid is ported
with its oracle as TestTerminateEveryCombination instead of recorded.
The golden maps raw states through a copy of the phase table that
grouprollaws checks against MapPhase. Census envelope re-pinned.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 0eaea76dfbfd2c446cd575e19663cdb498eaa07a parent 273c805
11 files changed, +1,876 −1
  • internal/grouproll/classify.go +262 −0
  • internal/grouproll/classify_test.go +245 −0
  • internal/grouproll/terminate.go +107 −0
  • internal/grouproll/terminate_test.go +270 −0
  • internal/grouproll/testdata/golden/classify.jsonl +321 −0
  • internal/grouproll/testdata/golden/phases.json +17 −0
  • internal/grouproll/testdata/golden/terminate.jsonl +439 −0
  • internal/grouprollaws/phase_test.go +81 −0
  • internal/provision/testdata/plan14-root-reads-group-roll-verb.tsv +1 −1
  • region_ha_boundary_test.go +2 −0
  • scripts/grouproll-golden/record.py +131 −0

CI failed — run details

Intent

Human

<task-notification> <task-id>ad140c8a6bc5170ef</task-id> <tool-use-id>toolu_014KuFSFtNJjvDaeVpk2TUC9</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/669506ff-23ec-45f1-9035-1d29593f2c37/tasks/ad140c8a6bc5170ef.output</output-file> <status>completed</status> <summary>Agent "Implement Task 5: plan and status" 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. `plan` and `status` are built and all targeted tests pass; four decisions are worth a review. **Commit:** `273c805b carlos system group: plan and status` on group-roll-verb, not pushed. I did steps 1-5 and skipped Step 0 and Step 6 as you ruled. **Tests:** grouproll, grouprollaws, internal/parity, internal/docsite, the root CLI tests (CLIProjection, RegionHA, the new CLI tests) and TestCLIGolden (run once) all pass. The provision census tests pass, vet and gofmt are clean, and the darwin and windows cross-builds succeed. - The port covers the plan, status, stale/racing readiness, publication margin and first-response clock tests, plus TestSkewedClockRefuses, TestPreflightRefusesForeignTransactionShape and TestCLIRefusesRootBoxWindows. - The parts of those tests that need `roll` or `resume` wait for Task 7. - "No console is ever opened" is checked by a static walk from `runSystemGroup` to the console constructors, not a runtime hook, because a hook would mean editing shared `apimode.go`. - Ten mutants were checked; one survived at first, and after I added two shape cases all are caught. **Concerns:** - **Config before isolation:** `IsolateEnvironment` needs the profile, which lives in the config, so the order is state dir, shared files, load config, then isolate. - **Caller identity:** `CallerIdentity` runs before the plan log is created; if it fails (an expired SSO token), no log is written and the group is not read. The transaction begin row has no field for `caller_user_id` yet; adding one is a two-line change for Task 7. - **Edges reads:** they go through a new read-only S3 store on the adapter, which never uses a configured endpoint. So Task 14's MinIO test must inject its own store. - **Census:** the plan's rule required it, so I added a census proposal for the branch (20 units from Tasks 1-5) and listed the read-only `Put` as a non-record site in the record-write census. - **Small departures:** - The parity row status is `operator`, not the plan's `cli-only`, because the parity check requires it for operator commands. - A missing `--member`, `--to-sha256` or `--transaction` refuses with existing strings, since there is no approved "required" text. - Ctrl-C exits 130 with no message. - Two short internal strings did not come from `copy-approved.json`: the parity note and the golden-corpus skip reason. Report: `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/.superpowers/sdd/2026-11-09-group-roll-verb/task-5-report.md`</result> <usage><subagent_tokens>338178</subagent_tokens><tool_uses>120</tool_uses><duration_ms>1583603</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>ab08f7e91c3e2e885</task-id> <tool-use-id>toolu_01N7njkp85hKvtQSVTBRWb42</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/669506ff-23ec-45f1-9035-1d29593f2c37/tasks/ab08f7e91c3e2e885.output</output-file> <status>completed</status> <summary>Agent "Review Task 5 (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 - ✅ The task meets its brief, apart from the minor findings below. I checked readiness, preflight and plan against `scripts/region-group-roll.py` :1216-1345, saved_status against :1372-1382, and main against :2340-2421. - **snapshot** (engine.go, the `snapshot` function, about diff :530-565) checks the same things as the script: name, ARN, deployment, region, target groups compared as sets, and a template whose `Version` matches `^[1-9][0-9]*$`. Each target group is read in config order, and a `snapshot` row is journaled. - **identity** (engine.go `identity`) checks `v==1` with Python's `True==1` behaviour (`pyInt`), plus iid, account, region, group, a non-empty `boot_id`, and well-formed config and binary digests. The header identity is only checked when `header.identity` is truthy and the iid is the transaction's member. I checked that `DecodeBoxStatus` (box.go:374) is lenient per field, so a damaged unrelated field does not turn into an `identity` refusal. - **readiness and admitted** (engine.go `readiness`/`admitted`): `observed` is taken from `lastResponseAt` before the response row is flushed. A missing `box_ref` gives `record`. Every condition from the script's admission check is there, in the script's short-circuit order: - the edge identity is truthy, and the edge and binary are the same in both status reads; - health is `healthy` with code 200, and the edge state is `known`, in both reads; - the edges file has `v==1`, `box==box_ref`, `admitted is True` and `box_role=="serve"`; - `generation &gt;= started_at + 2s` (`publicationMargin`), and `0 &lt;= now - observed &lt;= 60s` (`readinessAge`). - **The edges read** uses the same key, `control/edges/&lt;ref&gt;.json` in `c.Bucket`, and the same `g-[a-z0-9-]+` pattern as the script (script :946-949). - **preflight** runs in the script's order: config_invalid, blocked, snapshot, shape (`n&gt;=2`, min = max = n, len = n, member present), hooks call, hook compare, observation read and compare, then for each sorted member online, offline, peer and readiness; then status, identity, permit `absent` and process. - **plan** (plan.go:96-145) matches the script check for check: - the double `api` + `hook` refusal when the hook read fails; - the member loop is skipped when the snapshot fails; - `offline` is still recorded when the online read itself fails; - permit and process are checked only for the target member, and only when readiness passed; - a missing observation gives `record`; - each refusal is printed once, then the sequence line and the journal path. - ✅ **Plan writes nothing to the group.** Its only provider calls are group, targets, hooks, online, and the `status` box verb plus edges reads. The edges store refuses Put and Delete (objects.go:56-61). Every plan and preflight test asserts `len(h.f.writes)==0` (plan_test.go TestPlanRefusals, TestPlanCollects…, TestPlanReady; engine_test.go TestPreflight, TestReadinessStaleAndRacing, TestPreflightRefusesForeignTransactionShape). - ✅ **The CLI runs in the ruled order** (system_group.go `runSystemGroup`, diff :3820-3880): Windows, euid 0, carlos box (host.env path or user `carlos`), flags (positional → `usage_positional`, missing `--config` → `config_required`), the attended check, ResolveStateDir, ResolveSharedFiles, LoadConfig, IsolateEnvironment, then Lock and `grouprollaws.New(…WithSharedFiles)` and the engine. Refusals print `Text("refused")` to stderr and exit 1. All the refusal keys used are in copy-approved.json; I checked the five refusal keys (`root_refused`, `on_box`, `usage_positional`, `config_required`, `windows`) in text.go:140-148. The `docs_cli_system_group` text is in cli.md verbatim: I checked containment with a one-off Python string check, and it returned True. - ✅ **Caller identity is recorded** as `caller_user_id` in the begin row (plan.go:47). Every journal time I saw is integer ms: `at_ms`, `received_at`, `observed`, `exit_observation_age`, and status's `last_observed_at`, which is the snapshot's `at_ms`. - ✅ **Registry and parity:** `plan` and `status` were added (system_roles.go:131-140), with the parity row, the regenerated cli.tsv and parity.md, and the golden skip lines. - ⚠️ **Cannot verify from this diff:** - "IID validated before State.Create" belongs to roll (Task 7). Plan creates its log before the IID check, as the script does. - The Review Focus 3 test only covers preflight and plan. The roll/replace/remove refusals and the `preflight-refused` journal close are deferred to Tasks 7 and 10, because those verbs do not exist yet. The controller should keep that on the Task 7/10 checklist. - Step 4's cross-compile was claimed but I did not re-run it. - The Windows refusal has no test: `system_group_test.go` is built only on linux and darwin, and `groupSupported` is a constant. ### Strengths - The plan port is faithful to the script, including its quirks: the double refusal on a hook read failure, `offline` recorded twice when the online read fails, `record` for a missing observation, and Ctrl-C ending the plan with no done row. The script's comments are kept next to the code. - The bounds are named constants that match the plan's Global Constraints (engine.go, the const block near the top, about diff :315-325). - The tests are strong at the boundaries: the margin is checked at 1.999 s and 2 s, and the age at 59 s and 61 s, and TestReadinessObservedBeforeJournalFlush checks that `observed` is taken before the journal flush. The report's mutation table backs this up. - `TestCLIGroupNeverOpensAConsole` (system_group_test.go, diff :4105) walks everything `runSystemGroup` can reach and fails if it gets to a console constructor. That is a stronger guard than the brief's nil-func hook, and it avoids editing shared apimode.go. - The edges store is read-only by construction, ignores endpoint overrides, and is tested against the `CARLOS_S3_ENDPOINT` and `AWS_ENDPOINT_URL*` overrides (objects_test.go TestBucketReadsOnly). ### Issues #### Critical (Must Fix) None. #### Important (Should Fix) None. #### Minor (Nice to Have) 1. **The divergence check fails open on unexpected errors.** engine.go `blocked()` (`_, err := os.Stat(...); return err == nil`, about diff :906-909) treats every stat error as "not blocked", including EACCES and EIO. The script's `Path.exists()` raises on EACCES on most Python versions. This is the gate that stops all work after a divergence. It is unlikely to fire, because the state directory is private and its owner is checked. Fix: return `(bool, error)`, and treat anything other than `fs.ErrNotExist` as an error (`record`). 2. **An empty `--member` or `--to-sha256` still reads the whole group.** system_group.go `parseGroupFlags`: when either flag is missing, an empty value reaches `Plan`. Plan then records `config_invalid`, but still takes the lock, writes a plan log, and opens Session Manager sessions to every member before it finishes. Argparse in the script exited before any of that. This is a read-only cost, not a safety issue (report item 7). Refusing an empty `--member`/`--to-sha256` up front with `config_invalid` would avoid it without any new copy. 3. **No compile-time check that the Adapter is a `Caller`.** `NewEngine` finds `Caller` by type assertion (engine.go `NewEngine`). If `(*Adapter).CallerIdentity` (group.go:612) ever changes signature, every production plan would refuse `unsupported`, and nothing would fail at build time. objects.go:13 already has `var _ grouproll.Objects = (*Adapter)(nil)`; add the matching `var _ grouproll.Caller = (*Adapter)(nil)`. 4. **TestCLIPlanOrder is weak.** At system_group_test.go, diff :4055-4087, it accepts any refusal after `shared-files`, `isolate`, depending on the test machine's directory permissions. So it never deterministically proves that the provider is built after the lock. `ResolveStateDir` is not recorded as a step either, so the order of the state directory relative to the shared files is not checked. Inject the state directory, or record it as a step. 5. **TestCLIGroupInterrupted only tests a mapping.** At diff :4181 it checks `groupExitCode` on its own and never runs a cancelled `runSystemGroup`. 6. **Panic used for control flow.** The `check` closure in plan.go:56-58 uses panic and recover (`errAbort`) to leave on Ctrl-C. It works, but a `cancelled` flag checked after each `check` would be easier to read. 7. **Malformed-input deviations listed in report item 5.** These are the early `box_ref` refusal, `permit` instead of `record`, `admission` instead of `record`, stricter RFC 3339 parsing, and non-integral floats comparing false. They make the same decision on realistic input. The other direction also exists: a non-object `edge` raised AttributeError in the script and crashed it, where Go refuses `admission`. That is better behaviour. None of these block. ### Assessment **Task quality:** Approved **Reasoning:** Readiness, preflight and plan match the script on every require, key, order and bound (60 s age, 2 s margin, identity and header-identity checks). Plan sends nothing that changes the group, and the CLI refuses in the ruled order before it reads config, isolates or builds a provider. The findings are hardening items and test-strength gaps, not behaviour defects.</result> <usage><subagent_tokens>138965</subagent_tokens><tool_uses>24</tool_uses><duration_ms>246179</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>a4bcc52657dfed16b</task-id> <tool-use-id>toolu_01AQpzhp9itQt9C9hV1DMjTX</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/669506ff-23ec-45f1-9035-1d29593f2c37/tasks/a4bcc52657dfed16b.output</output-file> <status>completed</status> <summary>Agent "Implement Task 6: deciders + golden" is waiting on its own background work</summary> <note>This agent stopped with background work of its own still running. It may resume on its own when that work completes or reports, and the same task-id notifies again if it does; the result below may be interim.</note> <result>Waiting for the recorder to finish.</result> <usage><subagent_tokens>127700</subagent_tokens><tool_uses>54</tool_uses><duration_ms>1040233</duration_ms></usage> </task-notification>

Attributed to this commit: 24.8 g CO₂e (3,093,611 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on group-roll-verb, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

internal/grouproll/classify.go

Loading diff…

internal/grouproll/classify_test.go

Loading diff…

internal/grouproll/terminate.go

Loading diff…

internal/grouproll/terminate_test.go

Loading diff…

internal/grouproll/testdata/golden/classify.jsonl

Loading diff…

internal/grouproll/testdata/golden/phases.json

Loading diff…

internal/grouproll/testdata/golden/terminate.jsonl

Loading diff…

internal/grouprollaws/phase_test.go

Loading diff…

internal/provision/testdata/plan14-root-reads-group-roll-verb.tsv

Loading diff…

region_ha_boundary_test.go

Loading diff…

scripts/grouproll-golden/record.py

Loading diff…