carlos / platform Public

plan: CLI registry step 1, round 2 P2s applied (READY AFTER FIXES)

Subtree constructors keep injected writers and errors; no /tmp scratch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev d7aa1c8a354bb5480bec10f745326057034ec25c parent 99685b9
2 files changed, +37 −2
  • docs/superpowers/plans/2026-11-09-cli-registry-words.md +2 −2
  • docs/superpowers/plans/CODEX-FINDINGS-cli-registry-words-plan-R2.md +35 −0

Intent

Human

<task-notification> <task-id>bnueq2o2m</task-id> <tool-use-id>toolu_019kiuzxgszZ6Yqxwm525VKi</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/27979b8d-cc90-4f50-88f6-87ba41433627/tasks/bnueq2o2m.output</output-file> <status>completed</status> <summary>Background command "Mark T1 started; wait for plan round 2" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 13.0 g CO₂e (1,602,743 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on cli-registry-words, 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.

diff --git a/docs/superpowers/plans/2026-11-09-cli-registry-words.md b/docs/superpowers/plans/2026-11-09-cli-registry-words.md
index 5de6afdf4..20a79b12e 100644
--- a/docs/superpowers/plans/2026-11-09-cli-registry-words.md
+++ b/docs/superpowers/plans/2026-11-09-cli-registry-words.md
@@ -156,7 +156,7 @@ One JSON object per line: `{"case":"<id> | <kind>","argv":[...],"env":{...},"exi
Each of Tasks 4-7 does the same thing for its list of dispatchers, following that dispatcher's rows in the audit:
1. In the dispatcher's package, write `<name>Command() *clireg.Node` (package main: unexported; other packages: exported, e.g. `host.SystemCommands() []*clireg.Node`) declaring every word the dispatcher (and its nested dispatchers) switches on: names, aliases (one child with an alias, spec A5), `Default`/`DefaultLeaf` and `DefaultOn` copied from today's behaviour, `Fallback` = today's `default:` arm moved verbatim (help words included), `OnError` = the parent's error mapping where one exists (spec B1 "Errors": `RunAuth`, `RunConfig`, `billing`, `devbox`, `accounts plan`), leaves `Run: clireg.RawArgs(handler)` or `RawArgsErr`, `Audience` per the parity row's status (`operator`, `box-local`, `internal`, else `customer`).
-2. Replace the top-level leaf from Task 2 with the subtree. When a test calls the old dispatcher, keep it with **its exact signature** **(plan R1-6)**: a `func(args []string)` entry becomes `clireg.Dispatch(<name>Command(), args)`; an entry that takes an injected writer or returns an error or exit code (`configDestinations(out io.Writer, args []string) error`, `config_cli.go:79`, and its tests in `config_cli_test.go`) keeps its body and contract, and the registry's leaves call it, not the other way round. Delete an old dispatcher only when nothing calls it.
+2. Replace the top-level leaf from Task 2 with the subtree. When a test calls the old dispatcher, keep it with **its exact signature** **(plan R1-6)**: a `func(args []string)` entry becomes `clireg.Dispatch(<name>Command(), args)`; an entry that takes an injected writer or returns an error or exit code becomes a **subtree constructor taking those as parameters** **(plan R2-1)**: e.g. `configDestinationsCommand(out io.Writer, errp *error) *clireg.Node`, whose leaves call `destinationsList(out, args)`, `destinationsAdd(out, args)` and siblings directly and store their error in `*errp`; production builds it with `os.Stdout` inside `config`'s subtree (with `RunConfig`'s error mapping as `OnError`), and `configDestinations(out io.Writer, args []string) error` stays as `var err error; clireg.Dispatch(configDestinationsCommand(out, &err), args); return err`, so `config_cli_test.go` passes unchanged and no word switch remains. Delete an old dispatcher only when nothing calls it.
3. Whole-function dispatchers (`billing`, `move` incl. `moveMain`, `move.go:223`, `devbox`): leaves are closures that re-prepend their word and call the old function unchanged (spec A5); the inner switch stays until its args step. (Review Focus 5's `moveMain` therefore stays as it is.)
4. Re-record the corpus from `BASE` (no existing line may change; new lines are the subtree's new cases, read and checked by the implementer), then **replay** it against the branch binary: `go test . -run '^TestCLIGolden$'` with zero differences **(plan R1-7)**. Add any explicit cases the task names.
5. Run the package's existing tests (`-run` on the touched files' tests), `TestCommandTreeIsValid`, and `make parity-doc` (the projection changes as subtrees appear).
@@ -188,7 +188,7 @@ Dispatchers: `edge` (leaf, `SkipBare`), `agent`, `adopt`, `bootstrap`, `add`, `r
- [ ] **Step 2:** Word-first children per the audit: `antivirus {status, enable, disable, rotate-webhook-key}` (closures passing the word to `runSystemAntivirus`), `pdf {status}`, `layout {status, migrate, revert}`, `geoip {publish, status, off}`, `managed-fleets {show, set}`, `seeds-floor {publish}`, `legacy-routes {assign}`, `lifetimes {cutover}`, `hosts-used {status}`, `box {role (raw), publish-record}`, `group {role (raw)}`, `demos {status, serving, takedown, takedown-status, reports {resolve; DefaultLeaf list on all three}}` (spec B6: each leaf runs today's manual loop; `demos`'s fallback prints `systemDemosInvalid`, exit 2, and the sole-argument help to stdout, exit 0), each with its fallback copied from today.
- [ ] **Step 3:** Box plumbing kept whole (spec A0): `guard-exec`, `group-maintenance`, `files`, `host-env`, `named-units` are single leaves calling today's functions with all their arguments; `update`, `status`, `rollback`, `cancel-activation`, `apply`, `install-channel`, `runsc-ensure`, `exec-sandbox-allows-prev`, `journal-migrate`, `floor-allows-prev`, `guard-arm`, `db-worker` are leaves.
- [ ] **Step 4:** Corpus: re-record from `BASE`; explicit cases `system router`, `system router router`, `system router update -h`, `system demos foo --bar`, `system demos --bar foo`, `system demos help`, `system demos help x`, `system antivirus`, `system antivirus zz`, `system guard-exec zz` with `CARLOS_RELEASE_PUBKEY` unset and with the test key the host tests use, `system apply --recover -h`.
-- [ ] **Step 5:** Run `go test . -run 'System|TestCommandTree|TestCLIGolden'` and the touched internal packages' tests (sandbox off, `TMPDIR=/tmp/g`); commit `cli: system words in the registry`.
+- [ ] **Step 5:** Run `go test . -run 'System|TestCommandTree|TestCLIGolden'` and the touched internal packages' tests (sandbox off, the session's `$TMPDIR`; a short `/var/tmp` directory only if a socket path is too long, removed afterwards, **plan R2-2**); commit `cli: system words in the registry`.
### Task 8: Parity projection and guard, docsite, AGENTS.md
diff --git a/docs/superpowers/plans/CODEX-FINDINGS-cli-registry-words-plan-R2.md b/docs/superpowers/plans/CODEX-FINDINGS-cli-registry-words-plan-R2.md
new file mode 100644
index 000000000..68790a5b4
--- /dev/null
+++ b/docs/superpowers/plans/CODEX-FINDINGS-cli-registry-words-plan-R2.md
@@ -0,0 +1,35 @@
+- **R1-1: Resolved** — `__drain-call` is included with its original exit behavior.
+- **R1-2: Resolved** — the corpus isolates `CARLOS_DATA_DIR` and requires auditing absorbing defaults.
+- **R1-3: Resolved** — documentation coverage uses deduplicated first words.
+- **R1-4: Resolved** — random-output nodes receive explicit skips; recording checks repeatability.
+- **R1-5: Resolved** — projection and scanner consumers migrate together in Task 2.
+- **R1-6: Partly resolved** — signatures are preserved, but the `configDestinations` adapter remains underspecified.
+- **R1-7: Resolved** — each conversion requires branch replay.
+- **R1-8: Resolved** — internal parity members must resolve to registered entries.
+- **R1-9: Partly resolved** — global scratch guidance is corrected; Task 7 still prescribes `/tmp/g`.
+
+No P1 findings.
+
+1. **P2 — Tasks 4–7: finish the signature-preserving adapter rule (R1-6).**
+
+ **Problem and evidence:** [Plan:159](docs/superpowers/plans/2026-11-09-cli-registry-words.md:159) says registry leaves call the unchanged `configDestinations` dispatcher. However, the walk has consumed the selected word. [config_cli.go:79](config_cli.go:79) still requires that word and defaults to `list` when its first argument is a flag. The explicit word-restoration rule covers only `billing`, `move`, and `devbox`.
+
+ **Failure scenario:** Passing `inv.Raw` from `config destinations add -h` to the retained dispatcher prints **list** help. Restoring the word would fix that invocation but retain another production word switch outside the specified whole-function exceptions.
+
+ **Fix:** Bind registry leaves directly to `destinationsList`, `destinationsAdd`, and their siblings. Preserve `configDestinations(out, args) error` through the same subtree with an injected writer and non-exiting error capture. Keep its existing tests unchanged.
+
+ **Fault family:** Existing callable interfaces and error propagation.
+
+2. **P2 — Task 7: remove the remaining RAM-backed scratch override (R1-9).**
+
+ **Problem and evidence:** [Plan:191](docs/superpowers/plans/2026-11-09-cli-registry-words.md:191) still specifies `TMPDIR=/tmp/g`, contradicting the corrected global constraint and supplied machine rules.
+
+ **Failure scenario:** Following Task 7 places test scratch under the shared RAM disk. `TestMain` does not necessarily relocate it: [main_test.go:103](main_test.go:103) relocates temporary roots when an ancestor contains `.carlos/config`, not merely because they are under `/tmp`.
+
+ **Fix:** Remove that override and use the existing on-disk `$TMPDIR`; use a task-owned short directory under `/var/tmp` only where socket-path length requires it, then remove it.
+
+ **Fault family:** Shared-machine resource isolation.
+
+Reviewed `8c03ace19bcc9796e8396dfaad2f43dfefaa6b1f`, round 2. No files changed, subagents spawned, or tests run. These P2s require no further review round.
+
+**READY AFTER FIXES**
\ No newline at end of file