Clear generic pileup state between records - #648
Open
SuhasSrinivasan wants to merge 1 commit into
Open
Conversation
SuhasSrinivasan
marked this pull request as ready for review
August 5, 2026 05:38
This was referenced Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #647.
Summary
Severity
Severity: High — scientific correctness
Rationale: The affected path exits successfully but can silently inflate modified counts and reduce canonical counts in bedMethyl output.
Root cause
update_mods_iter2populatedmod_pos,canonical_base,pos_base_mod_call, andmod_strandwhen the iterator yielded a call, but left all four fields unchanged when it returnedNone. The generic worker could therefore reuse state from the preceding record.Implementation
Clear all four cached fields on iterator exhaustion. The regression drives the actual generic worker with one explicit modified-A read followed by an implicit-mode read with an empty MM group at the same coordinate.
Preserved behavior
Non-goals
Behavior before and after
Testing
Test environment
948830d4e44d1be8aedadce810d1ca8068397c3af0fd371c4bd0fdb6b13893c94b96fcd581748a17; clean at final verification5cecc3fb3a9336068d9e3c68d5c08d678153dd2cn_modified = 2instead of 1cargo test -p mod_kit generic_pileup_clears_mod_state_between_records --libcargo test -p mod_kit --lib100.00 / 2 / 0to50.00 / 1 / 1cargo test --workspace --quietrustfmt --check --edition 2021 modkit-core/src/pileup/pileup_processor.rs;git diff --checkcargo fmt --all -- --checkmodkit/tests/test_bedmethyl_util.rs,modkit-core/src/adjust.rs, andmodkit-core/src/entropy/mod.rs; the changed file itself passed rustfmtTests not performed
Scientific validation
Output and compatibility
Reviewer guide
update_mods_iter2.cargo test -p mod_kit generic_pileup_clears_mod_state_between_records --lib.Checklist