Skip to content

fix(umi): fold case in the sequential edit assigner (audit P2) - #537

Merged
nh13 merged 1 commit into
feat-runallfrom
nh/audit-p2-umi-edit-case
Jul 20, 2026
Merged

nh13 merged 1 commit into
feat-runallfrom
nh/audit-p2-umi-edit-case

Conversation

@nh13

@nh13 nh13 commented Jul 10, 2026 •

Copy link
Copy Markdown
Member

What

Converges the Edit UMI strategy's sequential (SimpleErrorUmiAssigner) and parallel (ParallelEditAssigner) implementations on case. The parallel path uppercases before encoding; the sequential path matched raw bytes case-sensitively, so mixed-case UMIs could group differently depending on --threads. This folds case in SimpleErrorUmiAssigner::assign to match the parallel path and fgbio.

Second-wave item P2 from the feat-runall audit (findings/09-umi.md, finding 1).

Target rationale (main vs feat-runall)

This is the same class of bug that main's #455 ("make sequential and parallel assigners agree on UMI case") fixed — but #455 is not in feat-runall's history. feat-runall converged only the adjacency paths (via its own FU-004 raw-first-seen tie-break work) and left edit case-divergent. Since main already carries the fix and feat-runall does not, this targets feat-runall (stacked on nh/audit-3-parity). It ports only the edit-path portion of #455's approach; feat-runall's adjacency convergence is intentionally left alone (it converged differently than #455 and will be reconciled at merge time).

fgbio parity

fgbio's GroupReadsByUmi uppercases every UMI before assignment (canonicalize(rawTag.toUpperCase)), so case-insensitive grouping is the fgbio-faithful behavior — this converges with fgbio's user-facing output rather than diverging from it. In production this is a no-op: umi_for_read already uppercases non-paired UMIs before the assigner sees them, so only direct library callers passing mixed case change behavior.

Residual divergence (documented, not converged)

After this change the only remaining edit seq/parallel difference is for UMIs that are not BitEnc-encodable for a reason other than N (length > 32 bases, or a non-ACGTN character): the parallel path gives each its own molecule id, the sequential path groups them by string edit distance. N-containing UMIs never reach either assigner — those templates are discarded up front (discarded_ns_in_umi), matching fgbio — so this residual is unreachable via the CLI. The two previously-inaccurate "identical to"/"consistent with sequential" comments on ParallelEditAssigner are corrected to state this precisely.

The deeper Paired-strategy seq/parallel divergence (findings/09 finding 2) is a separate, out-of-scope item and is not touched here.

Tests

  • test_edit_sequential_parallel_agree_on_mixed_case — sequential vs parallel produce the same grouping on mixed-case input (fails before, passes after).
  • test_simple_error_assigner_is_case_insensitive — direct case-insensitivity check on the sequential assigner in the fgumi-umi crate.

Full suite green: cargo ci-test 2333 passed / 8 skipped; cargo ci-lint clean.

Summary by CodeRabbit

  • Bug Fixes
    • UMI assignment now treats mixed-case spellings consistently, grouping equivalent UMIs into the same molecule.
    • Sequential and parallel edit-based assignment now produce consistent molecule groupings for mixed-case UMIs.
    • Invalid or unsupported UMI sequences receive consistent standalone molecule assignments in parallel processing.
  • Tests
    • Added regression and randomized coverage for case-insensitive UMI grouping and sequential/parallel assignment parity.

@nh13
nh13 temporarily deployed to github-actions July 10, 2026 06:20 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 28 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b0162c81-3e3c-451b-ae8a-4e06f933eae1

📥 Commits

Reviewing files that changed from the base of the PR and between b883742 and d39b29e.

📒 Files selected for processing (2)
  • crates/fgumi-umi/src/assigner.rs
  • src/lib/umi/parallel_assigner.rs

Walkthrough

The sequential edit assigner now folds UMIs to ASCII uppercase before grouping and mapping results. Parallel edit tests verify matching mixed-case partitions, while documentation clarifies behavior for non-encodable UMIs other than N.

Changes

UMI case handling

Layer / File(s) Summary
Sequential case folding and regression coverage
crates/fgumi-umi/src/assigner.rs
SimpleErrorUmiAssigner uppercases UMIs before edit-distance grouping and final MoleculeId mapping; tests cover mixed-case equivalence with edits = 0.
Parallel behavior documentation and parity validation
src/lib/umi/parallel_assigner.rs
Comments document the non-N unencodable-UMI behavior, and deterministic plus property-based tests compare mixed-case sequential and parallel partitions.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 77.78% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: folding case in the sequential edit assigner.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch nh/audit-p2-umi-edit-case

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (feat-runall@6362996). Learn more about missing BASE report.

Additional details and impacted files
@@              Coverage Diff               @@
##             feat-runall     #537   +/-   ##
==============================================
  Coverage               ?   94.24%           
==============================================
  Files                  ?      111           
  Lines                  ?    51050           
  Branches               ?        0           
==============================================
  Hits                   ?    48110           
  Misses                 ?     2940           
  Partials               ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nh13
nh13 force-pushed the nh/audit-3-parity branch from 28856c6 to f697a33 Compare July 11, 2026 05:26
@nh13
nh13 force-pushed the nh/audit-p2-umi-edit-case branch from 113629f to de53f80 Compare July 11, 2026 05:36
@nh13
nh13 temporarily deployed to github-actions July 11, 2026 05:36 — with GitHub Actions Inactive
@nh13
nh13 force-pushed the nh/audit-3-parity branch from f697a33 to 30af4db Compare July 11, 2026 23:21
@nh13
nh13 force-pushed the nh/audit-p2-umi-edit-case branch from de53f80 to 3633dea Compare July 11, 2026 23:23
@nh13
nh13 temporarily deployed to github-actions July 11, 2026 23:23 — with GitHub Actions Inactive
@nh13
nh13 force-pushed the nh/audit-3-parity branch from 30af4db to a0c216b Compare July 12, 2026 00:43
@nh13
nh13 force-pushed the nh/audit-p2-umi-edit-case branch from 3633dea to d94da5b Compare July 12, 2026 00:44
@nh13
nh13 temporarily deployed to github-actions July 12, 2026 00:44 — with GitHub Actions Inactive
@nh13
nh13 force-pushed the nh/audit-3-parity branch from a0c216b to 4fe2c7b Compare July 12, 2026 05:39
@nh13
nh13 force-pushed the nh/audit-p2-umi-edit-case branch from d94da5b to 9a65127 Compare July 12, 2026 05:39
@nh13
nh13 temporarily deployed to github-actions July 12, 2026 05:39 — with GitHub Actions Inactive
@nh13
nh13 force-pushed the nh/audit-3-parity branch from 4fe2c7b to 8f5b2ae Compare July 12, 2026 15:40
@nh13
nh13 force-pushed the nh/audit-p2-umi-edit-case branch from 9a65127 to e984a5c Compare July 12, 2026 16:44
@nh13
nh13 temporarily deployed to github-actions July 12, 2026 16:44 — with GitHub Actions Inactive
@nh13
nh13 force-pushed the nh/audit-p2-umi-edit-case branch from e984a5c to debfcc7 Compare July 12, 2026 17:15
@nh13
nh13 temporarily deployed to github-actions July 12, 2026 17:15 — with GitHub Actions Inactive
@nh13
nh13 force-pushed the nh/audit-3-parity branch from 8f5b2ae to a1323bd Compare July 12, 2026 17:36
@nh13
nh13 force-pushed the nh/audit-p2-umi-edit-case branch from debfcc7 to 00041ee Compare July 12, 2026 17:36
@nh13
nh13 temporarily deployed to github-actions July 12, 2026 17:36 — with GitHub Actions Inactive
Base automatically changed from nh/audit-3-parity to feat-runall July 13, 2026 02:38
@nh13
nh13 force-pushed the nh/audit-p2-umi-edit-case branch from 00041ee to b883742 Compare July 13, 2026 02:41
@nh13
nh13 temporarily deployed to github-actions July 13, 2026 02:41 — with GitHub Actions Inactive
@nh13

nh13 commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@nh13

nh13 commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/fgumi-umi/src/assigner.rs`:
- Around line 2202-2214: Add programmatically generated fgbio-baseline identity
assertions for mixed-case UMI assignments in
test_simple_error_assigner_is_case_insensitive, while keeping the default suite
Rust-only. Extend randomized parity coverage in src/lib/umi/parallel_assigner.rs
lines 1378-1437 to validate assignments against the fgbio-derived baseline
rather than only sequential/parallel agreement; update
crates/fgumi-umi/src/assigner.rs lines 2202-2214 to assert the mixed-case
partition against that same baseline.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2b2ad2a3-8452-43f4-9a17-eebb404c0e8b

📥 Commits

Reviewing files that changed from the base of the PR and between 6362996 and b883742.

📒 Files selected for processing (2)
  • crates/fgumi-umi/src/assigner.rs
  • src/lib/umi/parallel_assigner.rs

Comment thread crates/fgumi-umi/src/assigner.rs
The Edit strategy has a sequential (`SimpleErrorUmiAssigner`) and a parallel
(`ParallelEditAssigner`) implementation documented to produce identical
groupings. The parallel path uppercases before encoding, but the sequential
path matched raw bytes case-sensitively, so mixed-case UMIs could group
differently depending on `--threads` (the sequential path runs at `--threads 1`,
the parallel path above the parallel threshold).

Fold case in `SimpleErrorUmiAssigner::assign` so it agrees with the parallel
edit assigner. This is a no-op for the uppercase UMIs the `group`/`dedup` CLI
emits (`umi_for_read` already uppercases non-paired UMIs, and fgbio uppercases
every UMI before assignment via `canonicalize(rawTag.toUpperCase)`), so it
matches fgbio's user-facing output; it only changes behavior for direct
library callers passing mixed case.

Also correct two stale comments on `ParallelEditAssigner` that claimed it
produces results "identical to"/"consistent with" the sequential assigner: the
one genuine residual difference is un-`BitEnc`-encodable UMIs (length > 32 or a
non-`ACGTN` base), which the parallel path singletons while the sequential path
string-groups. `N`-containing UMIs never reach either assigner — those
templates are discarded up front (`discarded_ns_in_umi`), matching fgbio — so
this residual is unreachable via the CLI and left documented rather than
converged.

Add a sequential-vs-parallel parity test on mixed-case input and a direct
case-insensitivity test for the sequential assigner.
@nh13
nh13 force-pushed the nh/audit-p2-umi-edit-case branch from b883742 to d39b29e Compare July 20, 2026 15:13
@nh13
nh13 temporarily deployed to github-actions July 20, 2026 15:13 — with GitHub Actions Inactive
@nh13

nh13 commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@nh13

nh13 commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@nh13
nh13 merged commit 1238908 into feat-runall Jul 20, 2026
11 checks passed
@nh13
nh13 deleted the nh/audit-p2-umi-edit-case branch July 20, 2026 17:38

This branch was previously deployed

1 inactive deployment
github-actions — d39b29ee Deployed Jul 20, 2026 by nh13 via coverage #2777
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant