Skip to content

case study

Refuse by default: a build that only handles what it has evidence for

My role: I built this in 2026 as a demonstration of a design pattern. It works on an invented layout format, uses no client or employer material, and the source is public.

Scope and constraints

Ownership
A solo demonstration on an invented format. Not client or employer work.
Scale
A compiler, a reference renderer, a corpus, a canary, a verifier and tests.
Constraints
An unsupported input must never be guessed at, a change in the reference must be noticed, and the output must be checked with numbers.
Judgment calls
No override for refusal, a minimum of evidence before a kind is enabled, and in-sample and held-out results reported separately.

What was delivered and checked

  • In the stored corpus, 12 pairs were identical, none differed and 2 were refused by design.
  • Six held-out specs, written after the compiler, were all identical.
  • Tests cover refusal with no bypass, the corpus, the canary detecting a changed reference, the verifier detecting a one-pixel move, and the minimum-evidence rule.

What it is

A build tool that turns layout specs into positioned HTML. It is built to show one habit: do not guess. It compiles only the kinds of input it has recorded evidence for, and it checks its own work against a stored corpus, a canary and a numeric verifier.

The path of one build

  1. Spec arrivesA layout spec names its kind, sizes and items.
  2. GateOnly kinds with recorded evidence are compiled. Anything else is refused, with no override.
  3. CompileThe fast compiler writes the output.
  4. VerifyThe output is parsed and every box is compared with the reference geometry, in pixels.
  5. CanarySeparately, the stored corpus is re-run through the reference to see whether the reference changed.
Each step can stop the build. Refusal cannot be overridden.

The corpus and the gate

Each pair stores a spec and the reference output. A kind needs at least three pairs before it can be enabled, and a kind without evidence is refused.

Sample data. Each stored pair is a spec and its reference output; a kind needs at least three pairs before it can be enabled.

In-sample and held-out results

Results are reported in-sample and held-out separately. The held-out specs were written after the compiler and are reported on their own line.

The counts are the ones stated in the measured results above. Bar length is the number of specs, on one scale for both rows.

Decisions

  • Refuse by default, with no override

    A kind is compiled only if the corpus holds recorded evidence for it, and no option or flag turns that off. An override would turn "no evidence" into "trust me", so a kind without evidence is refused.

  • A corpus of stored pairs, and a minimum before a kind is enabled

    Each pair stores a spec and the reference output. A kind needs at least three pairs before it can be enabled, because one or two can pass by coincidence. The three is a deliberate judgement.

  • A canary for the thing I do not control

    The reference stands in for an external tool that could change. The canary re-runs every stored spec through it and fails if the output differs. A refresh is a deliberate, separate command.

  • Verify with numbers, not by eye

    The compiled output is parsed and each box is compared with the reference geometry, with a default tolerance of zero pixels. A build stamp that changes every run is ignored. The parser reads the compiler’s own output format.

  • Report in-sample and held-out separately

    Results are reported in-sample and held-out separately, with the held-out specs written after the compiler. The held-out set is reported on its own line.

Scope

  • An invented layout format

    The layouts are invented so the method is the subject.

  • Supporting a new kind is a deliberate step

    Supporting a new kind means writing a rule, recording at least three pairs and enabling it in one file.

Source and tests

The source, the corpus and the tests are in the evidence-gated-build repository, under the MIT licence. npm test runs the tests.

Stack

  • Node.js
  • JavaScript
  • Node test runner

More case studies

    Engineering notes: the decisions behind the work