Skip to content
EN · PT

Gate: mock-stamped

The double’s stamp matches the real snippet (recomputed, not just validated).

Property Value
Checker mock-stamped
Confronts test
Blocking by default — new project yes
Blocking by default — existing project no — informs
Presupposes derived.mock_detect — until these are declared in anchors.yaml, the gate is pending and asks nothing

Confronts a test against the question no other ruler asks about a test double: the double claims to replace a snippet of the real module — is it still the snippet that exists today?

It is the AGNOSTIC half of the pair that attacks mock drift. mock-typed solves the problem where the language helps — structural types let the compiler check the module’s surface — and only there: most ecosystems have no Partial<typeof X>, and not even in TypeScript does it reach the SHAPE of the returned VALUE. Measured: 202 tests doubled a React Query hook with two fields where the real one returns about 15, and the type does not tell “deliberate partial” apart from “out of date”.

The stamp does not interpret the code: it READS it. A text hash catches any change — signature, body, type, constant — and works in Python, Ruby, Go or plain JS, with no per-language extractor.

The gate RECOMPUTES instead of validating format, and that is what makes the mechanism resistant to whoever writes it. A stamp nobody confronts is theatre: whoever edits the test would regenerate it to match their own mock, and it would start certifying itself.

What separates it from its neighbours: unit-complete asks whether the test exists, feature-test-match confronts scenario against case, tests-green reads the run — all three answer “yes” about a double that froze a contract which no longer exists. mock-typed demands the TIE to the real module; this gate demands the recomputable MARK of the snippet.

gates:
- name: mock-stamped
on: [test]
check: mock-stamped

Source: checker · its spec