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
- Spec arrivesA layout spec names its kind, sizes and items.
- GateOnly kinds with recorded evidence are compiled. Anything else is refused, with no override.
- CompileThe fast compiler writes the output.
- VerifyThe output is parsed and every box is compared with the reference geometry, in pixels.
- CanarySeparately, the stored corpus is re-run through the reference to see whether the reference changed.
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.
- row✓enabled
- specref
- specref
- specref
- specref
Four pairs recorded, at least three. The kind is compiled.
- column✓enabled
- specref
- specref
- specref
Three pairs recorded. The kind is compiled.
- table…needs 3 pairs
- specref
- specref
- empty
Two pairs recorded. One more is needed, so the kind stays off.
- overlay×refused: no evidence
- empty
- empty
- empty
No pairs recorded. A spec of this kind is refused, with no override.
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.
- 12 identical
- 0 differed
- 2 refused by design
The rules were written while looking at this set.
- 6 identical
- 0 differed
Written after the compiler, so these specs were unseen when the rules were written.
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