Repository navigation
fix(consensus): rejects fan-out deadlock and CODEC disagreement data loss (2/6) - #459
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (10)
WalkthroughReject accounting now records duplex-disagreement rejects before returning typed errors, and clean batches now emit explicit empty rejects blocks across codec, duplex, simplex, and correct paths. Integration tests now validate rejects BAM contents and pipeline completion for these cases. ChangesReject-path handling and output density
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feat-runall #459 +/- ##
==============================================
Coverage ? 93.96%
==============================================
Files ? 109
Lines ? 48479
Branches ? 0
==============================================
Hits ? 45551
Misses ? 2928
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@tests/integration/test_codec_command.rs`:
- Around line 580-590: The reject assertion in the integration test only checks
shared QNAMEs, so it can still pass if the rejects list contains two copies of
the same mate. Update the test around the reject_names collection to assert mate
identity using the generated input records and the reject output from
rejects_reader, for example by checking FIRST_SEGMENT and LAST_SEGMENT (or
otherwise matching each reject record back to the exact original R1/R2 input
record). Keep the verification in test_codec_command.rs strong enough to ensure
the two distinct disagreement reads are emitted, not just two records with the
same name.
In `@tests/integration/test_correct_command.rs`:
- Around line 328-343: The reject verification in test_correct_command only
checks QNAME order via observed_order, which can miss mutation of rejected
records. In the test around the rejects BAM readback, keep the generated rej
records and compare each record’s full identity against the BAM output,
including raw fields and tags, not just the read name, so correctness-critical
behavior is asserted in the end-to-end test.
🪄 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: 0f30c18a-7613-442a-9f58-925ff2dd68a7
📒 Files selected for processing (7)
crates/fgumi-consensus/src/codec_caller.rssrc/lib/pipeline/chains/commands/codec.rssrc/lib/pipeline/chains/commands/duplex.rssrc/lib/pipeline/chains/commands/simplex.rssrc/lib/pipeline/steps/correct/mod.rstests/integration/test_codec_command.rstests/integration/test_correct_command.rs
5b4d0ad to
5900b0d
Compare
2053f99 to
9c010ac
Compare
5900b0d to
12ef53a
Compare
9c010ac to
3754cb2
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@tests/integration/test_duplex_command.rs`:
- Around line 309-324: The reject-path assertion in the duplex integration test
is too weak because it only checks the number of records plus name/flag fields,
so changes to sequence, quality, or tags could slip through. Update the test
around the reject-record verification to compare full RecordBuf identity for the
singleton inputs, using the same pattern as the sibling “correct” assertion and
the existing to_record_buf helper, so the observed rejects are byte-identical to
the expected source records.
In `@tests/integration/test_simplex_command.rs`:
- Around line 207-213: The reject check in test_simplex_command is only
validating the record name, so it can miss corruption in the rejected BAM
payload. Update the assertion around reader.records() to compare the full reject
record(s) against the expected singleton input using the existing
reject/RecordBuf helpers in this test, and verify byte-identical identity
instead of just the QNAME. Use the reader, header, and to_record_buf flow from
this test to locate the change.
🪄 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: 2365e51e-3bba-45d3-be38-20ffcf00c902
📒 Files selected for processing (9)
crates/fgumi-consensus/src/codec_caller.rssrc/lib/pipeline/chains/commands/codec.rssrc/lib/pipeline/chains/commands/duplex.rssrc/lib/pipeline/chains/commands/simplex.rssrc/lib/pipeline/steps/correct/mod.rstests/integration/test_codec_command.rstests/integration/test_correct_command.rstests/integration/test_duplex_command.rstests/integration/test_simplex_command.rs
3754cb2 to
de084a5
Compare
de084a5 to
8a852ff
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
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 `@tests/integration/test_codec_command.rs`:
- Around line 573-605: The reject validation in the integration test is still
too weak because it only checks QNAME and mate flags, so it can miss changes to
sequence, qualities, CIGAR, or tags. Update the single-threaded and threaded
reject assertions in the test_codec_command test to compare the full observed
reject records against the original pair as RecordBuf values, using the existing
rejects_reader.records() flow as the locator, so the test verifies exact record
identity rather than just count/name/segment bits.
🪄 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: a51a679c-bcbe-47a8-a9c0-6a89ec39b22e
📒 Files selected for processing (10)
crates/fgumi-consensus/src/codec_caller.rssrc/lib/pipeline/chains/commands/codec.rssrc/lib/pipeline/chains/commands/duplex.rssrc/lib/pipeline/chains/commands/simplex.rssrc/lib/pipeline/steps/correct/mod.rstests/integration/helpers/assertions.rstests/integration/test_codec_command.rstests/integration/test_correct_command.rstests/integration/test_duplex_command.rstests/integration/test_simplex_command.rs
8a852ff to
fd54559
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@tests/integration/test_duplex_command.rs`:
- Around line 251-260: The doc comment for the duplex regression test is
inconsistent with the actual test setup in test_duplex_command::regression case:
it claims a single large clean duplex molecule forms the leading batch, but the
construction uses many MI molecules and the batcher rationale depends on that.
Update the comment in the test body and surrounding header text so it accurately
describes the many-molecules setup that produces a reject-free leading batch and
preserves the deadlock repro, using the existing duplex --rejects /
ByItemOrdinal / try_pop_in_order context to locate it.
In `@tests/integration/test_simplex_command.rs`:
- Around line 156-162: The doc comment in the simplex integration test is stale
and no longer matches the constructed data flow. Update the header above the
simplex test near the X5-001 setup in test_simplex_command.rs to describe the
actual many-families prefix construction used by the test, and align it with the
batch behavior described later in the same test rather than the outdated “one
large clean family” wording. Use the surrounding test case and its
consensus/batch setup to keep the comment consistent with the current
reject-free prefix trigger.
🪄 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: 5ef9e601-01f4-4359-8f8f-2f06901a6db2
📒 Files selected for processing (10)
crates/fgumi-consensus/src/codec_caller.rssrc/lib/pipeline/chains/commands/codec.rssrc/lib/pipeline/chains/commands/duplex.rssrc/lib/pipeline/chains/commands/simplex.rssrc/lib/pipeline/steps/correct/mod.rstests/integration/helpers/assertions.rstests/integration/test_codec_command.rstests/integration/test_correct_command.rstests/integration/test_duplex_command.rstests/integration/test_simplex_command.rs
…ata loss Two distinct but adjacent merge-blockers on the `--rejects` fan-out path. X5-001 (critical deadlock): the rejects branch of every consensus/correct `*_with_rejects` step uses a `ByItemOrdinal` reorder stage keyed on the batch serial, so every batch serial must produce a branch-B item. An all-clean batch returned `Process2Output::only_a`, pushing nothing to the rejects branch and leaving a permanent gap in the serial sequence that stalls `try_pop_in_order` forever — any `--rejects` run with at least one all-clean batch wedges (the deadlock monitor eventually fails it). Emit an empty (zero-byte) rejects block for clean batches instead: it adds no heap, no reorder payload, and produces no physical BGZF block (compress/write of `&[]` are no-ops; the EOF is written once at drain), so serials stay dense. Fixed at all four sites (simplex/duplex/codec/correct). The no-`--rejects` path builds the single-output `*_kept_only` step and is unaffected. S9b-006 (major data loss): CODEC signalled a high-duplex-disagreement reject via a typed `Err`, and the `?` in `consensus_reads_typed` unwound before the reject-capture block, so disagreeing source reads landed in neither `--output` nor `--rejects` — silently dropped, diverging from fgbio (which routes them to rejects) and from fgumi's own simplex/duplex behaviour. The dead `consensus_reads_rejected_hdd` counter never incremented either. Capture the source records into `rejected_reads` and bump the HDD counter on the disagreement arm before propagating the `Err`. All call paths funnel through `consensus_reads_typed`, so both the single-threaded and threaded codec paths are fixed. Tests: a `correct --rejects --threads 4` integration test whose clean prefix exceeds the per-step byte budget so the first emitted batches are entirely clean (verified to wedge without the fix; a short deadlock-timeout makes a regression fail fast); CODEC disagreement tests (single- and multi-threaded) now assert the fgbio-parity `reject_count == 2` instead of the frozen `0`.
fd54559 to
5749095
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
Stack: 2 / 6 · base:
nh/runall-fix-1-foundationTwo critical-path correctness fixes in the consensus/rejects flow.
only_apath, keeping the rejects-branchByItemOrdinalreorder serials dense so the pipeline can't wedge.consensus_reads_typednow captures duplex-disagreement source reads intorejected_readsand bumps the previously-dead reject counter before propagating the error, on both the threaded and single-threaded codec paths.Both land with regression tests (the deadlock test is verified non-vacuous — it wedges with the fix reverted).
Summary by CodeRabbit
--rejectsfan-out always emits a per-batch rejects output (even when empty) across CODEC, duplex, simplex, and correction, preventing pipeline wedging and keeping batch serials dense.--rejectsoutput with byte-identicalRecordBufs.RecordBufvalues for stronger assertions.