Skip to content

Commit d1af752

Browse files
authored
docs(payments): require admin-page sync on money-model changes (#366)
1 parent 1d2973e commit d1af752

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

src/payments/AGENTS.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,31 @@ keys. The `consume` key is client-supplied by the assistants harness
130130
one key.
131131
5. Test balance movement, idempotent replay (same key → no double move), and
132132
floor behavior on debits.
133+
6. Did the change alter the balance model, add a `GrantKind` / `LedgerReason`,
134+
or touch entitlement math (not just add a flow)? Update the credits admin
135+
page too — see the next section.
136+
137+
## The credits admin page mirrors this domain — keep it in sync
138+
139+
`src/api/v2/credits-admin/` is a live read/write mirror of the ledger: it shows
140+
`getBalance`, the `CreditLedger` history, per-period consume sums, and the
141+
subscription entitlement view, and it mutates through `grant` / `adjust`. It is
142+
**not** generated — it hard-codes the current balance model, so it drifts
143+
silently when the model changes underneath it.
144+
145+
Any change to how credits are stored, computed, or displayed MUST carry a
146+
matching update to the admin page, or its numbers become a lie:
147+
148+
- New `GrantKind` / `LedgerReason` → surface it in the ledger view.
149+
- Changed meaning of `getBalance` / spendable, or a removed derived path →
150+
update the balance cards and their labels. (The Option-B → single-ledger
151+
migration left "Spendable (derived)" and "Raw parked balance" cards rendering
152+
identical numbers precisely because this step was skipped.)
153+
- Changed subscription entitlement math (tier grant, period, forfeit) → update
154+
the subscription view and per-period figures.
155+
156+
Treat the admin page as part of the blast radius of any money-model change, the
157+
same as any downstream consumer.
133158

134159
## Deeper reference
135160

0 commit comments

Comments
 (0)