carlos / platform Public

plans 6b: round-4 findings and the round-5 brief

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 51a331c28cfe4cae69fbc880f0cd663525d998c6 parent 84d70c2
2 files changed, +120 −0
  • docs/superpowers/specs/CODEX-FINDINGS-PLANS-6B-PLAN-R4.md +91 −0
  • docs/superpowers/specs/CODEX-REVIEW-BRIEF-PLANS-6B-PLAN-R5.md +29 −0

CI passed — run details

diff --git a/docs/superpowers/specs/CODEX-FINDINGS-PLANS-6B-PLAN-R4.md b/docs/superpowers/specs/CODEX-FINDINGS-PLANS-6B-PLAN-R4.md
new file mode 100644
index 000000000..97ccb530f
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-FINDINGS-PLANS-6B-PLAN-R4.md
@@ -0,0 +1,91 @@
+**Verdict: changes required** at `98fc42c8420216d0f34070ad2b179c05388fde5d`.
+
+No Critical findings. Four new Important findings and one new Minor finding follow. Calls 1–17 are treated as settled. This is a static, offline review of the plan, including its binding historical text; wording was not reviewed. Stripe’s quoted guarantees were assessed as supplied, without independently fetching their sources.
+
+| Round-3 finding | Disposition | Evidence |
+|---|---|---|
+| 1. Negative reads do not establish finality | **Partly fixed** | Subscription operations retain exclusion on negative reads ([435–461](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:435)). Checkout creation still abandons on an empty list, justified by an inaccessible eventual session rather than provider finality ([550–552](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:550)). |
+| 2. First restore can execute in the next period | **Partly fixed** | The 25-hour refusal and resend deadline constrain sending, but do not establish an execution deadline. See the timing assessment below. ([62–65](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:62)) |
+| 3. Successful sends bypass consent consumption | **Fixed** | `MarkOpApplied` is the exclusive transition and consumes authorization transactionally; failure and definite-response tests are explicit. ([430–438](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:430), [657–658](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:657)) |
+| 4. Seat-drift pass changes provider quantities | **Fixed** | The pass observes; owners explicitly match seats. Zero-write tests cover the pass. ([649–663](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:649)) |
+| 5. Healthy pending payments escalate | **Fixed** | Pending operations never escalate and have payment/expiry tests. ([452–455](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:452), [484–485](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:484)) |
+| 6. Recovered Checkout is unreachable | **Fixed** | Continue and Confirm actions, a continuation route, and a page-to-recovery test are specified. ([514–515](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:514), [558–585](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:558)) |
+| 7. Customer creation and expiry lack a lifecycle | **Fixed as reported** | Both now have persisted requests, keys and bounded retries; replacement customer attempts are an explicit orphan exception. ([544–556](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:544)) |
+| 8. List and refresh costs are understated | **Fixed for the named cases** | Lists count every examined status, including empty-list requests; Checkout includes refresh. New retry accounting remains incomplete: new finding 5. ([170–198](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:170)) |
+| Inherited discovery-cap note | **Fixed** | Task 5 explicitly migrates discovery to exhaustive enumeration and changes nothing on `ErrIncomplete`. ([362–373](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:362)) |
+
+The provider-guarantee assessment is:
+
+| Required check | Assessment |
+|---|---|
+| Same key and byte-identical parameters | Correct for the persisted subscription request. Checkout’s `House` boolean does not freeze its resolved coupon parameter; new finding 4. |
+| Resend window inside key lifetime | Nominally correct: 23 hours is below the quoted 24-hour retention. The proof needs bounded clock movement and fresh deadline checks on every attempt. |
+| Cached 500 remains unknown | Correct: no resend, unresolved exclusion, observation or operator evidence. |
+| 409 handling | Correct for a same-key request still executing. Parameter mismatch remains unresolved rather than permitting a new key. |
+| Nothing released on a negative read | Correct for unresolved subscription operations. Not universal: Checkout creation explicitly abandons on an empty list. Its safety depends on the stated inaccessible-session exception, not idempotency finality. |
+| Restore cannot first execute next period | **Not established.** The margin bounds send times, not provider execution. |
+| `MarkOpApplied` is the only applied transition | Explicitly required across definite responses, observation and operator closure. |
+| Background passes write nothing to the provider | Consistently specified for operations, intents and seat drift, with zero-write assertions. |
+
+For inherited finding 2, a restore first sent at `P − 25h30m` may be resent until `P − 2h30m`. That arithmetic is sound. It does **not** prove that a request finishes before P: none of the quoted guarantees bounds server processing time, and a client timeout does not establish cancellation. Unbounded clock skew or rollback also defeats the timing argument. The current test stops sends after renewal; it does not test a previously sent request **first applying** after renewal ([619](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:619)).
+
+Likewise, pending-update expiry bounds an update already created in P1; it does not prevent a delayed request from first creating its update in P2. This remains the inherited period-enforcement finding, not a new finding below. The schedule rejection is consistent with the quoted overwrite and pending-update cancellation behavior, but does not supply the missing execution guarantee.
+
+Only new findings follow.
+
+1. **Important — retirement retries can invalidate the checks that just passed.**
+ Task 13 checks `CancelAtPeriodEnd && !Collecting && !PendingUpdate`, **then** calls `finishOpLocked`, which can execute a previously undelivered request. It does not repeat those checks afterward. ([677–682](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:677))
+
+ A subscription has renewal stopped and an unresolved resume request that never reached Stripe. Deletion’s first read passes. Its same-key retry resumes renewal and marks the operation applied; nothing remains outstanding, so the gate succeeds. An owner with a recent authentication proof need not take another round trip: [`requireFreshAuth`](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/internal/console/stepup.go:265) immediately returns true. The account can be deleted while its subscription renews.
+
+ Finish outstanding work before the final subscription checks, and repeat enumeration/checks after any operation that can change their answer. Test this with an already-fresh authentication proof.
+
+2. **Important — reconciliation before admission removes the paid seat the admission should use.**
+ Task 11 newly requires every join to reconcile first. Reconciliation reduces quantity to existing membership, before admission considers the incoming member. ([639–651](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:639))
+
+ A buys seat eleven, but its membership write fails. There are ten members, eleven current seats and eleven paid seats. B accepts within 25 hours of renewal. Reconciliation first reduces the quantity to ten; admission then requires a restore to eleven and refuses it under the margin rule. B cannot use an already-present paid seat.
+
+ Outside the margin, this also adds a reduction and restore, contradicting the specified credit test’s single `ChangeItems` call ([657](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:657)). Consume available capacity before reducing surplus, or reconcile against the membership count including the proposed admission.
+
+3. **Important — the inherited revocation guard omits the renamed unresolved state.**
+ Revision 4 defines `opUnresolved` ([423](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:423)), but explicitly retains revision 3’s revocation behavior ([653](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:653)). That binding text at `b505823d`, Task 11, line 888 refuses revocation for `sending`, `uncertain` or `pending`.
+
+ A seat request fails before delivery and becomes `unresolved`. The retained guard permits revocation. A subsequent owner confirmation or another invite’s acceptance calls `finishOpLocked` and can execute the revoked invite’s purchase for the first time.
+
+ Use one shared outstanding-state predicate, including `unresolved`, for revocation and retry eligibility. Add the unresolved-request → revoke → later-confirm regression case.
+
+4. **Important — the persisted Checkout request does not preserve all Stripe parameters.**
+ `CheckoutRequest` persists `House bool`, while the adapter resolves the house coupon from configuration. ([304](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:304), [364](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:364)) The existing client sends the resolved coupon identifier as a request parameter. ([client.go:614](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/internal/billingstripe/client.go:614))
+
+ A house Checkout uses coupon A and loses its response. Configuration changes to coupon B before recovery. Replaying the identical stored `CheckoutRequest` now sends B under the original key. Stripe rejects the parameter mismatch, leaving the purchase unresolved.
+
+ Persist the resolved immutable request parameters, or bind recovery to an immutable configuration snapshot. Test the actual adapter payload across a configuration change; comparing only the provider-neutral struct misses this.
+
+5. **Minor — retry budgets omit the mandatory reads before resending.**
+ Invariant 1 requires a read before every resend ([53](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:53)), but `R` counts only resend requests and the action budgets add only `R`. ([172–195](/home/paulca/.cache/tmp/claude-1001/plans-6b-checkout-flow/docs/superpowers/plans/2026-10-25-plans-6b-checkout-flow.md:172))
+
+ Three retries require three prerequisite reads plus three writes: six additional requests, not three. As written, the required call-count assertions conflict with the invariant.
+
+ Count the reads explicitly, or redefine the retry term to include both requests.
+
+No tests, network calls or repository writes were made. HEAD and the clean working tree remain unchanged.
+
+---
+
+**FIRST PROMPT:**
+“Follow the brief docs/superpowers/specs/CODEX-REVIEW-BRIEF-PLANS-6B-PLAN-R4.md exactly, at the branch's current HEAD.”
+
+**WHAT:**
+Review revision 4 of the Plans 6b implementation plan.
+
+**STATUS:**
+Complete: changes required; four new Important findings and one Minor finding.
+
+**NEEDED:**
+Nothing for this review.
+
+**RECOMMENDED:**
+Resolve period enforcement and the new retry/admission defects before implementation.
+
+**SESSION:**
+Safe to close. Repository unchanged; nothing started or left running.
\ No newline at end of file
diff --git a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PLANS-6B-PLAN-R5.md b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PLANS-6B-PLAN-R5.md
new file mode 100644
index 000000000..dad5c9955
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PLANS-6B-PLAN-R5.md
@@ -0,0 +1,29 @@
+# Plan review brief, round 5: Plans 6b
+
+Round 4 reviewed 98fc42c8; its findings are
+docs/superpowers/specs/CODEX-FINDINGS-PLANS-6B-PLAN-R4.md. Revision 5 is
+`git diff 98fc42c8..HEAD`. All binding text from revisions 2 and 3 is
+now inlined: review the plan as one file. Rulings, context and
+read-only rules as in rounds 1-4.
+
+The late-restore-after-renewal case (inherited finding 2) is now an
+accepted residual risk R1 with detection (restore_after_renewal problem
+from the renewal invoice, no provider write) and a 5-minute clock-skew
+guard against the provider's Date header. Judge whether R1's detection
+is sound and complete, not whether the risk should exist. Same for R2
+(an unconfirmed Checkout create abandoned; its URL was never shown).
+
+Report:
+1. A disposition table for round 4's five findings, R1 and R2.
+2. Only NEW findings, graded Critical / Important / Minor with a concrete
+ failure scenario. Check: the fixed deletion-gate order; admission
+ never reducing; opOutstanding used everywhere including the index;
+ prepared requests resent verbatim (coupon moved to console config);
+ the read-before-resend exception for customer create.
+3. Paul must decide whether the restricted key gains Invoices read for
+ R1's detection: say if a cheaper signal exists (for example the
+ subscription's latest_invoice lines already readable, or webhook
+ payloads) that avoids widening the key.
+4. A verdict: accept, accept with fixes, or changes required.
+
+Do not review the wording.