lumbda/tests/sweep-doctrine
russell@unturf.com 1665893321
factory + quantum + sweep-doctrine: AGPLv3 share-back from foxhop ecdsa
29 new files publish factory infra (V2 autoscaler with live VRAM
sampling + EWMA peak tracking, HUGE solo-dispatch, two-tier DLQ/rDLQ
classifier + retry), general quantum circuit primitives (Cuccaro
ripple-carry adder, Clifford gate library, Clifford tableau simulator,
mod-arith family, dialog GCD reversible inverse, Karatsuba multiplier,
Solinas fast reduction), and a TCRAUDT reducer harness. Originally
developed in ~/git/www.foxhop.net/ecdsa/ for secp256k1 attack-surface
research; published upstream as obligated by AGPLv3.

Parametrization contract at factory/CONTRACT.md. Consumers export
LUMBDA_REPO_DIR + LUMBDA_QUEUE_DIR + LUMBDA_BACKEND_CMD + LUMBDA_EMITTER_CMD
then exec factory scripts. No fork-and-modify; single source of truth
upstream.

Integration tests gate 7 V2 defect classes that wedged a live factory
on 2026-06-12 (skewed-demand starve, zero-floor reservation,
multi-tier greedy, +-25%% damping, cold-start ramp, DLQ surge halve,
post-damp CPU ceiling) + 28 DLQ classifier cases (auto-retry vs
escalate partition) + bash -n syntax lint across every script.

GPU backend stays in consumer trees; rationale in
factory/GPU-BACKEND-NOTE.md. Bend wire protocol + gpu-worker.lsp
already upstream at examples/cuda-fanout/.

make factory-lint                bash -n on every factory/*.sh
make test-integration            V2 reducer + DLQ classifier + syntax gate
make sweep-doctrine              TCRAUDT reducer gate (serial)
make sweep-doctrine-parallel     xargs -P fan-out

Verified on neoblanka: factory-lint 12 scripts PASS; test-integration
14 V2 cases + 28 DLQ classifier cases + 12 syntax cases all PASS.
2026-06-14 10:37:35 -04:00
..
lib.lsp factory + quantum + sweep-doctrine: AGPLv3 share-back from foxhop ecdsa 2026-06-14 10:37:35 -04:00
README.md factory + quantum + sweep-doctrine: AGPLv3 share-back from foxhop ecdsa 2026-06-14 10:37:35 -04:00
run-parallel.sh factory + quantum + sweep-doctrine: AGPLv3 share-back from foxhop ecdsa 2026-06-14 10:37:35 -04:00
run.sh factory + quantum + sweep-doctrine: AGPLv3 share-back from foxhop ecdsa 2026-06-14 10:37:35 -04:00

sweep-doctrine — TCRAUDT reducer library

Test-Case Reducers Are Underappreciated Debugging Tools. Source: Laurie Tratt 2026-01 essay, building on Zeller delta-debugging + Regehr C-reducer. Reduce a failing probe to a 5-line test, commit it as institutional memory. Tests outlive every sweep agent's working memory.

Discipline

5 phases (mandatory for every defect):

  1. Reproduce at full production scope first — verify defect, capture failing output.
  2. Reduce inputs to smallest case that still triggers — peel flags, widths, iters, params.
  3. Commit reducer to tests/sweep-doctrine/ — NEVER in runs/ (runs/ stays ephemeral; reducers outlive sweeps).
  4. Fix defect.
  5. Verify reducer flips EXPECTED-FAIL → PASS. make sweep-doctrine exits 0.

Test format

Each test-*.lsp prints exactly one verdict line:

DOCTRINE <name> PASS got=<actual> expected=<expected>
DOCTRINE <name> EXPECTED-FAIL got=<actual> expected=<expected>  ; known open defect, alarm acknowledged
DOCTRINE <name> FAIL got=<actual> expected=<expected>  ; regression — gate fails

Shared helpers in lib.lsp — assertions, fresh-register builders, expected-truth-table comparators.

Runner

make -C ~/git/lumbda sweep-doctrine           # local, all reducers
make -C ~/git/lumbda sweep-doctrine REMOTE=user@host  # via SSH

Backed by run.sh (serial) + run-parallel.sh (xargs -P fan-out).

When reduction stops shrinking, escalate

Reducer that pins a trigger pair without root cause = building on sand — gate stays green while wrong-output ships. Escalate:

  • Unit — fire suspect primitive on register state mimicking callsite geometry. Compare bits to reference.
  • Integration — emit one iter of suspect operation, read every intermediate register. First divergent register names broken step.
  • Functional — full operation at small width with record-register-state! at iter N. Iter where divergence first appears names failure mode.

Reducer = alarm. EXPECTED-FAIL = alarm acknowledged, not silenced. Don't promote any change touching a primitive whose reducer stays EXPECTED-FAIL.

Hard rules

  • Reducers belong in tests/sweep-doctrine/; ephemeral sweep artifacts (probe scratch, dispatched cells, per-sweep RESULTS) belong in consumer-side runs/ directories. Never invert.
  • make sweep-doctrine exit 0 iff every test produced expected outcome (PASS for positive controls, EXPECTED-FAIL for known open defects).

License

AGPLv3.