Skip to content
Toolkit

ADR-0077 — The current plan is an identity, not a price

  • Status: Accepted
  • Date: 2026-08-28
  • Deciders: Track 004 phase 04
  • Follows: ADR-0072 (a capability is a subsystem this port has), ADR-0073 (every plan that predates enforcement grants everything)

Context

Phase 04's outcome has three clauses: the catalogue says what a plan includes, what it does not, and what upgrading changes. The first two shipped from plans.settings alone (#275). The third is a comparison, and a comparison needs a second operand the page did not have: which plan the viewer is on.

PlansPage had a stand-in for it, and the stand-in was wrong. The action slot branched on the price:

price > 0 ? <Button>Subscribe</Button> : <div>Current plan</div>

So every zero-price plan was labelled "Current plan" for every account, including accounts that had never been on it, and a paying user was offered no row to act on at all. The label named an identity and the branch read a number that is not one. It is 02-D2's shape a third time — a surface asserting an entitlement fact it never checked — and it had to be repaired by the slice that needed the same missing fact, not before it.

The fact is already served: GET /api/v1/account/plan returns plan_id alongside plan_settings, and usePlanInfo already reads it for PaymentsPage. Nothing needed adding to the wire.

Decision

The viewer's plan is read by identity. The card whose plan.id equals the served plan_id is the current plan; nothing else on the page decides it, and price decides nothing. That card gets the label, no checkout action, and no comparison — it is what the other cards are compared against.

The comparison is the server's own merge. What the viewer holds today is plans.settings for their plan with users.plan_settings layered over it, right-biased key by key, each side taken only if it is a JSON object — the client statement of GetEffectivePlanSettings, including its '{}' for an account on no plan (plan_id 0, which no plans row carries). Each key is then resolved with === true, the same test the rows themselves use and the same one CapabilityService.Allows uses.

Both directions are shown. A capability this plan adds is marked New with this plan; one the viewer holds and this plan withholds is marked You have this today. A card that changes nothing says so in a line rather than leaving the reader to notice an absence of marks.

An unknown plan draws no comparison. If the read is loading, failed, or names a plan the catalogue does not serve — inactive or withdrawn, so the plan half of the merge is out of reach — the page draws the includes/does-not list and nothing else, and calls no card current. This is the catalogue's form of the rule the gates hold on the write path: an unresolved capability is never an accidental grant, and here an unresolved plan is never a guessed one.

A plan with no price for the selected frequency gets no action. CheckoutHandler.CreateCheckout refuses price <= 0 with 400, so a button there would be wired to a door that does not open (and the old label was covering exactly that hole). Moving down to a free plan needs a server path that does not exist; it is recorded as an open item rather than mimed.

Alternatives

Serve an is_current flag on each plan. The server knows both facts, and one boolean would be simpler than a merge in the client. But it answers only the first clause: the delta needs the viewer's resolved settings anyway, and GET /api/v1/plans over-serving the raw settings blob is already an open item — widening that response is the wrong direction until the catalogue DTO lands. Then this becomes a server projection, and this ADR is what it implements.

Compare against the plan's blob without the user override. Simpler, and wrong in the direction that matters: an operator-entered false in users.plan_settings outranks the plan, so the page would report the viewer holding what the write path refuses them — a promise of a loss they would not suffer, or a gain they already lack.

Show only the gains. The persuasive reading, and a catalogue that names only what a switch adds hides what it takes away. Both directions, or the surface is marketing rather than entitlement.

Guess the current plan while the read is in flight. Any guess is the bug this replaces, wearing a shorter timeout.

Consequences

The page reads one more query it already had a hook for; no endpoint, type or migration changes.

PlansPage now has a notion of the viewer's plan, so the next entitlement surface that needs one has a precedent rather than a second stand-in.

The two open items this leaves are named in 004's SESSION: GET /api/v1/plans still serves the whole settings blob to any signed-in account, which this slice now reads rather than merely exposing; and there is no path down from a paid plan to a free one, which the old label concealed and this one makes visible.

Source: docs/decisions/0077-the-current-plan-is-an-identity-not-a-price.md

Library