Skip to content
Toolkit

ADR-0014: A module's status is read from the service graph, not from its declaration

  • Status: Accepted
  • Date: 2026-08-14
  • Deciders: Cardsite platform team (workstream 001-renaissance, audit 02-D1)

Context

/admin/plugins rendered a hardcoded array of nine modules and called no API. Its status rule was one line:

function isConfigured(plugin: Plugin): boolean {
  return plugin.envKeys.length === 0
}

A module was therefore reported Active precisely when the array gave it no environment keys. PWA, Email Shield, Email Signatures and Payment Processors always read Active; AI Tools, Image Optimizer, OG Images, Push Notifications and GeoIP always read inactive — on every install, however the server was configured. The page's own copy said "Plugin activation is controlled via environment variables", describing a mechanism it never consulted.

Two of the entries were worse than wrong. Email Shield read Active while requiring EMAIL_SHIELD_API_KEY, which the array did not list: an operator checking whether disposable-address filtering was on was told yes while nothing was ever checked. And "Web Push Notifications" asked for VAPID_PUBLIC_KEY and VAPID_PRIVATE_KEY, which appear nowhere in the server — subscriptions are stored and an admin can author a notification, but services/notification.go logs push_notifications not yet implemented and nothing sends one. No value of those two variables would have changed anything.

This is the failure mode AGENTS.md non-negotiable #7 exists for, in its most direct form: not a control wired to nothing, but a report of state nobody checked. The operator's decision — "is GeoIP live, or is my analytics blind?" — was answered by a literal.

The operator answered the ROADMAP's "fix or archive" with fix it.

Decision

A module's status is resolved from the objects that serve it, in the process that serves them, and reported over the admin API. Nothing in the browser decides it.

Concretely:

  1. cmd/server/plugins.go declares each module against (a) the configuration keys it reads, resolved to set/unset from the loaded *config.Config, and (b) a Live func() bool probe closing over the constructed service. The composition root is the only place holding both halves.
  2. services.PluginRegistry.List() resolves those descriptors to models.Plugin values with one of three statuses — active, inactive, built_in.
  3. GET /admin-api/v1/plugins serves them. AdminPluginsPage renders what it is given and holds no list.

Three consequences of that shape are themselves decisions:

built_in is a distinct answer from active. A module that takes no configuration has had no check performed on it, and saying "Active" would be the same claim the retired page made without evidence. "No check was needed" and "a check passed" are different statements and the page makes both.

A probe beats key presence wherever one exists. GeoIP is the case that proves it: NewGeoIPService returns nil when the path is empty or the file cannot be opened, so a set GEOIP_DB_PATH pointing at a missing database reports inactive — which is the truth an operator needs, and which no environment check could produce. The registry still reports the key as set, because that is also true; the two facts are separate fields.

A module the server does not implement is not listed. Two of the retired page's nine entries are therefore absent. Web Push is one. The other was found by an adversarial pass over the first draft of this decision: Payment Processors, which the draft listed as built_in with "each user connects their own processor". A user can indeed store processor credentials — and nothing charges anyone with them. The donation, product and service blocks the entry named render a static <div> with no control on it (BiolinkBlockRenderer.tsx), and nothing in the tree inserts a guest_payments row. Listing it would have asserted a payment path that does not exist: 02-D1, committed by its own fix, and the sharpest argument there is for why built_in had to be a claim about configuration and never about function. Both are on the ROADMAP.

Configuration values never leave the process. models.PluginConfigKey holds a key name and a boolean. The endpoint is admin-only, but a struct that cannot carry a secret cannot leak one — and the same adversarial pass showed why the struct alone is not the guarantee: Detail is free text, and the first draft interpolated cfg.GeoIPDBPath and cfg.ImageOptimizerProvider straight into it. The rule is therefore stated over the whole response and enforced there: plugins_test.go fills every string field on *config.Config by reflection and fails if any of it appears in the serialised registry. A detail may name a variable; it may not print a value.

Consequences

  • An operator's question is answerable from the page for the first time, and wrong answers now require a code change rather than an install.
  • The registry is a claim about configuration, not about function. Active means the module's service was constructed; it does not certify that anything in the product calls it. Two entries carry that caveat in their own text rather than in a footnote: Dynamic OG Images is reachable only through GET /api/v1/og-images and no surface requests one, and the PWA manifest is generated and served but linked from no public page. Both are on the ROADMAP. The alternative — a status that also asserts a caller exists — is a much larger claim than "did the service start", and would have needed a different probe for every module.
  • Status reflects the configuration loaded at startup, so an environment change applies on the next restart. The page says exactly that rather than implying a live probe. A per-request re-read would be a different and larger claim — reachability — and is not made.
  • Adding a module means declaring it in Go beside its service. That is deliberate friction: the previous cost of adding one was typing an object literal into a page, which is how nine entries came to describe four features that could not be checked and one that does not exist.
  • scripts/check-plugin-parity.mjs joins npm run verify and the design-system CI job with two rules: no configuration key that internal/config/config.go does not read (the VAPID case, generalised), and no module list back in the page (the original defect's shape). The probe invariants — a module with keys must have a check, a module with a check must say what it reads — are Go's, pinned in cmd/server/plugins_test.go where descriptors are values rather than text.
  • The retired page is archived under .archives/removal-safe/ with its nine entries intact: they are the only surviving statement of what the PHP-era plugins were meant to do, and phase 03 will want them.
  • Not settled here: the word. "Plugin" describes something an operator installs, and nothing here is installable — the PHP plugin framework did not survive the port (Audit 02). The page keeps the existing word rather than coining a new one in a slice about honesty; docs/GLOSSARY.md now records what it means in this codebase, and phase 03 owns the rename if there is one.
  • Not settled here: the integrations the registry does not list — SMTP, S3, Redis, CAPTCHA, OAuth providers and twenty-odd payment gateways all have the same shape and the same question. They are on the ROADMAP under LATER. The registry takes them without changing shape; this slice deliberately did not widen scope beyond the nine entries the finding names.

Alternatives considered

  • Re-read the environment in the handler. Rejected: it answers a different question from "did the service start". os.Getenv("IMAGE_OPTIMIZER_PROVIDER") is non-empty for provider=nonsense, which constructs no service and optimizes nothing — the same false Active in a new place.
  • Keep the list in the browser and add a /config endpoint of booleans. Rejected: the page would still own which modules exist and what they need, so a stale entry stays possible, and the endpoint becomes a general configuration read — a wider surface than the question needs.
  • A plugins table. Rejected: there is nothing to store. These modules are compiled in; a table would be a second source of truth for a fact the binary already knows, and could disagree with it.
  • Report "not implemented" for Web Push rather than dropping it. Rejected: see above. It also invites a fourth status that exactly one row would ever use.
  • Archive the page instead of fixing it — the ROADMAP's other option, and the audit's recommendation ("either wire it to real checks or delete it"). Rejected by the operator's answer. The page answers a real operational question, and with a server-side registry it costs one endpoint.

Source: docs/decisions/0014-plugin-status-is-read-from-the-service-graph.md

Library