carlos / platform Public

plans 6b: round-2 findings and the round-3 brief

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev c2e313e3aa9191b70c04a5d0b577f6ce8148f6d2 parent b505823
2 files changed, +143 −0
  • docs/superpowers/specs/CODEX-FINDINGS-PLANS-6B-PLAN-R2.md +114 −0
  • docs/superpowers/specs/CODEX-REVIEW-BRIEF-PLANS-6B-PLAN-R3.md +29 −0

CI failed — run details

diff --git a/docs/superpowers/specs/CODEX-FINDINGS-PLANS-6B-PLAN-R2.md b/docs/superpowers/specs/CODEX-FINDINGS-PLANS-6B-PLAN-R2.md
new file mode 100644
index 000000000..be60fa5c5
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-FINDINGS-PLANS-6B-PLAN-R2.md
@@ -0,0 +1,114 @@
+**Verdict: changes required** at `d705d1c72af56009708c9ea3b808a7741565f253`.
+
+No Critical findings. Eight new Important findings and one Minor finding follow. All sixteen accepted calls are treated as settled; wording was not reviewed.
+
+The dispositions below assess the revised plan, not an implementation.
+
+| Round-1 finding or gap | Disposition | Plan evidence |
+|---|---|---|
+| 1. Billing-lock deadlocks | Fixed | Explicit lock order, typed hold, locked sync split and timeout tests: [145–155](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:145), [637–738](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:637). |
+| 2. Concurrent admissions | Partly fixed | Ordinary admissions serialize and restore capacity first, but recovered `applied` operations bypass capacity checks: [1026–1039](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:1026). New finding 3. |
+| 3. Durable invite consent | Partly fixed | Stored authorization and token-bound operations are specified; recovering admission remains unsafe: [1006–1039](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:1006). New findings 1 and 3. |
+| 4. Previous-period allowances | Partly fixed | Fresh requests apply the current period first, but saved operations can replay previous-period restores: [156–159](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:156), [703–721](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:703). New finding 2. |
+| 5. Pending-payment double submits | Partly fixed | Unique outstanding-operation indexes and settlement rules address ordinary retries, expiry and reordered delivery. Replay parameters are not immutable: [694–721](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:694). New finding 1. |
+| 6. Second live subscription | Partly fixed | Scheduled cancellation and completion during expiry are handled, but live-subscription enumeration is incomplete: [499](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:499), [885–887](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:885). New finding 4. |
+| 7. Uncertain Checkout creation | Partly fixed | Intent persistence, same-key resumption and discovery are specified, but recovery and intent lifecycle have new failures: [863–904](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:863). New findings 5–8. |
+| 8. Deletion fencing | Partly fixed | Durable retirement and a second gate address local races. Incomplete enumeration can allow unsafe deletion; completed intents can prevent safe deletion: [1112–1134](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:1112). New findings 4 and 7. |
+| 9. Resolving `seats_unpaid` | Fixed | Automatic resolution and a reason-specific close path preserve the other close gates: [1041–1051](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:1041). |
+| 10. Membership changes bypassing transitions | Fixed | Before/after counts, revision and lapse updates are transactional; server and CLI paths are covered: [365–393](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:365). |
+| 11. Carrying a newly created item ID | Partly fixed | Successful steps persist the returned ID, but replay after losing that response can change an add into an update: [703–706](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:703). New finding 1. |
+| 12. Disk ruling | Fixed | Accepted Call 7 is explicit; disk is excluded from pooled limits: [60–65](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:60), [261–276](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:261). |
+| 13. Malformed and fixed currencies | Fixed | Explicit invalid values remain refusals; fixed currency is rendered and rechecked under the hold: [795–803](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:795), [884](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:884). |
+| 6a integration | Partly fixed | The requested atomic write, discovery, replacement and closure tests are specified. Checkout’s use of `freshenLocked` conflicts with ended-subscription state: [568–626](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:568). New finding 5. |
+| Payment fake and tests | Partly fixed | Pending payment, expiry, response loss and parameter-sensitive idempotency are modeled. Missing cases include failure before delivery and recovery across a period boundary: [466–484](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:466). |
+| Readiness tests | Fixed | Wrong mode, disabled payment-method updates, invalid coupons, missing house coupon and no-session refusals are covered: [540–552](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:540), [920–921](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:920). |
+| Census | Fixed | Final-diff derivation, envelope review and the separate record-write gate are explicit: [1184–1188](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:1184). |
+| Provider neutrality | Fixed | Lifecycle facts come from the adapter; console policy uses those facts: [177](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:177), [579](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:579). |
+| Request budget | Partly fixed | Readiness backoff and publication costs are corrected. New retirement and recovery paths exceed their stated allowances: [180–197](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:180). New finding 9. |
+
+Only new findings follow.
+
+1. **Important — operation replay changes the request under the same idempotency key.**
+ Task 7 rebuilds each request from the latest read and supplies `ProrationDate: now` on every attempt ([703–709](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:703)).
+
+ In the specified restore-three-then-buy-four case, the add-three request succeeds but its response is lost. The saved operation still has `Done=0` and no item ID. Recovery finds the newly created item and resends step zero as an **update**, with a different proration timestamp, under the original **add** request’s key. The fake’s own idempotency contract rejects that parameter mismatch. Recovery cannot reach the charge step.
+
+ Persist each step’s exact provider request before its first send, including item identity or absence, price ID and proration timestamp. Test recovery with an advanced clock and a lost add response.
+
+2. **Important — recovery can execute a free restore in a different billing period.**
+ Task 7 persists precomputed steps without the period or allowance that justified them, then resumes any unfinished operation younger than 23 hours ([669–678](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:669), [719–721](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:719)).
+
+ An account has paid for three packs in period P1 but reduced its subscription to one. A restore-to-three operation is saved immediately before renewal, then the process crashes before sending it. Renewal bills one pack. Recovery correctly freshens the row to P2, but then executes the saved `ProrateNone` restore to three. Two packs are granted for the new year without payment.
+
+ Bind operations to the subscription period and authorization context. Distinguish recovering an already-sent result from executing an unsent step whose allowance has expired. Add the same boundary test for seats.
+
+3. **Important — an applied invite operation is treated as a permanent admission entitlement.**
+ Task 11 jumps directly from `BillingOpForInvite(...).State == applied` to membership creation, skipping outstanding-operation and capacity checks ([1030–1039](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:1030)).
+
+ With ten members, invite A pays for seat eleven, but membership creation fails. Invite B then joins using the free eleventh seat. A retries and takes the `applied` shortcut: twelve members now occupy eleven paid seats, despite both accepts holding the member lock.
+
+ Recovering payment must still recheck present capacity and restore the renewal quantity where necessary. Either reserve capacity for the paid invite until admission or define how another admission consumes it. Test A’s failed membership write, B’s admission, then A’s retry.
+
+4. **Important — one page cannot establish that all live subscriptions are safe.**
+ Task 5 explicitly implements `LiveSubscriptions` from one `status=all` page ([499](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:499)). Checkout and retirement then treat its result as exhaustive ([885–887](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:885), [1112–1115](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:1112)).
+
+ A customer has an older renewing subscription behind a page of newer ended subscriptions. The list returns no live IDs. Retirement can delete the account while the older subscription keeps renewing; Checkout can also miss an unrecorded live subscription.
+
+ Page to completion with a bounded, fail-closed limit, or return an explicit incomplete-result refusal. Test a live subscription on page two.
+
+5. **Important — the new freshening invariant prevents returning customers from purchasing.**
+ `freshenLocked` requires `PaidPeriodEnd` to match the provider’s period end ([157](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:157)). Task 9 calls it for every recorded subscription before checking whether that subscription remains live ([886](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:886)).
+
+ On an ended subscription, 6a deliberately clears `PaidPeriodEnd` ([billingsync.go:124](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/internal/console/billingsync.go:124)). An ended provider subscription retaining its period end therefore fails the equality check after every fresh read. The customer cannot reach replacement Checkout.
+
+ Separate general subscription refresh from the paid-allowance invariant required for quantity changes. Test a new purchase after cancellation with the old subscription still recorded.
+
+6. **Important — the hourly intent pass cancels Checkout while the buyer is using it.**
+ Task 9 runs `resolveIntentLocked(..., want=nil)` for unresolved intents. That resolver expires any open session whose request does not match `want` ([869–878](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:869)).
+
+ Checkout starts seconds before the hourly pass. While the buyer enters payment details, the pass expires their valid one-hour session. This also happens on worker startup.
+
+ Give background observation a separate mode from explicit replacement or retirement. An ordinary reconciliation pass should preserve an unexpired open session. Test a pass immediately after Checkout starts.
+
+7. **Important — a successfully completed intent can permanently block retirement.**
+ Task 13 accepts an intent only when resolved to `expired` or `abandoned`; completed Checkout is synced and refused ([1112–1115](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:1112)). Task 9 retains the completed intent and returns `intentPurchased` whenever its session is complete ([871–874](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:871)).
+
+ An owner buys normally, later stops renewal, and has no collecting payment or outstanding operation. Deletion still encounters the original completed Checkout and refuses indefinitely.
+
+ Distinguish a newly discovered completion from an already reconciled terminal intent. Once reconciled, evaluate the resulting subscription against the retirement rules. Test purchase → completed intent → stop renewal → delete.
+
+8. **Important — the 23-hour resume rule can replay an already expired, never-executed Checkout request.**
+ Intents expire after one hour, but an intent without a session is resent unchanged for 23 hours ([863–868](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:863)).
+
+ The intent is saved, then the process crashes before the provider receives the request. Recovery starts two hours later. There is no cached successful response to recover, and the persisted `ExpiresAt` is already past. Replaying that request cannot create a usable session; the plan provides no resolution before the 23-hour abandonment threshold.
+
+ Specify recovery for requests that never executed, including expired request parameters and definitive creation refusals. Extend the fake beyond “apply, then lose response” to cover failure before delivery.
+
+9. **Minor — the revised request budget omits work required by its new algorithms.**
+ The deletion allowance is **2–6 requests** across two gates ([193](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:193)), but each gate must additionally read every live subscription returned by the list ([1113](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:1113)). Its formula needs a subscription-count term.
+
+ Likewise, the hourly budget specifies intents younger than **25 hours**, while Task 9 selects **seven days**; it allows one operation resend although the runner can execute both remaining steps. Resolving a sessionless intent can require create/replay, session inspection and expiry, exceeding the two-request allowance.
+
+ Express these costs by branch and cardinality, then assert provider-call counts in the recovery and retirement tests.
+
+This was a static review. No tests or repository changes were made. The initial coordination command attempted a network request and was blocked by the sandbox; no further network calls were attempted.
+
+---
+
+**FIRST PROMPT:**
+“Follow the brief docs/superpowers/specs/CODEX-REVIEW-BRIEF-PLANS-6B-PLAN-R2.md exactly, at the branch's current HEAD.”
+
+**WHAT:**
+Review revision 2 of the Plans 6b implementation plan.
+
+**STATUS:**
+Complete: changes required; eight new Important findings and one Minor finding.
+
+**NEEDED:**
+Nothing to complete this review.
+
+**RECOMMENDED:**
+Fix immutable operation replay, period-bound recovery and recovered admission first; then correct Checkout lifecycle and retirement enumeration.
+
+**SESSION:**
+Safe to close. Working tree and HEAD unchanged; no processes started or left running.
\ No newline at end of file
diff --git a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PLANS-6B-PLAN-R3.md b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PLANS-6B-PLAN-R3.md
new file mode 100644
index 000000000..10b527f59
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PLANS-6B-PLAN-R3.md
@@ -0,0 +1,29 @@
+# Plan review brief, round 3: Plans 6b
+
+Round 2 reviewed d705d1c7; its findings are
+docs/superpowers/specs/CODEX-FINDINGS-PLANS-6B-PLAN-R2.md. Revision 3 is
+`git diff d705d1c7..HEAD`. Rather than patch each scenario, it removed
+the replay machinery and states six invariants at the top of the plan
+(no replay; recovery re-reads provider truth; operations bound to
+subscription + period, one provider request each; capacity decided at
+admission; exhaustive enumeration or refusal; background passes only
+observe; reconciled intents are history). Context, rulings and
+read-only rules are as in rounds 1 and 2. Some unchanged draft strings
+and one-line assertions point back to revision 2 at c86d0692; read them
+there and say only if one is now inconsistent.
+
+Report:
+1. A disposition table for round 2's nine findings and its partly-fixed
+ gaps (payment fake cases, request budget).
+2. Check the six invariants hold across every task: name any path that
+ still resends after a returned call, executes a step outside its
+ period, decides capacity from stored state, treats a partial list as
+ complete, or lets a background pass mutate provider state.
+3. Only NEW findings, graded Critical / Important / Minor, each with a
+ concrete failure scenario.
+4. Call 17 (unclear outcomes: refuse changes, re-read after 10 minutes,
+ operator problem after an hour) is a pending decision for Paul: say
+ whether the recommendation is safe.
+5. A verdict: accept, accept with fixes, or changes required.
+
+Do not review the wording.