---
name: expectation-derived-from-code-under-test
description: "A decision-table test that computes its expected value by CALLING the function under test is a tautology - widen the function and the expectation widens with it, staying green."
metadata: 
  node_type: memory
  type: feedback
  originSessionId: e21dcd87-246c-49d1-971c-1b4d9202b840
  modified: 2026-08-19T05:29:34.013Z
---

A table test whose EXPECTED value is derived from the code under test cannot fail for the
reason it exists. Measured 2026-08-18 (KEYSTONE W1 T1, `wan.rs`): my custody table looped the
six `WanRequestOutcome` variants and branched `if outcome.took_custody() { expect a row } else
{ expect none }`. Mutating `took_custody` to admit `Refused` as custody — a real security
widening — passed **3/3 GREEN**. The expectation moved with the predicate.

The fix is an INDEPENDENT LITERAL: write the partition out by hand (`(Delivered, true),
(Refused, false), …`) and assert BOTH arms against it — the predicate against the literal, and
the write against the literal. The first catches a wrong classification; the second catches a
correct classification wired to nothing. Same mutation then reddened exactly that one test.

**Why:** enumerating the whole population felt like the rigour (see
[[hand-built-walk-is-not-an-enum-pin]]), so I believed the table was strong and would not have
re-examined it. Exhaustive over the variants and self-referential in the verdict are
independent properties, and only the second decides whether the test can fail. Compile,
coverage and `traceable-reqs check` were all blind: the tags were correct, the stages covered,
exit 0 throughout.

**How to apply:** at the ACT of writing any decision-table / classifier / predicate test, ask
where the expected value comes from. If it is a call into the subject (or into a helper the
subject also calls), it is not an expectation — it is a restatement. Hard-code it. And run the
mutation anyway: this one survived my own review and died in one control run
([[make-a-new-rig-red-on-purpose]]). Report it when it happens — a control that catches YOUR
test rather than the product is the control doing its job, not an embarrassment to bury.
Related: [[mutate-the-defect-not-the-trigger]], [[test-name-asserts-what-fixture-never-creates]].
