Skip to content
Toolkit

ADR-0074 — A block type declares the capability it needs

  • Status: Accepted
  • Date: 2026-08-28
  • Deciders: Track 004 phase 02
  • Follows: ADR-0072 (a capability is a subsystem this port has), ADR-0073 (every plan that predates enforcement grants everything), ADR-0030 (identity vocabularies are generated packages, runtime data is served)

Context

Every registered block type carried PlanLevel — "free", "pro" or "ultimate" — served to the client as plan_level, where BlockTypePicker drew a PRO or ULT badge from it. Sixty-three of the eighty-five types were marked non-free. The create path read none of it: POST /api/v1/biolink-blocks accepted any registered type from any user on any plan. That is finding 02-D2 — a badge that gates nothing — in its original location.

Two things were wrong, not one.

The enforcement was missing, which phase 02 exists to fix. But the vocabulary was wrong too, and fixing only the first would have hard-coded the second: there are no tiers in this product. A plan is an admin-created row with a name the operator chose (ADR-0013); nothing anywhere ranks plans, and nothing can, so "ultimate" could never resolve to a rule. Gating on the ladder would have meant inventing a tier order in code to compare against — a product decision made by a comparison operator.

Decision

BlockTypeInfo.PlanLevel is replaced by BlockTypeInfo.Capability: the capability key this type requires, or empty for a type every plan includes. The 63 premium types declare premium_blocks; the other 22 declare nothing. plan_level is gone from the repository, wire included — the field, the TypeScript type, the badge, the fixtures.

Three consequences of shape follow:

  1. The registry says which types cost something; the handler says what. models.BlockTypeRequires(input.Type, models.CapabilityPremiumBlocks) selects, and the gate beside it names the key as a literal — requireCapability(w, r, h.capabilities, userID, "premium_blocks") — so an enforcement site is still findable by reading the handler, which is what rule C5 will parse. A gate whose key arrives only through a variable is a gate nobody can audit.
  2. One badge, because there is one gate. The picker draws PREMIUM on a type that declares a capability, and never compares to a key: rule C4 forbids spelling one out under apps/web/src, so presence is the whole test. The word is the glossary's — premium is the qualifier, never pro, ultimate, or paid.
  3. Two gate rules go live. C6: a block type may not declare an entitlement the capability registry does not define. C7: no surviving reference to plan_level, unconditionally. Both watched failing — evidence .station/jobs/004-entitlements/evidence/verification-runs.md.

Enforcement is create-only, per the charter, with one boundary made explicit: an existing premium block stays readable, editable and deletable, but an update that changes a block's type to a premium one takes the same gate. It is a creation wearing an update's clothes, and leaving it open would have made the create gate decorative — the exact defect being repaired.

Alternatives

  • Keep plan_level and gate on "not free". Rejected: it keeps a tier vocabulary the product does not have, and every future reader has to learn that two of its three values mean the same thing.
  • A premium bool on the type. Simpler, and wrong at the next step: themes and templates have their own capability keys, and a boolean cannot say which entitlement a thing needs. Rule C6 exists because the answer must be a key from the registry.
  • Resolve the key from the registry at the call site (no literal in the handler). Rejected: it is one variable away from a gate that cannot be found by reading the code, and C5's whole method is reading the code.

Consequences

  • The scoreboard number the track was built around moves: plan_level 12 references → 0, held by rule C7 rather than by anyone remembering.
  • check:entitlements now reports 63 of 85 block type(s) declare a registered capability. A change to that number is a change to what every plan includes, and TestBlockTypeRegistry_Capabilities asserts it.
  • A premium block created before the plan withheld the capability keeps rendering on the public page — nothing about display consults the gate. The catalogue surface that explains why a type is unavailable is phase 04's, not this slice's.
  • Clients reading plan_level off the block-types endpoint break. It has one consumer, BlockTypePicker, in this repository; the field was never documented as public API.

Source: docs/decisions/0074-a-block-type-declares-the-capability-it-needs.md

Library