Skip to content
Toolkit

ADR-0068 — What a block collects is registry data

  • Status: Accepted
  • Date: 2026-08-27
  • Deciders: Repository owner, track 003 phase 04
  • Follows: ADR-0030 (identity vocabularies are generated packages, runtime data is served, no dynamic code loading), ADR-0067 (a block type ships its own render descriptor)

Context

Phase 03 closed with a block type registered server-side reaching the palette, the settings form and the page with no apps/web change. What such a type still could not do is collect: the public submission handler decided that in three compiled facts.

what a submission needswhere it came from
may this type submit?a switch in form_submission.go
which keys may it send?a request struct with email, name, phone
where does it land?implicit — every submission wrote to data

The switch had drifted from the registry it shadowed: it named form, a type block_types.go does not define, so the handler accepted submissions for a block that cannot exist while declining any collector registered after the switch was written. That is what an enumeration kept beside the registry rather than in it eventually does — the same failure ADR-0056 and ADR-0067 each removed one surface earlier.

Decision

A block type's registry entry says what it collects and where the answer goes. BlockTypeInfo.Collect is a BlockCollectSpec:

  • Fields — the payload keys this type accepts, in order. A key the spec does not declare is dropped rather than stored: the registry decides what a block collects, not the request body.
  • Sink — the destination. Empty means data, the default and today the only implemented sink, which is where every collector's submissions have always landed.

The handler resolves both. A type with no spec declines submissions, as every non-collector always did. A spec naming a sink nothing implements is declined at submission time with 503 and a log line, never stored somewhere it did not ask for — the same shape as the render path declining a spec that names a kit type no kind implements (ADR-0067). Served data selects among implemented behaviours; it never supplies one (ADR-0030).

The spec ships on the block-types catalogue, beside fields and render_spec. It is deliberately not on the public page payload yet: the public collector blocks draw a prompt and no form — they have never submitted anything — so putting the spec there would wire a surface to nothing. Whichever slice builds the public form is the one that serves it.

Consequences

  • A collector type registered in block_types.go collects, with no change to the handler and no route in main.go. That is phase 04's bar for the half of it that exists: the destination is data.
  • The three collectors now declare the fields their names promise — email_collector takes name and email, phone_collector name and phone, contact_collector all three. The old struct accepted all three keys for all of them, so a phone number posted to an email collector was stored; it is dropped now. Nothing in this repository submits to that endpoint, so the narrowing changes no shipped behaviour, and a collector storing keys it does not collect is a data-protection surprise, not a feature.
  • form is no longer accepted. It was never a registered type; a request naming it now gets the same 400 any other unregistered type gets.
  • The remaining compiled fact about a collect is formatSubmissionMessage's switch, which shapes the notification text, not the destination. It stays until a slice needs it; the session file carries the row.
  • One sink is implemented. Adding a second (a webhook, an email, an external list) is a slice that registers a sink and gives some type a spec naming it — not a change to how destinations are declared.

Source: docs/decisions/0068-what-a-block-collects-is-registry-data.md

Library