Skip to content

fix(extract): honor --check-crc/--no-check-crc on the BGZF FASTQ split decode - #959

Merged
nh13 merged 1 commit into
mainfrom
nh/fastq-split-crc-policy
Sep 14, 2026
Merged

nh13 merged 1 commit into
mainfrom
nh/fastq-split-crc-policy

Conversation

@nh13

@nh13 nh13 commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

Summary

The all-file BGZF parallel-decode split for FASTQ input (build_bgzf_fastq_split → FastqDecompress) reads its per-block CRC32 policy from ChainSpec.verify_crc, but Extract::execute_chain hardcoded that field to false. As a result --check-crc and the file-input default silently skipped CRC verification on that path, accepting corrupted FASTQ blocks. This path shipped to main with the StepK FASTQ decode work (via #952, merged into #951).

CodeRabbit flagged this on #951 (builder.rs:889), but the thread was resolved as "stale / symbols removed" — the symbols do exist on main, and the bug is real.

Fix

Resolve verify_crc through the shared resolve_check_crc policy (--check-crc wins, --no-check-crc disables, file inputs verify by default). The spec construction is extracted into a testable Extract::build_extract_chain_spec, mirroring Sort::build_sort_chain_spec.

Why the existing test missed it

test_bgzf_fastq_honors_check_crc uses a small input that is read in full during quality-encoding detection (sample_detection_quals), which opens its own policy-honoring reader and rejects the corrupted trailing block before the split decoder ever runs. The new split_decoder_honors_check_crc_past_detection_window places the corruption past the detection window so only the full split decode reaches it, exercising the decoder's own policy (verified failing before the fix, passing after).

Also

Aligns the parse_and_zip_two_streams_preserves_ordinal doc with what it actually covers (a second CodeRabbit finding on #951 resolved as stale — also still valid on main): it exercises the parse/zip primitives, not the step; step wiring is covered by the chain tests.

Verification

cargo ci-fmt, cargo ci-lint, cargo ci-tag-literals, cargo ci-publish-order, and the affected tests all pass locally.

Risk: command output changes: none; unsafe changes: none, so no CLAUDE.md allowlist update is required; memory bounds, queue capacity, and thread/backpressure policy: none.

Fix: Resolve ChainSpec.verify_crc through resolve_check_crc. --check-crc enables verification, --no-check-crc disables it, and file inputs verify by default.

  • Extracted chain-spec construction into Extract::build_extract_chain_spec.
  • Added tests for CRC policy resolution and corruption beyond the quality-detection window.
  • Updated the parse_and_zip_two_streams_preserves_ordinal documentation.

…t decode

The all-file BGZF parallel-decode split for FASTQ input
(build_bgzf_fastq_split -> FastqDecompress) reads its per-block CRC32 policy
from ChainSpec.verify_crc, but Extract::execute_chain hardcoded that field to
false. As a result --check-crc and the file-input default silently skipped CRC
verification on that path, accepting corrupted FASTQ blocks. This path shipped
to main with the StepK FASTQ decode work (via #952, merged into #951).

Resolve verify_crc through the shared resolve_check_crc policy (--check-crc
wins, --no-check-crc disables, file inputs verify by default). The spec
construction is extracted into a testable Extract::build_extract_chain_spec,
mirroring Sort::build_sort_chain_spec.

test_bgzf_fastq_honors_check_crc did not catch this: its small input is read in
full during quality-encoding detection (sample_detection_quals), which opens
its own policy-honoring reader and rejects the corrupted trailing block before
the split decoder runs. Add split_decoder_honors_check_crc_past_detection_window,
which places the corruption past the detection window so only the split decode
reaches it, exercising the decoder's own policy.

Also align the parse_and_zip_two_streams_preserves_ordinal doc with what it
actually covers (the primitives, not the step; step wiring is covered by the
chain tests).
@nh13
nh13 deployed to github-actions September 13, 2026 19:31 — with GitHub Actions Active
@coderabbitai

coderabbitai Bot commented Sep 13, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Note

Reviews paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Essentials

Run ID: 565e58fb-3512-455b-8d0c-e07c5745c4c7

📥 Commits

Reviewing files that changed from the base of the PR and between d757c77 and b66b020.

📒 Files selected for processing (2)
  • src/lib/commands/extract.rs
  • src/lib/pipeline/steps/source/parse_zip_fastq.rs

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.


Walkthrough

The extract path no longer hardcodes CRC verification off. It resolves the effective policy, passes it to ChainSpec, and tests corruption handling beyond the quality-detection window.

Changes

Extract CRC policy

Layer / File(s) Summary
CRC policy wiring
src/lib/commands/extract.rs
build_extract_chain_spec resolves the effective CRC policy and assigns it to ChainSpec.verify_crc. execute_chain builds and runs this specification.
CRC behavior validation and documentation
src/lib/commands/extract.rs, src/lib/pipeline/steps/source/parse_zip_fastq.rs
Tests cover default, enabled, and disabled CRC policies, including corruption detected after the quality-detection window. Test documentation clarifies CRC and parse-and-zip validation scope.

Priority: ⬇️ Low

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

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant ExtractCLI
  participant build_extract_chain_spec
  participant ChainSpec
  participant execute_chain
  participant BGZF_split_decoder
  ExtractCLI->>build_extract_chain_spec: Resolve CRC policy
  build_extract_chain_spec->>ChainSpec: Set verify_crc
  ExtractCLI->>execute_chain: Execute chain
  execute_chain->>BGZF_split_decoder: Decode with CRC policy
Loading

Merge Risk: ⚪ Minimal · up to b66b0

CRC verification is now applied according to the documented command policy for eligible file inputs, including blocks decoded after initial quality detection. No actionable merge risk remains.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title uses valid Conventional Commit syntax, names the affected extract command, uses a lowercase imperative description, and accurately describes the CRC policy fix.
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.

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

@nh13

nh13 commented Sep 13, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai pause

@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews paused.

@codecov

codecov Bot commented Sep 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.05%. Comparing base (d757c77) to head (b66b020).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #959      +/-   ##
==========================================
+ Coverage   96.02%   96.05%   +0.03%     
==========================================
  Files         290      290              
  Lines      143501   143507       +6     
==========================================
+ Hits       137796   137851      +55     
+ Misses       5705     5656      -49     

☔ 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 commented Sep 13, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

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 Sep 13, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 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 added this pull request to the merge queue Sep 14, 2026
Merged via the queue into main with commit 61eb866 Sep 14, 2026
17 checks passed
@nh13
nh13 deleted the nh/fastq-split-crc-policy branch September 14, 2026 03:42
@nh13 nh13 mentioned this pull request Sep 13, 2026

This branch was successfully deployed

1 active deployment
github-actions — b66b020e Deployed Sep 13, 2026 by nh13 via coverage #4479
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