Skip to content

refactor(sam): remove dead SamRecordClipper, port its tests to RawRecordClipper - #854

Merged
nh13 merged 1 commit into
mainfrom
843/nhomer/remove-sam-record-clipper
Aug 22, 2026
Merged

nh13 merged 1 commit into
mainfrom
843/nhomer/remove-sam-record-clipper

Conversation

@nh13

@nh13 nh13 commented Aug 22, 2026 •

Copy link
Copy Markdown
Member

Summary

SamRecordClipper (the RecordBuf-based clipper) had no production caller left — fgumi clip and every consensus caller use the raw-byte RawRecordClipper, and the only SamRecordClipper::new/with_auto_clip calls in the workspace were in its own tests. It was the tail of the RecordBuf → raw-byte migration. This removes it (struct, impl, the array_len/slice_array macros, and the reorient_strand_tags helper it alone used) and drops it from the fgumi-sam public API.

Preserving coverage

Its ~110 behavioral tests were the bulk of the clipping coverage; RawRecordClipper was largely verified only by cross-checking against it. To avoid losing that coverage, every test is ported to RawRecordClipper via a test-only RawClipperOnBuf adapter that runs the raw clipper through the RecordBuf API (RecordBuf → raw → clip → RecordBuf), so each test's setup and assertions run verbatim against the real raw clipper. The two non-UTF-8 tag tests — which a noodles RecordBuf cannot represent — are rewritten to build the raw record and tag directly. The former cross-check module now verifies the buf↔raw round-trip preserves CIGAR/pos/seq/qual (both sides run the same RawRecordClipper, so it no longer cross-checks an independent implementation; the concrete-expectation tests in mod tests are the correctness oracle). The create_test_record helper now normalizes SEQ to the CIGAR's query length so the records are valid BAM for the raw encoder without changing any assertion.

Reading order

The change is a large deletion (−1066 net); start with the RawClipperOnBuf adapter (new clip_test_adapter module) to see the porting mechanism, then the lib.rs export removal, then the doc-reference fixes in crates/fgumi-raw-bam/src/cigar.rs.

Full suite (154 clipper tests, all present), clippy, fmt, and rustdoc pass.

Closes #843.

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

Removes the unused SamRecordClipper public re-export and updates documentation to use raw BAM clipping APIs.

…ordClipper

`SamRecordClipper` (the RecordBuf-based clipper) had no production caller left --
`fgumi clip` and every consensus caller use the raw-byte `RawRecordClipper`, and
the only `SamRecordClipper::new`/`with_auto_clip` calls in the workspace were in
its own tests. It was the tail of the RecordBuf -> raw-byte migration.

Remove the struct, its impl, and the dead helpers it alone used (`reorient_strand_tags`,
the `array_len`/`slice_array` macros), and drop it from the `fgumi-sam` public API.

Its ~110 behavioral tests were the bulk of the clipping coverage; `RawRecordClipper`
was largely verified only by cross-checking against it. To avoid losing that coverage,
port every test to `RawRecordClipper` via a `RawClipperOnBuf` test adapter that runs the
raw clipper through the RecordBuf API (RecordBuf -> raw -> clip -> RecordBuf), so each
test's setup and assertions run verbatim against the real raw clipper. The two non-UTF-8
tag tests -- which a noodles RecordBuf cannot represent -- are rewritten to build the raw
record and tag directly. The former cross-check module now verifies the buf<->raw
round-trip preserves CIGAR/pos/seq/qual. The `create_test_record` helper now normalizes
SEQ to the CIGAR's query length so the records are valid BAM for the raw encoder.

Fix the doc references to the removed type in `RawRecordClipper` and `cigar.rs`. Closes #843.
@nh13
nh13 deployed to github-actions August 22, 2026 07:49 — with GitHub Actions Active
@coderabbitai

coderabbitai Bot commented Aug 22, 2026 •

Copy link
Copy Markdown

Review 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: Pro

Run ID: 23d894d4-c669-4a0b-a142-5d83823545fa

📥 Commits

Reviewing files that changed from the base of the PR and between cd7acdd and f920ba3.

📒 Files selected for processing (3)
  • crates/fgumi-raw-bam/src/cigar.rs
  • crates/fgumi-sam/src/clipper.rs
  • crates/fgumi-sam/src/lib.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 crate root no longer exports SamRecordClipper. Clipping documentation now references RawRecordClipper raw BAM methods.

Changes

Raw clipper API cleanup

Layer / File(s) Summary
Remove legacy clipper export
crates/fgumi-sam/src/lib.rs
Removes the crate-root re-export of SamRecordClipper. ClippingMode and RawRecordClipper remain exported.
Update clipping documentation
crates/fgumi-raw-bam/src/cigar.rs
Updates clipping documentation to reference RawRecordClipper::clip_start_of_read_raw, clip_end_of_read_raw, and upgrade_clipping_raw.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to f920b

This change removes an unused clipper implementation while preserving its behavioral coverage through the raw clipper; no actionable merge-blocking risk remains after normal checks and review.

Suggested labels: raw-bam

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The summary shows API and documentation updates but does not show removal of SamRecordClipper, its tests, or RecordBuf helpers required by #843. Remove SamRecordClipper, its tests, and RecordBuf-only helpers, then retain the API and documentation updates.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commit format and accurately describes the SamRecordClipper removal and test migration.
Out of Scope Changes check ✅ Passed The documented changes are limited to the SamRecordClipper API removal and related documentation updates.

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

@nh13

nh13 commented Aug 22, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai pause

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews paused.

@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.58%. Comparing base (7b9d64f) to head (f920ba3).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #854      +/-   ##
==========================================
+ Coverage   94.50%   94.58%   +0.08%     
==========================================
  Files         190      193       +3     
  Lines      118135   119434    +1299     
==========================================
+ Hits       111640   112967    +1327     
+ Misses       6495     6467      -28     

☔ 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 Aug 22, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 22, 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 Aug 22, 2026
Merged via the queue into main with commit 45f2105 Aug 22, 2026
18 checks passed
@nh13
nh13 deleted the 843/nhomer/remove-sam-record-clipper branch August 22, 2026 18:08
@nh13 nh13 mentioned this pull request Aug 22, 2026

This branch was successfully deployed

1 active deployment
github-actions — f920ba36 Deployed Aug 22, 2026 by nh13 via coverage #3885
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.

SamRecordClipper is never constructed in production (superseded by RawRecordClipper) — remove or document

1 participant