Test discipline
How this project decides what "worked" means. Two rules — one about which failure modes get named, one about how substrate-quality claims are validated. Both rules are cheap; both were expensive to learn.
Rule 1 · Name the failure, twice
The pattern: anti-collapse test + toward-target test. Both must be green. Each red points at a different defect class.
| Test | What it guards against | Fails when |
|---|---|---|
| Anti-collapse | Death — network collapses to uniform firing | Trained L1 < 30% of baseline L1 |
| Toward-target (null discriminator) | Absence of learning — decay-with-bias reads as steering | Real training doesn't beat shuffled-label null across 10 seeds |
The anti-collapse test alone passes when nothing is learned. It will keep passing when the topology work lands and does nothing. That's why it needs a companion. The pattern generalizes: any claim of the form "X works" needs both "not-X hasn't happened" AND "X specifically has happened, not something that resembles it from outside."
Rule 2 · Substrate claims need a null control
Origin story: an earlier version of the toward-target test XPASSed on seed 29 with +0.65 signed movement. That was updated in the moment as "the loop is steering." A 10-seed sweep with a shuffled-label null retracted the claim — the null won by a factor of 90×. See The substrate finding.
The rule has three parts because each part catches a distinct failure mode:
- ≥10 seeds — single seeds are inside plausible noise for stochastic networks. Distributions are evidence; values are anecdote.
- Null control (shuffled labels) — differentiates "the system produces X in response to Y" from "the system happens to produce X." Same dish, same training, same trials — only the labels destroyed. If the null matches, learning didn't happen.
- Normalization against total activity — a decaying network produces smaller absolute values on every metric. Toward-target signed movement can rise in absolute terms while shrinking as a share of total activity. Normalizing catches this.
Baking all three into the test itself — not into an analysis notebook — is what keeps the discipline enforceable after the writer leaves.
The 16-test suite
Grouped by what they guard:
Substrate mechanics (5)
test_dish_initializes_with_expected_shapestest_dish_produces_spikes_under_strong_stimulationtest_dish_is_deterministic_for_a_seedtest_stdp_moves_weights_after_repeated_stimulationtest_harness_infer_returns_int_or_minus_one
Router (3)
test_router_sends_pattern_tasks_to_wetwaretest_router_sends_language_tasks_to_silicontest_router_defaults_to_silicon_on_no_signal
Training + stability (5)
test_fep_trainer_records_statstest_stimulate_without_plasticity_leaves_weights_unchangedtest_apply_feedback_does_not_write_stdptest_weight_decay_shrinks_weightstest_homeostatic_scaling_normalizes_row_sums
Persistence (1)
test_save_load_roundtrip_preserves_state— bit-identical weights, RNG state restored, subsequent stimulate produces identical spike trajectory
Substrate claims (2)
test_fep_stability_knobs_prevent_catastrophic_collapsepasses — anti-collapsetest_fep_loop_moves_output_toward_target_electrodesxfail(strict) — null discriminator; flips to assert-pass when curated topology lands
Total: 15 pass 1 xfail(strict). Runtime under 20 seconds including the 10-seed sweep.
On xfail(strict=True)
@pytest.mark.xfail(strict=True) means the test is expected to fail AND an unexpected pass hard-fails CI. This is the right shape for an open commitment.
A test marked xfail without strict=True silently accepts either outcome. That is worse than no test at all — it encodes "we don't care about this property" while looking like caring. strict=True says: "when this passes, that IS the event, and CI must fail so the human notices and either removes the xfail marker (locking in the new invariant) or investigates the false pass."
The toward-target test uses this. When curated topology is added and real training genuinely beats the shuffled-label null, the test will XPASS, CI will fail red, and the next commit removes the xfail marker and turns it into an ordinary assert. The invariant is now enforced going forward.
This is how the promise stays enforceable across sessions, contributors, and quarters — the test itself carries the commitment, and pytest's strict mode makes silent drift impossible.