plans 6b ledger: tasks 5 and 6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+10
−0
docs/superpowers/notes/plans-6b-ledger.md+10 −0
CI failed — run details
diff --git a/docs/superpowers/notes/plans-6b-ledger.md b/docs/superpowers/notes/plans-6b-ledger.md| index ff9365cfe..f55265a97 100644 |
| --- a/docs/superpowers/notes/plans-6b-ledger.md |
| +++ b/docs/superpowers/notes/plans-6b-ledger.md |
| @@ -15,3 +15,13 @@ Task 3: complete (commits 0d8b37fd, 11958b6c; review clean after fix round 1 of |
| Task 4: naming: billing.ErrNoProviderTime (exported; the plan's errNoProviderTime); CallsBy counts invoice pages as RenewalInvoice and line pages as RenewalInvoiceLines (an I(v,l) budget adds both); PayPending/ExpirePending are Fake methods; billingtest.ErrCrash is deliberately outside the outcome classes, so the console's send must stop and record nothing more on it. |
| Task 5 pre-dispatch Ruling: Stripe's invoice list has no billing_reason filter, so RenewalInvoice pages the subscription's invoices and selects billing_reason=subscription_cycle with the given period start client-side; the budget's L(v) counts those pages — cost if wrong: none, the request count is the same or lower. |
| Task 5 pre-dispatch Ruling: an idempotency parameter mismatch is a distinct exported error (logged, op left unresolved) rather than a panic inside library code; tests assert the error — the plan's "panic in tests" is met by tests failing on it — cost if wrong: a test helper. |
| +Task 4 review Ruling (carried into Tasks 7 and 9): a send that returns an error outside the outcome classes (billingtest.ErrCrash, a crash) returns at once, records nothing more and is not retried, so the row stays sending — Task 7's "otherwise: unresolved" covers the outcome classes only; this is what TestCrashBeforeSendRecovered requires and is safe in production because a sending row seen under the hold is adopted as unresolved (Invariant 9) — cost if wrong: one branch in sendOpLocked. |
| +Task 4 review Ruling: CustomerCheckouts' createdAfter bound is inclusive (created at or after; the adapter sends created[gte] truncated to the second), because the bound is the intent's whole-second provider stamp and a strict bound can hide the session just created, which would wrongly trigger Invariant 1's abandonment exception — cost if wrong: one extra session examined. |
| +Task 4: complete (commits f6be6b69, 740badea; review clean after fix round 1 of 5: Send outage is ErrNoResponse, inclusive checkout bound, key age from first request, Renew advances the provider clock, Check honours headerless) |
| +Task 5: naming: billing.ErrIdempotencyMismatch; ProviderConfig.PortalConfiguration / HouseCoupon / PriceIDs; exported ValidPortalConfiguration / ValidCouponID; new file internal/billingstripe/prepared.go. net/http's automatic POST resend is disabled (GetBody = nil) so an idempotent request is sent exactly once per Send. RenewalInvoice matches the subscription_cycle invoice whose period_end equals the renewal boundary (Stripe's cycle invoice period looks back one period) and skips proration lines. Discovery on ErrIncomplete syncs nothing and counts as a failed pass. CARLOS_STRIPE_PORTAL_CONFIGURATION is now required with billing on (a 6c rollout step). |
| +Task 5 review Ruling: discovery on ErrIncomplete syncs nothing but counts as a failed pass (so 6a's discovery_failing problem opens after 24 such passes) — "logs and changes nothing" is read as "changes no billing or plan state"; telling an operator is what an observing net is for — cost if wrong: one line. |
| +Task 5: Ruling (fix round 1): every POST goes through a separate write client with keep-alives off and HTTP/1.1 only, so net/http never resends a keyed write (an empty-body expiry is otherwise replayable as http.NoBody whatever GetBody says); reads keep pooled connections — cost if wrong: one connection setup per write. A 409 is ErrInFlight only for the same-key cases (idempotency_key_in_use, idempotency_error), any other 409 ErrNotExecuted (fact 2). The house coupon must also carry no max_redemptions or redeem_by. 6a's uncalled CreateCheckout and its tests are deleted. |
| +Task 5: complete (commits 51d23d88, af3b406a; review clean after fix round 1 of 5) |
| +Task 6: naming: Store.BeginRetirement already exists (lifetimes), so the billing methods are BeginBillingRetirement / EndBillingRetirement / BillingRetiring (Task 13 uses these). PutCheckoutIntent refuses to change an intent's stored create or expiry request and refuses to replace a creating or open intent. The seat reset compares against the stored billingAccount.Plan. |
| +Task 6: carry-forward: putBillingState writes the customer-create and seat-drift columns back from prev on every sync, so every later writer of those columns (Task 9's customer create, Task 11's drift pass) must hold the account's billing lock. |
| +Task 6: complete (commit 66b266f2, review clean) |