Skip to content

Update accumulated observable correction on the wide decode path#357

Merged
ciaranra merged 1 commit into
devfrom
fix-accumulated-obs-wide
Jul 13, 2026
Merged

Update accumulated observable correction on the wide decode path#357
ciaranra merged 1 commit into
devfrom
fix-accumulated-obs-wide

Conversation

@ciaranra

Copy link
Copy Markdown
Member

Found by an adversarial review of the PR #338 merge reconciliation: the wide-observables migration left StreamingLogicalDecoder's accumulated correction behind. The narrow flush() set accumulated_obs, but the wide flush_obs() did not — and the Python bindings route LogicalAlgorithmDecoder.decode() through the wide path, so accumulated_obs() returned 0 after a decode() that returned a nonzero correction. Only the narrow path had test coverage.

Fix (single decode path):

  • accumulated_obs field is now a wide ObsMask, updated in flush_obs(); flush() delegates to flush_obs() and narrows with the same fail-loud error style as decode_to_observables (no truncation).
  • accumulated_obs() -> Result<u64, _> (errors beyond 64 observables instead of truncating); new accumulated_obs_mask() returns the lossless mask.
  • Python: accumulated_obs raises past 64; new accumulated_obs_mask returns an arbitrary-precision int via the existing obsmask_to_py helper.
  • Regression test wide_decode_path_updates_accumulated_obs covers the actual bug (wide decode → accumulated state, plus reset), alongside the updated narrow-path tests.

Verified: 130 decoder-core tests pass (incl. the new regression), clippy cold-clean on both changed crates, fmt clean.

@ciaranra
ciaranra merged commit 75fabb1 into dev Jul 13, 2026
60 checks passed
@ciaranra
ciaranra deleted the fix-accumulated-obs-wide branch July 13, 2026 00:11
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.

1 participant