plans: Astra round 1 findings on platform accounts slice 1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/plans/ASTRA-FINDINGS-platform-accounts-1-r1.md+23 −0
Intent
<task-notification> <task-id>b0sy7t009</task-id> <tool-use-id>toolu_01WNpvq2frU85Rj5TKRU5VGJ</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/9284fe97-c7c7-4e03-80f2-87c51eb0406d/tasks/b0sy7t009.output</output-file> <status>completed</status> <summary>Background command "Wait for Astra round 1 to finish" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 4.94 g CO₂e (562,813 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-platform-accounts, 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/ASTRA-FINDINGS-platform-accounts-1-r1.md b/docs/superpowers/plans/ASTRA-FINDINGS-platform-accounts-1-r1.md| new file mode 100644 |
| index 000000000..a462c86ac |
| --- /dev/null |
| +++ b/docs/superpowers/plans/ASTRA-FINDINGS-platform-accounts-1-r1.md |
| @@ -0,0 +1,23 @@ |
| +Reviewed `2871ba184d98774a9033e49037b4d9510a7913b4` read-only. No tests run. |
| + |
| +1. **P1 — Tasks 4, 5, 8: a failed create breaks idempotency and the customer cap.** |
| + **Invariant:** one live account per platform reference; pending creates consume capacity. |
| + [Task 8:520](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-platform-accounts/docs/superpowers/plans/2026-11-19-platform-accounts-1-platform-layer.md:520) writes the manifest before inserting the row, but checks references and capacity only in SQLite. If the insert fails, a retry mints another account: [`NextAccountID`](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-platform-accounts/internal/domains/mint.go:184) advances past the stranded manifest. On restart, Task 4’s conflicting-reference recovery materializes both accounts and drops one reference. With `max_customers=1`, this produces two customers. Recover the persisted mint before accepting another create, retaining its sqid and counting it toward capacity. Add a failure-injection test covering insert failure, retry, and restart; the planned concurrency test covers only successful inserts. |
| + |
| +2. **P1 — Tasks 4, 10: minting can escape the revocation sweep.** |
| + **Invariant:** re-granting must not restore credentials issued under revoked authority. |
| + [Task 10:645](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-platform-accounts/docs/superpowers/plans/2026-11-19-platform-accounts-1-platform-layer.md:645) checks the grant at the door but specifies no transactional recheck during token insertion. Authentication happens once before the handler ([`authcli.go:503`](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-platform-accounts/internal/console/authcli.go:503)). A mint can pass the gate, pause, then insert after `RevokePlatformGrant` has revoked existing rows. Re-granting makes that unswept token usable. Validate the live link, grant, and minter’s current authority atomically with insertion; carry the minter identity or grant generation needed to reject stale requests. Test a paused mint across revoke and re-grant. |
| + |
| +3. **P1 — Tasks 8, 9: platform deletion races customer creation.** |
| + **Invariant:** a platform with customers cannot be retired. |
| + [Task 9:582](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-platform-accounts/docs/superpowers/plans/2026-11-19-platform-accounts-1-platform-layer.md:582) adds count checks, but browser deletion does not take the platform lock used by customer creation. [`deleteAccountNow`](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-platform-accounts/internal/console/ownership.go:183) checks, tombstones, then deletes rows. A customer inserted after the first check causes the transactional deletion to refuse **after the platform manifest is tombstoned**. Startup then reaps the platform ([`materialize.go:125`](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-platform-accounts/internal/console/materialize.go:125)), stranding its customers. Serialize deletion and creation through the same lock, and recheck platform liveness after acquiring it. Add an interleaving test. |
| + |
| +4. **P1 — Task 12: the host handler mutates before its safety checks.** |
| + **Invariant:** refused service requests must not write control-plane policy. |
| + [Task 12:737](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-platform-accounts/docs/superpowers/plans/2026-11-19-platform-accounts-1-platform-layer.md:737) calls `writeEnableManifest` before delegating to instance creation. That helper writes, audits, and bumps the serial ([`apiinstances.go:3841`](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-platform-accounts/internal/console/apiinstances.go:3841)); the service/control-plane refusal occurs later, in the delegated handler at line 1597. A control-plane app without a manifest therefore gets a policy write despite the refusal. The sequence also omits `beginCopiesMutation`, which the existing enable path takes before using these helpers at line 3697. Move the relevant admission checks before the first write and preserve the helpers’ locking contract. Make the planned control-plane test assert that the manifest, audit, and serial remain unchanged. |
| + |
| +5. **P2 — Tasks 10, 14: the second-customer test can pass without isolation.** |
| + **Invariant:** the witness must distinguish authorization failure from resource absence. |
| + [Task 14:838](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-platform-accounts/docs/superpowers/plans/2026-11-19-platform-accounts-1-platform-layer.md:838) requests `c2/site/channels`, but creates `site` only in `c1`. Even with broken account binding, [`apiAccountAppSaying`](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-platform-accounts/internal/console/apicli.go:95) returns 404 for the missing app. Create `site` in both accounts through their own credentials, prove each succeeds locally, then assert cross-account reads and writes fail. |
| + |
| +NOT READY |
| \ No newline at end of file |