Skip to content

[qec] Share Stim observable assembly in the emitter module - #534

Merged
cursor[bot] merged 1 commit into
mainfrom
cursor/stim-observable-include-9f6a
Oct 1, 2026
Merged

cursor[bot] merged 1 commit into
mainfrom
cursor/stim-observable-include-9f6a

Conversation

@arniber21

Copy link
Copy Markdown
Owner

Summary

Partial slice of #473. Issue 473 stays open.

  • Move OBSERVABLE_INCLUDE record-offset assembly into stim_emit::emit_observable_include.
  • Both emit_stim_single_block_memory and emit_stim_lattice_surgery_cx call it.
  • Headers stay in the builders. Lattice surgery still appends frame-byproduct records on the same line after the shared write.
  • Checked-in Stim gold stays byte-identical.

Builders are still longer than the ~80 line target, and a new round kind is still a registry arm.

Test plan

  • cargo test -p quon_qec including stim_structure_matches_checked_in_gold
  • Unit tests for record offsets and a missing measurement atom
  • cargo clippy -p quon_qec --all-targets -- -D warnings
  • npx @taskless/cli@0.9.0 check on the changed files
  • Ubuntu and macOS fmt · clippy · build · test
Open in Web Open in Cursor 

Both Stim builders call stim_emit::emit_observable_include for OBSERVABLE_INCLUDE record offsets. Headers stay in the builders. Checked-in Stim gold stays byte-identical.

Issue 473 stays open.

Co-authored-by: Arnab Ghosh <ag2583@cornell.edu>
@vercel

vercel Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
quon Ready Ready Preview Oct 1, 2026 9:37am UTC

/// `obs_atoms` id must appear in that window; the first match wins. The
/// trailing newline is left to the caller so lattice surgery can append
/// frame-byproduct `rec` targets on the same line.
pub(crate) fn emit_observable_include(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve. I would merge this slice.

Both builders call emit_observable_include for the OBSERVABLE_INCLUDE prefix and the rec[-(d - pos)] offsets. The helper does not write the trailing newline. Single-block memory still pushes that newline itself. Lattice surgery still appends X-frame byproduct rec targets on the same line, then the newline at the loop below. Headers stay in the builders.

The search is the first match, same as the old .position() loops. observable_include_writes_record_offsets locks [30, 10] against a [10, 20, 30] window as rec[-1] rec[-3], and a missing atom is MissingDataMeasurement. The diff does not touch the checked-in Stim gold. This function has no unwrap or expect. The PR body and commit say issue 473 stays open; there is no Fixes/Closes/Resolves keyword.

The builders are still over the ~80 line target. That stays on the open issue.

@cursor
cursor Bot marked this pull request as ready for review October 1, 2026 09:39
@cursor
cursor Bot merged commit f3e8d46 into main Oct 1, 2026
22 of 23 checks passed

This branch was successfully deployed

1 active deployment
Preview — 781c5279 Deployed Oct 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants