Skip to content
Toolkit

ADR-0137 — Whose plan applies is one function, and the answer is not this session's

Status: Accepted · Date: 2026-08-30 · Track: 011 phase 04 · Supersedes: nothing · Builds on: ADR-0130, ADR-0135, ADR-0136

Context

Eighteen quota axes ask the same question before they refuse anything — whose plan bounds this write? — and before this phase they answered it eighteen times, in three shapes that did not agree:

  • fifteen per-account axes called check(ctx, userID, …) with no workspace in the call at all;
  • seats and custom_slugs (011 phases 02–03) read the actor's plan against the workspace's count;
  • storage (010 phase 04) did the same for bytes.

The disagreement is not cosmetic. workspace_id has been the access boundary since migration 000026, so under the middle two shapes a member with a generous plan raises the ceiling of any workspace they are added to, and a workspace's limits depend on which colleague happens to click. Which shape is right is the charter's Blocker 4 — an owner decision, with the workspace owner's plan recommended — and a session may not answer it. But the thing that makes the question expensive is not that it is unanswered: it is that answering it, whenever the owner does, would have meant editing three check paths and fifteen methods, and that a nineteenth axis would arrive with a nineteenth answer.

Decision

The question gets one site, and the answer one function, before anyone decides what the answer is.

PlanLimitService.planSettingsFor(ctx, actorID, workspaceID) is the only place a plan is read for a quota, and it resolves the holder through holderOf (PlanHolderFunc) before it reads anything. Every axis shape goes through it: check passes a workspace of 0, checkScope and checkPending pass the workspace they are bounding.

actorHoldsThePlan is the default holderOf, and it returns the actor — exactly what all eighteen axes did before this commit. Nothing this phase touches changes what any axis decides, which is the whole of what it claims. The recommended answer to Blocker 4 is then a change to that one function, plus the lookup it would need; it is not a change to any axis.

Three consequences worth stating:

  1. A workspace of 0 is not a fallback. A per-account axis counts what the actor owns across every workspace, so the actor is the subject of that question rather than a default for a missing one. The zero says the axis has no workspace, not that it forgot to pass one.
  2. The resolution fails open, like every quota read here: a holder that cannot be resolved unlimits rather than refuses. That is 004's deliberate inverse of a capability's default deny, and a resolution failure must not become a refusal nobody sold.
  3. Capabilities are not in this seam. CapabilityService reads GetEffectivePlanSettings about the actor too, and the same question applies to it; it is one axis-family over and stays an open item rather than being swept into a phase whose bar is quotas.

Consequences

The ladder ledger's plan_scope rung is a resolution: it closes on there being one place, not on a new refusal. That needed a gate rule of a shape this repo had not written — R7, the single-site rule — because every other rule in check-ladder-parity.mjs asserts a presence, and a presence cannot say "and nowhere else". What undoes a resolution is an extra call: a nineteenth axis reading a plan on its own authority adds a line, breaks no anchor, and would be invisible to R2. R7 counts instead, holding .GetEffectivePlanSettings( and s.holderOf( to exactly one occurrence each in plan_limits.go.

Watched failing three ways (evidence .station/jobs/011-plan-ladder/evidence/phase-04-plan-scope-watched-failing-2026-08-30.md): a second axis reading a plan for itself (R7 counts two), the resolution bypassed with the read left in place (R7 counts none, R2 loses its anchor), and a per-account axis handing the resolution an id that is not a workspace — which the gate cannot judge and the phase's own test names.

Source: docs/decisions/0137-whose-plan-applies-is-one-function-and-the-answer-is-not-this-sessions.md

Library