diff --git a/quon_qec/src/experiment.rs b/quon_qec/src/experiment.rs index 3fd29b6..c9e93cd 100644 --- a/quon_qec/src/experiment.rs +++ b/quon_qec/src/experiment.rs @@ -478,15 +478,13 @@ fn emit_stim_single_block_memory(expanded: &ExpandedWorkload) -> Result Result LatticeSurgeryCtx<'a> { /// Stim state for one single-block memory circuit. /// -/// The builder still writes the header, the final measure line, and closing -/// detectors. Round impls append construct locals, memory rounds, and the -/// measure-logical record. [`emit_observable_include`] writes the observable. +/// The builder still writes the final measure line and closing detectors. +/// [`emit_single_block_header`] writes the comment preamble before this +/// context exists. Round impls append construct locals, memory rounds, and +/// the measure-logical record. [`emit_observable_include`] writes the observable. pub(crate) struct SingleBlockCtx<'a> { pub(crate) out: String, pub(crate) n_checks: usize, @@ -750,4 +781,30 @@ mod tests { ExperimentError::MissingDataMeasurement { atom: 99 } )); } + + #[test] + fn single_block_header_matches_gold_preamble() { + let mut out = String::new(); + emit_single_block_header(&mut out, "repetition", 3, 2, "z"); + assert_eq!( + out, + "# Quon QEC experiment — structure only (no noise; ADR-0024)\n\ + # family=repetition distance=3 memory_rounds=2 measure_basis=z\n\ + # Note: surface uses serial Z-then-X expand (not Stim 4-layer FT schedule).\n" + ); + } + + #[test] + fn lattice_surgery_header_matches_gold_preamble() { + let mut out = String::new(); + emit_lattice_surgery_header(&mut out, 3, 3); + assert_eq!( + out, + "# Quon QEC experiment — lattice-surgery CX structure (no noise; ADR-0019/0024)\n\ + # family=surface distance=3 blocks=3 (L-shaped: control|ancilla / target)\n\ + # Merge/ancilla outcomes → OBSERVABLE_INCLUDE via frame; not bare DETECTORs.\n\ + # Stim merges use logical MPP (Horsman); NA schedules geometric seam CXs.\n\ + # Note: simplified merge/split model; not Stim FT-distance claim.\n" + ); + } }