Skip to content
Toolkit

ADR-0122 — A kind is unhosted until the product decides what its bytes are called

Status: Accepted · Date: 2026-08-30 · Track: 010 artifact hosting, phase 00 · Supersedes: nothing · Related: 0089, 0096, 0103

Context

Every track since 004 has minted its scoreboard before its work, for a reason each of them recorded: a ledger written afterwards describes what was built rather than measuring it. 007 minted enforcement points, 009 minted lifecycle states. This track's subject is different from both in one way that changes what the ledger has to hold.

Every previous track's inputs came from the product's own forms. This one's arrive as an archive somebody else built. A biolink block's settings were typed into a field the product drew; a zip's entry names, declared sizes, internal paths and first bytes were all written by a stranger, and every one of them is a thing a serving path could be tempted to trust. The tree already shows what that temptation looks like when it is resisted: stored_static.go declares staticPageContentType as a constant and says why in a comment — the branch serves HTML and only HTML, so the type is a property of the branch. Nothing enforced that. The next serving path could read the type off the upload and the build would stay green.

So a hosting ledger that only counted served kinds would count the right rows and miss the defect.

Decision

A kind is unserved until a named serving path reads it — and a served kind names the place the product decides what its bytes are called. The ledger (scripts/hosting-ledger.json, gated by scripts/check-hosting-parity.mjs) carries five rows, html alone served, and each served row names four things plus a fifth for archives:

  1. its store — the path that accepts and writes the bytes;
  2. its serving path — deleted from under a flipped row, the build fails (ADR-0089's rule, one subject over);
  3. its bound — the code that refuses an oversized upload before the first byte is written, named in its own half so deleting the cap fails the build;
  4. its content-type decider, with the expressions it is allowed to set; and
  5. hostile fixtures, for a bundle or an asset row, because those two kinds are the ones hostile input is aimed at.

Rule H7 is the one this ADR exists for. Every Content-Type a serving path sets must be an expression its row declares, and no serving path may call http.DetectContentType. Sniffing at upload, to check that a declaration agrees with the bytes, is the store half's job and stays (F-6). Sniffing at serve, to decide what to say, is the artifact deciding — which is the thing the whole track is organised against.

A slice that genuinely needs a new content type does not fight the gate: it adds the expression to the row, where a reviewer sees the product making that choice on purpose.

Consequences

  • The scoreboard is one number from one script — served over kinds — and it rises only in the commit that adds a serving path. It starts at 1 of 5: html, which 008 shipped and which this ledger describes rather than plans.
  • The caps are visible as constants. Unlike 009's windows, a limit already exists here (services.MaxUploadSize, 10 MB), so the ledger does not forbid a served row while the configuration file is missing — it names the key the cap will be read from, points bound at the constant that stops the upload today, and counts rows reading configuration in a second committed number, configured, which is 0. The gate recomputes both: nobody converts a cap without moving the count, and nobody moves the count without converting a cap. Phase 04 moves it from 0.
  • No number for a cap is in the ledger. What a plan may store is the charter's Blocker 2, an owner decision; a ledger carrying a value would be this track answering it. A row names a key, or an explicit null.
  • The rule constrains phases 01–05 rather than describing them: Markdown may not be handed over as the author's HTML, an SVG may not be inlined on the origin where sessions live (ADR-0096/0103), and a bundle entry's content type is decided per entry from the product's own table rather than from the name inside the zip.
  • Watched failing nine ways before it was merged (evidence .station/jobs/010-artifact-hosting/evidence/phase-00-gate-watched-failing-2026-08-30.md), including the two that matter: the author's declared type written into the response, and a serving path that sniffs.

Source: docs/decisions/0122-a-kind-is-unhosted-until-the-product-decides-what-its-bytes-are-called.md

Library