Audit backlog wave 3, evidence area:
- dedupeDraws keys on (root_seed, shots, successes) [approved]: only
a bit-exact repetition of the whole draw is dropped — the same seed
with a different stopping point executed different measurements and
now pools as new evidence. Node-lane assertions added; F8
demo-archive numbers verified unchanged.
- Sparkline stops flattening sub-unit series (QuCAD loss traces);
divide-by-zero guard only fires on a truly flat trace
- KvRow never prints "[object Object]" (nested objects/arrays
JSON-stringify, truncated); viz fmt + CircuitDiff gateDiffOf
unexported (dead exports)
- QuBound/QuCAD NaN payloads render as absent ("—"), not "NaN" tiles;
Qshot's headline fidelity joins the % convention (formula + pilot
table keep the author's raw-unit notation); CI line tabular-nums
- fidelity histogram says what it hides ("+k more outcomes · n shots
not listed"); ReplicateStrip excludes errored runs, highlights the
newest matching dot with an ep…
Three concrete refactors that reduce surface area for future bugs and
make the codebase easier to maintain by hand or by LLM.
1. backend/app/services/workflow_service.py — run_pipeline and
run_pipeline_stream used to be two 100+ line copies of the same
dispatch loop. Extract a single _execute_pipeline generator and
make both functions thin wrappers (one collects into a list, the
other yields). Per-node dispatch (input / built-in / plugin /
skipped) and the post-step circuit_shape stamping are factored
into _dispatch_one_node. Plugin hydration becomes a named helper
instead of an inline block duplicated on both paths.
Also pulled out _clamp_shots and _set_backend_ctx so the two
backend handlers share their shots-clamping and ctx-writing
patterns; _cache_put's prefix_types argument becomes required
(all call sites pass it; the dead 'None means skip sidecar'
branch is gone); the run_cache.qpy_dump_bytes import moves to
the top of the file with the …