plans 6b ledger: task 7
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+11
−0
docs/superpowers/notes/plans-6b-ledger.md+11 −0
diff --git a/docs/superpowers/notes/plans-6b-ledger.md b/docs/superpowers/notes/plans-6b-ledger.md| index f55265a97..34b1899c7 100644 |
| --- a/docs/superpowers/notes/plans-6b-ledger.md |
| +++ b/docs/superpowers/notes/plans-6b-ledger.md |
| @@ -25,3 +25,14 @@ Task 5: complete (commits 51d23d88, af3b406a; review clean after fix round 1 of |
| 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) |
| +Task 7: naming: MarkOpApplied(opID, provedPeriodEnd, now) carries the proving period end (stored as billingOp.AppliedPeriodEnd) so R1 can tell "applied in its own period"; opOutcome is a struct {State, Indeterminate, Replayed}; consumeSeatAuthorisationTx is a no-op inside MarkOpApplied's transaction until Task 11 adds the invite columns; billingCopy is created in billingpage_copy.go with the change.* keys; the restore stall opens restore_check_stalled once (stalled_at); operation_unresolved, restore_after_renewal and restore_check_stalled are closable while the subscription is live; TestRecoveryEligibleIsTheOnlyGate requires one Send call site per billing function, gated by recoveryEligible. |
| +Task 7 review Ruling (plan-level gap in R1 step 4): an applied op sent in the new period "explains" a quantity above the renewal baseline only if the quantity it started from (recorded on the op at prepare time) is at or below the baseline and its target is at or above the current quantity; anything else flags restore_after_renewal — the looser reading let a charge built on a late-restored quantity clear the obligation after an invoice-read failure, defeating R1's "survives failures" — cost if wrong: a false restore_after_renewal an operator closes. |
| +Task 7 review Ruling: sendOpLocked itself refuses the first send of an opRestore inside the 25 h provider-time margin (defence in depth for Invariant 4; Tasks 10 and 11's handlers still check first) — cost if wrong: none, the handlers' check is the same rule. |
| +Task 7 review Ruling: an open obligation whose period never moves (subscription ended at period end) or whose subscription the provider no longer has still stalls at provider PeriodEnd + 7 d, since R1 states the stall unconditionally — cost if wrong: one operator problem. |
| +Task 7: fix round 1 (commit 01658e63): Important 1 and Minors 1-8 addressed plus rulings (a)-(c); Minor 9 (split billingops.go) deferred. restoreStallsForMissing (billinglate.go) takes the hold on the pass's 404 path; TestBillingHoldMintedOnlyByHoldBilling forbids billingHold{} outside holdBilling. |
| +Task 7: carry-forward (Tasks 10, 11): every handler that prepares an op must record billingOp.StartQuantity (the item's current quantity); an unset 0 reads as "started at or below any baseline" and weakens ruling (a). |
| +Task 7: carry-forward (Task 10): the restore-margin refusal uses copy key change.near_renewal, which Task 10 adds to billingCopy. |
| +Task 7: carry-forward (Task 13): an operation_unresolved problem on a deleted account cannot be closed (500, no forged hold), so deletion settles or abandons the account's ops first. |
| +Task 7: fix round 2 (commit e0a7e4a9): billingOp.StartQuantity is *int64, nil = unknown, stored -1 (column default in CREATE and ALTER); an unknown start never explains a raise; sendOpLocked refuses a quantity op without a known start; TestBeginBillingOpOnlyFromSend pins sendOpLocked as BeginBillingOp's only production caller. |
| +Task 8 Ruling: the past-due notice key is notice.collecting, not the brief's notice.past_due — Task 7's TestConsoleBillingHasNoProviderWords forbids provider status words in console billing code, and the provider-neutral core rule outranks a key name — cost if wrong: none, keys are internal. |
| +Task 7: complete (commits 20ff2c27..e0a7e4a9, review clean after fix round 2 of 5; Minor 9 deferred) |