Skip to content
Toolkit

Job 004: entitlements

Status: DONE Owner: @work, the routine

Phase: 00 — vocabulary, closed; 01 — resolution, closed; 02 — enforcement, closed: every capability is gated and rule C5 holds it; 03 — the plan form, closed: the rows draw from the registry and a grant takes effect on a running stack; 04 — the catalogue surface, closed: it says what a plan includes, what it does not and what switching changes · Status: DONE (close-out) · Updated: 2026-08-28 Scoreboard: plan_level 0 references — driven to zero by phase 02 and held there by gate rule C7, not by memory (grep -rn plan_level apps packages shared). check:entitlements reports 1 registered flag key, 7 useFeatureFlag() call sites, 1 consuming a registered key; 14 quota keys, all checked; 6 capability keys, all defaulting to deny and mirrored in both runtimes. 6 capabilities exist, all 6 enforced from 19 requireCapability() call sites, held by rule C5 rather than by memory — a key with no gate, or a gate on a key no registry defines, fails the build — finding 02-D2 is written down, gated, and refused on the write path it was found on. Six, not eight: biolinks_themes and biolinks_templates were minted against a write path this port does not have and are retired (ADR-0075).

Dependency: 003's registry — DONE (close-out), so nothing gates this track's start. Charter: ./README.md. Routine: ./ROUTINE.md (batch loop, claim refs claim/004-*, budgets — inherited from 003 unchanged). Scope and evidence: .station/jobs/001-renaissance/plans/02-entitlements.md, whose tasks 1 and 4-quota already shipped (ADR-0011, ADR-0013) and whose tasks 2, 3, 4-capability and 5 are this track's phases 00–04. Merge policy: the standing policy on ROADMAP.md.

Log discipline (inherited): Completed entries ≤ 8 lines, linking the ADR/PR that carries the narrative; ≤ 3 new open-item rows per run; Completed keeps the newest 5 entries, older ones rolling to .archives/removal-safe/.ops/projects/004-entitlements/status/SESSION-completed-2026-08-28.md.

Heading shape. This file follows 003's rather than the literal list in docs/guides/workstream.md: the routine's read budget is "from the top through the end of Next", which requires the scoreboard and the next action to come first. The standard's headings are all present, in that order.

Objective

The outcome the charter states: README.md.

Completed

  • 2026-08-28 — track closed, and 005 chartered (CLOSE). All five charter phases met the bar their own rows set, so the handoff ran as this track's last item: .station/jobs/005-i18n/ exists with a charter, a ROUTINE.md inheriting this protocol unchanged apart from the claim namespace and the scoreboard, and a SESSION.md whose "Next" is phase 00. 004 is DONE on ROADMAP; its four open items move to the standing-repairs row, where two of them wait on an owner rather than on a session.

  • 2026-08-28 — the catalogue projection (ADR-0078). GET /api/v1/plans served models.Plan unprojected, so an operator's affiliate_commission_percentage and anything else ever written into plans.settings reached every signed-in account. It now serves what the two registries vouch for — the capabilities and the quotas, by key — and nothing else. Values are copied, never coerced, and an absent key stays absent: both halves mean something by absence, and they mean opposite things. The repository's own plan is left whole; the admin surfaces still get the blob.

  • 2026-08-28 — PLAN_LIMIT_FIELDS retired, and rule Q5 (evidence .station/jobs/004-entitlements/evidence/verification-runs.md). The numeric half of AdminUsersPage's override panel now renders the served quota registry, the way the admin plan form already did — 21 keys written in the page against a 14-entry PlanQuotas, disagreeing in both directions, so eight fields were offered and counted by nothing. Rule Q5 stops the list growing back: a registered quota key spelled out in a non-test file under apps/web/src fails the build, watched failing once. Test files are exempt and only they are: a quota key is served, so a fixture has to spell one.

  • 2026-08-28 — phase 04 closed: what switching changes (ADR-0077). The third clause, and the bug that was the same missing fact: the current plan is the card whose id matches the served plan_id, never the zero-price one the old branch labelled "Current plan" for every account. Every other card marks what it adds and what it would take away, resolved by the client statement of GetEffectivePlanSettings — the plan's blob under the user's override, right-biased, === true. An unknown plan draws no comparison and calls no card current: the catalogue's form of default deny. A zero-price card gets no action; CreateCheckout refuses price <= 0.

  • 2026-08-28 — phase 04, what the plan includes (#275). Each catalogue card now lists the six capabilities, included or not, drawn from CAPABILITIES in its order — no key written in the page (rule C4), and no new fetch: GET /api/v1/plans already served the whole settings blob and the page never read it (verified on the running stack). The test is === true, character for character the server's, so an omitted key, a non-boolean and an explicit false all read not included exactly as the write path will — a catalogue resolving more generously than its gate is 02-D2 one surface over. State reaches assistive tech as a word, not a glyph.

Active

Open items

None in flight. Residue handed back to the owner is listed here, once:

  • There is no path down from a paid plan to a free one. CreateCheckout refuses price <= 0, so a zero-price card carries no action at all — which is honest, and leaves a paying user nowhere to go. The old "Current plan" label concealed it by claiming they were already there (ADR-0077). A downgrade is a server path this port does not have: one PR, and a product call about what happens to the subscription, not a button.

  • Accounts on no plan are outside the grant. plan_id defaults to 0 and no plans row carries it, so GetEffectivePlanSettings returns only the user's own blob and migration 000031 cannot reach them — three such rows on a stock seed. They are denied all eight when the gates ship; the fix is an operator assigning them a plan, not a per-user grant (ADR-0073 consequences).

  • A stale capability key in users.plan_settings outranks the plan. The override merge is right-biased, and the pre-#261 panel offered 25 booleans the server read none of, so a false written through it now denies what the plan grants. Deleting operator-entered data is its own call: one PR when the owner answers it.

  • A password cannot be cleared through the form fields. Closed as a standing repair. r.FormValue answers "" both for a field the form left empty and for one it never sent, so the handlers' pw != "" test read an explicit clear as silence. Both update paths now go through NormalizeGatePassword's three cases (ADR-0083) with presence read off the parsed multipart body — never the URL query, so no gate is taken down by a parameter appended to the address a form posts to. Clearing asks no capability, which is ADR-0076 and is what the plan that lost password_protection needs. Watched failing on both resource types.

  • Neither the file-link nor the static-page form draws a password field at all, found while closing the row above: the endpoints accept and now correctly clear one, and only an API client can send it. A control is new surface rather than a repair — one row, not a session's aside.

Blockers

(none — the one dependency, 003's registry, is DONE)

Decisions

Recorded as ADRs in docs/decisions/ and named in the close-out.

Files changed

Named per phase in the close-out and the pull requests it cites.

Verification

What was run and what it returned is recorded in the close-out and in evidence/.

Next actions

(nothing — this track is closed. All five charter phases met their own bars, the close-out records it, and the handoff to 005-i18n is done. The four open items below are each one PR, none gated this close, and they are claimable as ROADMAP standing repairs; two want an owner's answer before code — the stale-override deletion and the downgrade path.)

Source: .station/jobs/004-entitlements/SESSION.md

Library