Skip to content
Toolkit

007-enforcement — what a plan bills, the serving path delivers

Status: ACTIVE · Phase: DEFINE · Chartered: 2026-08-29 · Starts: now — nothing gates it; 004's capabilities are DONE and the gate password is already a digest (ADR-0083)

Problem

Four features are authored, stored, in some cases billed, and then ignored by the code that serves the request. The full statement is the product gap assessment .archives/removal-safe/docs/assessments/PRODUCT-GAP-ASSESSMENT-082926.md §Route, §Gate, §Measure and §Address; it is not restated here. Each finding was re-verified on this tree (4aea6b5) rather than inherited:

  1. Routing is stored, never applied. links.display_rules has a schema (migrations/000013), a working matcher (services/display_rules.go), an editor, and a targeting_is_enabled capability charged on the write (handlers/links.go). Match has exactly one caller — public_biolink.go:111, for blocks. redirect.go reads link.DisplayRules nowhere, and neither StartDate/EndDate (both real columns on models.Link) nor settings.clicks_limit / settings.expiration_url (both collected by lib/linkForm.ts) are consulted on the redirect path.
  2. The gate is authored, never enforced. password and sensitive_content are accepted for file links, static pages and events behind requireCapability(..., "password_protection"). redirect.go has no password branch, no sensitive-content branch, and no unlock endpoint exists in either tree. The plaintext half of this defect is closed — services/link_password.go stores a bcrypt digest and the anonymous payload is an allowlist (ADR-0083) — which leaves a digest nothing ever compares against.
  3. Splash pages are a table and an FK. links.splash_page_id is written and repository/splash_pages.go serves the CRUD; the redirect path routes splash_page through default: to a plain 302, so the interstitial the type is named for never renders.
  4. Pixels are configured, never emitted. links.pixels_ids is written by handlers/links.go:180 and typed in apps/web, with a whole /pixels surface behind it. Repo-wide, no serving path reads the column.
  5. Domain verification performs no lookup. repository/domains.go:165-179 sets is_verified = TRUE unconditionally; handlers/domains.go:267 sets the struct field to match. No DNS call exists anywhere in apps/api.

The inversion is the track's bar: 004 made plans express what they include and enforced it on the write path. Nothing yet enforces it where the visitor arrives. A customer can buy audience targeting and a password gate and receive a 302 that ignores both.

Objective

Every control this product sells is exercised by the serving path, on the request that reaches a visitor — targeting and schedules decide the destination, gated resources refuse it until unlocked, splash pages render, configured pixels fire on the surfaces that can carry them, and a domain is verified only when DNS says so. A stored setting with no serve-path reader is not enforcement, and the gate this track mints says so in the build.

Phases

PhaseWhatDone when
00 — The enforcement ledger and its gateMint scripts/check-enforcement-parity.mjs and the registry behind it: one row per enforcement point — what is authored, where it is stored, which serving path must read it, which capability bills it. Default state is unenforced, mirroring the capability registry's default denyThe gate is watched failing on a deliberately broken input (a point whose named reader is deleted); npm run check:enforcement prints N of M enforced and the number is committed, so no later phase can claim a point without a reader
01 — The redirect path decidesredirect.go evaluates link.DisplayRules through the existing DisplayRulesService, then StartDate/EndDate, then settings.clicks_limit, before it chooses a destination. expiration_url is the fallback the data already collectsOn a running stack, one link serves two destinations by device/country/language, a scheduled link 404s outside its window, and a link at its click limit serves expiration_url — each asserted against a database read, not rendered text
02 — The interstitialsOne interstitial mechanism on the redirect path, three reasons, one slice per reason: password (with POST unlock verifying the ADR-0083 digest and issuing a short-lived scoped grant), sensitive content (warn, continue or leave), splash (splash_page_id renders, then continues)A live E2E per reason. For the password reason the bar is stronger: the destination appears in no response — payload, header or HTML — until a correct unlock, and a wrong password is refused at a rate limit
03 — Pixels fireConfigured pixels_ids emit on the public surfaces that can carry a tag — the biolink page and the phase 02 interstitials. A bare 302 has no document to emit from; that constraint is the phase's decision, recorded rather than worked aroundA pixel configured on a resource is present in the served document for that resource and absent for one without it, proved on a running stack; the ledger row flips
04 — A domain is verified when DNS says soVerify performs a real lookup — a token record the UI shows the operator — and sets is_verified only on a match, with the failure surfaced. The handler stops asserting the field it did not checkVerification of an unpointed host fails, and of a correctly pointed host succeeds, against a live resolver in the test's own fixture; existing rows are handled per the backfill decision below

Phase 00 comes before the rest for 004's reason: a scoreboard minted after the work measures nothing. 01–04 are independent of each other and may be claimed in any order once 00 lands; 02's three reasons are three PRs.

Out of scope

Public renderers for vCard, event, file and payment links, and the @slug card view — track 008, which this track deliberately precedes; an interstitial is not a renderer. Subdomains and the URL lifecycle — 009. ACME/SSL certificate issuance: the three SSL columns stay façade in this track, and saying so is not fixing it. A campaign entity or cross-resource analytics — §Measure's other two gaps; only pixel emission is here. New capabilities: this track enforces the six 004 minted and mints none.

Blockers — owner decisions

Named, not invented. The buildable remainder proceeds around both.

  1. Existing is_verified = TRUE rows when phase 04 lands. Every domain verified by the no-op carries a badge nothing checked. Options: (a) leave them, and verify only on the next explicit request; (b) reset all to false, forcing re-verification; (c) reset only rows whose DNS does not currently match. Recommendation: (a) — nothing in the serving path reads the column (requestDomainID resolves on is_enabled), so no behaviour changes either way, and (b) flips a badge on every existing customer domain with no notice. Phase 04's lookup is buildable before this is answered; only the migration waits.
  2. What a sensitive-content interstitial asserts. A content warning (continue / leave), an age gate (18+), or both — and whether an acknowledgment is remembered per visitor. The wording carries legal weight the repository cannot infer. Recommendation: a content warning with continue/leave and a per-resource acknowledgment cookie, no age assertion — nothing in the tree collects a birthdate, so an age gate would be a claim the product cannot substantiate. Phase 02's password and splash reasons are unaffected.

Verification

Gate — scripts/check-enforcement-parity.mjs (phase 00), in npm run verify. It must fail when an enforcement point loses its serving-path reader, when a point is marked enforced without one, and when a capability bills a control no point covers — the shape of check-entitlement-parity.mjs rule C5, one layer further out.

Tests. Go: table-driven coverage of each new redirect branch, including the order they compose in (a scheduled, targeted, gated link). Unit: the interstitial surfaces. Live E2E per new surface in apps/web/tests/e2e-live/, asserting a database read per docs/guides/workstream.md.

Evidence. evidence/ carries every gate-failure observation and running-stack proof, one file per phase.

Merge policy: the standing policy on ROADMAP.md.

Risks

RiskMitigation
Enforcement lands on the redirect path and breaks links that work todayEvery branch is opt-in on data that is absent for the overwhelming majority of rows: no rules, no dates, no limit, no password means the current path, byte for byte. Each phase is one revertible slice
A gated destination leaks before the unlockPhase 02's bar is the absence of the destination from every response, not the presence of a form — the same shape as ADR-0083's allowlist, which is why the payload is already narrow
The ledger becomes a second place to define capabilitiesIt defines enforcement points and references capability keys by the vocabulary package; a point that invents a key fails the gate
Pixel emission becomes a script-injection surfaceEmission is by pixel id through a known provider vocabulary, never operator-authored markup; the registry rule (docs/guides/workstream.md) applies
Real DNS verification blocks a working custom domainServing is gated on is_enabled, never on is_verified, and this track does not change that — see blocker 1

Source: .station/jobs/007-enforcement/README.md

Library