review: config receipts plan 1 branch R1 findings + Luna copy result
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+124
−0
docs/superpowers/reviews/CODEX-FINDINGS-config-receipts-branch-1.md+75 −0docs/superpowers/reviews/LUNA-COPY-RESULT-config-receipts-1.md+49 −0
Intent
Human
<task-notification> <task-id>bkehemqfm</task-id> <tool-use-id>toolu_01TLGBrPZPyHVWt7Kt2wSUGR</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/4c585ebb-d953-40f5-8f58-fbd337832024/tasks/bkehemqfm.output</output-file> <status>completed</status> <summary>Background command "Wait for Astra review and Luna copy pass" completed (exit code 0)</summary> </task-notification>
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-config-receipts-branch-1.md b/docs/superpowers/reviews/CODEX-FINDINGS-config-receipts-branch-1.md| new file mode 100644 |
| index 000000000..bed512331 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-FINDINGS-config-receipts-branch-1.md |
| @@ -0,0 +1,75 @@ |
| +Reviewed `5394c7f..f24e42ff33fb32dfaa7cc77f830dd398899149dd`, branch review round 1. |
| + |
| +Focused tests could not start: Go could not create its work directory in the read-only sandbox. Changed Go files pass `gofmt`. Findings below are based on static inspection; no files were edited. |
| + |
| +1. **P1 — An empty quoted `If-Match` silently becomes an unconditional write.** |
| + Evidence: [apiconfig.go:989](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/config-receipts-1/internal/console/apiconfig.go:989), spec §4.5. The parser strips `""` to an empty string, returns it successfully, and the handler skips every conditional-write check at line 521. A request containing `If-Match: ""` and a valid set therefore writes against the latest bundle instead of refusing the unmatched precondition. It can overwrite a concurrent writer’s value. |
| + **Fix:** distinguish an absent header from a supplied empty tag; reject unsupported or empty preconditions before applying anything. Cover empty quoted tags and whitespace-only supplied versions with assertions that nothing changes. |
| + **Fault family:** a supplied precondition must never disappear during parsing. The ledger’s empty-tag case is unsafe, beyond a status-code discrepancy. |
| + |
| +2. **P1 — Team GET can return newly added versions and digests after ownership changes.** |
| + Evidence: [apiconfig.go:209](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/config-receipts-1/internal/console/apiconfig.go:209), spec §4.8. The scope gate checks ownership using an earlier read (`teamdoors.go:326`). The handler then loads another manifest and emits its digests and version at lines 243–251 without checking that manifest’s `OwnerScope`. If the owner releases or transfers the environment between those reads, the former team receives metadata from a bundle it no longer owns. This extends the pre-existing two-read race to this branch’s new sensitive fields. |
| + **Fix:** for team GETs, require `layer.Found` and `layer.Manifest.OwnerScope == tv.scope` on the actual response snapshot; otherwise return the canonical 404. Use `teamScopedHook` to test an ownership change between the gate and handler. |
| + **Fault family:** authorization must cover the same snapshot whose contents are disclosed. |
| + |
| +3. **P2 — Receipts can describe an intermediate version without telling the caller.** |
| + Evidence: [apiconfig.go:637](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/config-receipts-1/internal/console/apiconfig.go:637), lines 673–695 and 966–980; spec §4.6. A combined unconditional vars/`exec_delivery` request constructs its receipt before the second write. A successful team creation similarly obtains its receipt before credential minting can modify that environment. With no competing writer, the returned `version_after` can already differ from the stored bundle. A no-op var set combined with an exec-delivery change can return `changed: false`. The team refusal at line 540 specifically recommends reusing the creation receipt’s version, which can immediately fail. |
| + **Fix:** explicitly identify receipts that precede additional mutations and require a fresh GET before reuse; correct the creation advice. Preserve the established separate-write behavior. Test combined writes and creation with credential delivery enabled. |
| + **Fault family:** distinguish the result of one mutation from the completed request’s state. |
| + |
| +4. **P2 — Failed default-version observations disappear from successful receipts.** |
| + Evidence: [apiconfig.go:645](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/config-receipts-1/internal/console/apiconfig.go:645), spec §4.6. If either default-layer read fails, the named-environment write succeeds but omits `others` entirely. Callers cannot distinguish “comparison unavailable” from a receipt where the default is irrelevant; the CLI prints no warning. |
| + **Fix:** explicitly report that the comparison was unavailable, preserving any successful observation. Do not describe a completed write as refused. Add failure cases for both observation reads. |
| + **Fault family:** missing evidence must remain distinguishable from a completed comparison. |
| + |
| +5. **P2 — The retry recipe combines separate reads without checking their versions agree.** |
| + Evidence: [cli.md:1103](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/config-receipts-1/docs/site/cli.md:1103), lines 1127–1138; spec §4.7. The recipe collects plain and secret digests through separate listings. During a retry, a preserved plain variable can change after `env list` but before `secrets list`. Reusing the latter version permits the write even though the plain digest checked came from older bytes. |
| + **Fix:** require matching versions across both listings before treating them as one observation, at baseline and every retry, or use one API GET containing both kinds. Keep the original baseline digests when retrying observations. |
| + **Fault family:** retry decisions and their precondition must describe one bundle snapshot. |
| + |
| +6. **P2 — Several documentation guarantees exceed the implementation.** |
| + Evidence: [cli.md:1052](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/config-receipts-1/docs/site/cli.md:1052), lines 1062 and 1079; [apimode.go:3127](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/config-receipts-1/apimode.go:3127). |
| + - Effective `--json` re-encodes known fields; it does not preserve a newer console’s answer unchanged. |
| + - A matching content version does not prove nobody wrote in between: A → B → A is explicitly permitted. |
| + - Exec-delivery-only requests and older consoles provide no receipt, contrary to “every write through a console.” |
| + |
| + **Fix:** narrow these statements to the actual guarantees. Retain typed response filtering rather than introducing arbitrary passthrough merely to satisfy the wording. |
| + **Fault family:** documented guarantees must match observable behavior. |
| + |
| +7. **P2 — Required negative coverage is incomplete.** |
| + Evidence: `apiconfig_conditional_test.go:512`, `apiconfig_observe_test.go:229`, and the deferred ledger. Existing tests do not establish the complete door behavior for a stale team write to an absent, creatable environment with credential minting enabled, ownership transfer during the 412 reread, a real second account containing the same app/host names, or a secret supplied by the overlay. |
| + **Fix:** add deterministic door tests asserting no mint/write on refusal, canonical 404 on ownership loss, account isolation, and no secret envelope/value in effective responses. Include the GET ownership race from finding 2. |
| + **Fault family:** executable witnesses for ownership, refusal side effects, and confidentiality. |
| + |
| +The remaining ledger items are triaged below. P3 items can wait and must not start another review round. |
| + |
| +| Ledger item / evidence | Priority and disposition | Fault family | |
| +|---|---|---| |
| +| Wildcard/weak `If-Match`, `apiconfig.go:989` | **P2:** reject unsupported forms with 400. They currently fail closed as mismatches; distinguish them from finding 1’s unconditional-write case. | Precondition parsing | |
| +| Nil `Vars`, `observe.go:109` | **P3:** current consumers safely range it, and writers initialize it at line 167. Normalize or document before exposing it to a mutating caller. | Loader contract | |
| +| Weak digest assertions, `observe_test.go:41`; `appconfig_cli_test.go:293` | **P3:** add independent expected-byte assertions; existing tests provide weaker regression detection than their names suggest. | Test quality | |
| +| Direct capability assertions, `release/store.go:124` | **P3:** document use of `HasAtomicConditionalPut`; direct assertions misclassify prefix wrappers. | Capability discovery | |
| +| HostClaim wrappers lose capability | **P3:** retain as a claim-reenable prerequisite under the fixed ruling; current refusal fails closed. | Capability forwarding | |
| +| Permanent effective-view failures say “try again”, `apiconfigeffective.go:59` | **P3:** improve diagnosis for missing environments/corrupt records. The current response refuses rather than fabricating a merge. | Error guidance | |
| +| Loader parity comment, `observe.go:225` | **P3:** qualify error-order parity; merge rules agree, validation/read ordering differs. | Documentation precision | |
| +| Default read wasted for owned writes, `apiconfig.go:623` | **P3:** avoid the unnecessary read when ownership can be established without weakening the guarded write. | Read cost | |
| +| Effective 404 membership advice, `apimode.go:3164` | **P3:** mention host selection and older consoles so valid members get useful guidance. | Error guidance | |
| +| Secret digest unavailable after CLI sealing | **P3:** optional local receipt comparison. The documented script-owned-envelope workflow remains usable. | CLI verification convenience | |
| +| Effective JSON drops future fields | **P3 implementation follow-up**; its inaccurate documentation is **P2**, finding 6. | Compatibility | |
| +| Blank effective VALUE cells, `appconfig_cli.go:1655` | **P3:** optionally distinguish empty from withheld values; JSON already distinguishes them. | Display clarity | |
| +| Missing secrets flag-to-wire tests | **P3:** add command-level coverage; both verbs currently pass the flag correctly. | Test quality | |
| +| No-op prints “set” then “nothing changed” | **P3:** distinguish attempted setting from content change in the copy pass. | Display clarity | |
| +| Two GETs for conditional secret sets | **P3:** consider sharing capability/key metadata while retaining the older-console guard. | Read cost | |
| +| Help paragraph spacing and long documentation line | **P3:** copy-pass cleanup. | Formatting | |
| + |
| +Census verdicts apply to the reviewed tip and the card’s root-authority question; they do not claim the executable census gate passed. |
| + |
| +| Unit or envelope | Verdict and evidence | |
| +|---|---| |
| +| `appconfig_cli.go:const envUsage` | **APPROVE.** Lines 176–245 change printed help only. Existing `legacy / accepted-legacy` disposition remains appropriate. | |
| +| `appconfig_cli.go:envDigest` | **APPROVE.** Lines 1694–1723 read an operator-supplied envelope file and hash it; dispatch at lines 1726–1749 is an explicit local CLI command. No tenant-controlled input is added to an automated root execution path. The new `legacy / accepted-legacy` disposition is appropriate. | |
| +| Envelope `.` | **APPROVE.** Reviewed CLI dispatch, loading, printing, digest handling, and API changes (`appconfig_cli.go:264,329,481,552,656,1126,1332,1593,1694`; `apimode.go:2915,3008,3164`). No new tenant-selected root target or weakened root validation. | |
| +| Envelope `internal/appconfig` | **APPROVE.** Reviewed versioned reads/writes (`store.go:106,183,242`), owned writes (`owned.go:120`), wrappers (`generation.go:142`; `instances.go:135`), and shared merge (`environments.go:240`; `observe.go:236`). Existing key validation, ownership checks, conditional store writes, schema refusal, and owned-environment isolation remain intact. | |
| +| Envelope `internal/release` | **APPROVE.** Lines 124–138 and 999–1002 add capability discovery; existing S3 conditional headers remain enforced at lines 1019–1023. No new read target or root authority. | |
| + |
| +**NOT READY** |
| \ No newline at end of file |
diff --git a/docs/superpowers/reviews/LUNA-COPY-RESULT-config-receipts-1.md b/docs/superpowers/reviews/LUNA-COPY-RESULT-config-receipts-1.md| new file mode 100644 |
| index 000000000..5e990bae6 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/LUNA-COPY-RESULT-config-receipts-1.md |
| @@ -0,0 +1,49 @@ |
| +### Controller errors |
| + |
| +| file:line | current | proposed | why | |
| +|---|---|---|---| |
| +| internal/console/apiconfig.go:526 | `if_version cannot cover exec_delivery, which is a separate write. send exec_delivery in a request of its own` | `if_version cannot cover exec_delivery. send exec_delivery in a request of its own` | Shorter and clearer | |
| +| internal/console/apiconfig.go:533 | `conditional writes need a store that supports them` | `conditional writes are not supported here` | Avoids the internal term “store” | |
| +| internal/console/apiconfig.go:550 | `%s is in both set and unset, which a write with if_version does not accept. send it in one of them` | `%s is in both set and unset. a write with if_version accepts it in only one of them` | More direct | |
| +| internal/console/apiconfig.go:1001 | `if_version and the If-Match header name different versions. send one of them, or the same version in both` | `if_version and the If-Match header name different versions. send one, or send the same version in both` | Fixes the grammar | |
| +| internal/console/apiconfig.go:1043 | `the config is not at the version you sent, so nothing was written. read it again before you retry` | `the bundle is not at the version you sent, so nothing was written. read it again before you retry` | Uses the feature’s user-facing term | |
| + |
| +### CLI help and errors |
| + |
| +| file:line | current | proposed | why | |
| +|---|---|---|---| |
| +| appconfig_cli.go:183 | `print a plain var's digest, to check a receipt` | `print a plain var's digest for comparison` | Receipts do not contain digests | |
| +| appconfig_cli.go:224-230 | `every bundle has a version, which changes whenever its stored contents do, and every var has a digest, which changes whenever that var does. list shows the version, and --digests adds the digests. set and unset print what they changed and the version after. --if-version <v> writes only if the bundle is still at version v ("none" if it must not exist yet); otherwise nothing is written, the current version is printed and carlos exits with code 4. --if-version needs a console.` | `every bundle has a version, which changes whenever its contents change, and every var has a digest, which changes whenever that var changes. list shows the version, and --digests adds the digests. set and unset print a receipt with what changed and the version after. --if-version <v> writes only if the bundle is still at version v ("none" if it must not exist yet). otherwise nothing is written, the current version is printed and carlos exits with code 4. --if-version needs a console` | Less repetitive and explains the receipt | |
| +| appconfig_cli.go:236-238 | `digest computes a digest locally. for a secret, pass the envelope that was sent and, with --sealed-to, the fingerprint it was sealed to: both are part of the stored var, and secrets set fills in sealed_to.` | `digest computes a digest locally. for a secret, pass the envelope that was sent and, with --sealed-to, the fingerprint of the key it was sealed to. both are part of the stored var, and secrets set fills in sealed_to` | Clearer description of the fingerprint | |
| +| appconfig_cli.go:1000-1002 | `versions, digests and --if-version work as for "carlos env". a secret's digest is taken over its sealed envelope, so it says nothing about the value and changes every time the secret is set, even to the same value.` | `versions, digests and --if-version work as for "carlos env". a secret's digest is computed from its sealed envelope, so it reveals nothing about the value and changes every time the secret is set, even to the same value` | Plainer wording | |
| +| appconfig_cli.go:616 | `print the bundle as JSON, with its version and every digest` | `print the bundle as JSON, including its version and every digest` | More natural phrasing | |
| +| appconfig_cli.go:1409 | `print the bundle's secrets as JSON, with its version and every digest` | `print the bundle's secrets as JSON, including its version and every digest` | Same improvement | |
| +| appconfig_cli.go:1730 | `a file holding the sealed envelope that was sent (--kind secret)` | `a file containing the sealed envelope that was sent (--kind secret)` | Plain, natural wording | |
| +| appconfig_cli.go:1686 | `%s is empty. it should hold the envelope that was sent` | `%s is empty. it should contain the envelope that was sent` | “Contain” is clearer | |
| +| appconfig_cli.go:384-385 | `removed: %s` / `not there: %s` | `removed: %s` / `not there: %s` | Keep. These are concise and distinguish the two outcomes | |
| +| appconfig_cli.go:386 | `version %s, was %s` | `version %s, before %s` | Makes the ordering explicit | |
| +| apimode.go:3069 | `the config is not at the version you sent, so nothing was written (status %d)` | `the bundle is not at the version you sent, so nothing was written (status %d)` | Consistent with the rest of the feature | |
| + |
| +The usage blocks already use lower-case fragments without final full stops, so I kept that style. |
| + |
| +### Documentation |
| + |
| +| file:line | current | proposed | why | |
| +|---|---|---|---| |
| +| docs/site/cli.md:988-1007 | `Every bundle has a version, and every var in it has a digest. They answer the question "has this changed since I last looked?" without you comparing values by eye.` | `Every bundle has a version, and every var in it has a digest. They let you check whether something changed since you last looked, without comparing values by eye.` | More direct prose | |
| +| docs/site/cli.md:1031-1043 | `carlos env digest computes a digest on your machine, with no console call, so you can compare it with the digest a listing shows.` | `carlos env digest computes a digest on your machine without contacting a console, so you can compare it with the digest in a listing.` | Smoother and avoids internal phrasing | |
| +| docs/site/cli.md:1052-1055 | `--json prints the console's answer as it is. It shows the stored layers only.` | `--json prints the console's answer as JSON. It shows only the stored layers.` | More precise and less awkward | |
| +| docs/site/cli.md:1069-1075 | `The check is made by the console against the store, so it holds even if someone else writes at the same moment. For that reason --if-version needs a console: in direct-bucket mode it is refused before anything is written. A console whose store cannot make that guarantee refuses it too.` | `The console makes the check where the bundle is stored, so it still holds if someone else writes at the same moment. For that reason --if-version needs a console. In direct mode it is refused before anything is written. A console that cannot make this guarantee refuses it too.` | Removes internal terms and improves flow | |
| +| docs/site/cli.md:1079-1088 | `Every write through a console prints a receipt of what the console stored (a direct-bucket write prints none)` | `Every write through a console prints a receipt of what was stored. A direct-mode write prints no receipt.` | Avoids internal terminology | |
| +| docs/site/cli.md:1057-1092 | `#### Writing only if the bundle has not moved` | `#### Writing only if the bundle has not changed` | “Changed” is clearer to readers | |
| +| docs/site/cli.md:1150-1152 | `The same shape as carlos env, sealed. list prints key names and never values.` | `The same commands as carlos env, with sealed values. list prints key names and never values.` | “Same shape” is vague | |
| + |
| +### Flags |
| + |
| +- The phrase “the envelope that was sent” assumes callers can retain that envelope. `carlos secrets set` does not expose it, as the docs note. Confirm that this wording is intended for scripts that perform their own sealing. |
| +- `secrets set always sends one` in the `--sealed-to` help should be checked against every supported secrets write path. |
| +- The docs say a secret digest changes every time the secret is set, including when the value is unchanged. Confirm that sealing is intentionally randomized on every write. |
| +- Confirm that `none` is the exact version value for both an absent default bundle and an absent named environment bundle. |
| +- Confirm that exit code `4` is reserved for version mismatches across both CLI and console paths. |
| + |
| +COPY PASS DONE |
| \ No newline at end of file |