Skip to content

refactor(pipeline): relocate reusable types out of unified_pipeline (R6a) - #929

Merged
nh13 merged 1 commit into
mainfrom
nh/c5-relocate-shared-types
Sep 8, 2026
Merged

nh13 merged 1 commit into
mainfrom
nh/c5-relocate-shared-types

Conversation

@nh13

@nh13 nh13 commented Sep 5, 2026 •

Copy link
Copy Markdown
Member

What

Relocate the reusable types that live in src/lib/unified_pipeline/ but are consumed by code outside it, so a later PR can delete the whole unified_pipeline module (campaign phase R6a → R6b). Behavior-preserving: no output or CLI change.

The relocation

  • Grouping types already live in fgumi-bam-io (DecodedRecord, GroupKey, GroupKeyConfig, Grouper, MemoryEstimate) — unified_pipeline only re-exported them. Surviving importers (fastq_parse.rs, grouper.rs, mi_group.rs, template.rs, commands/common.rs) now import from fgumi_bam_io:: directly. No definitions moved.
  • Three items still defined in unified_pipeline and needed by surviving code are moved intra-crate (deliberately not into fgumi-bam-io):
    • BatchWeight (trait) → new src/lib/batch_weight.rs. Its impls target foreign types (RecordBuf, RawRecord, Vec<u8>), so moving the trait to fgumi-bam-io would break the orphan rule — it stays root-local.
    • SchedulerStrategy (enum) → new src/lib/scheduler_strategy.rs. It is consumed by both the scheduler dispatch (create_scheduler) and the CLI SchedulerOptions, so it lives in a neutral module both depend on downward (not in the commands layer).
    • BACKPRESSURE_THRESHOLD_BYTES / Q5_BACKPRESSURE_THRESHOLD_BYTES / stage_high_water_mark → new src/lib/pipeline/backpressure.rs (with their unit tests).
  • pub use re-export shims are left in unified_pipeline (base.rs, scheduler/mod.rs) so the still-present legacy command paths keep compiling unchanged. Those shims disappear with unified_pipeline in the R6b deletion.
  • Excluded: BamPipelineConfig (legacy-only — the chain path builds PipelineConfig, not it) and the 4-arg compute_group_key_from_raw (the 3-arg fgumi-bam-io version is canonical) both stay in unified_pipeline to die with R6b.

Notes

  • The two grouper.rs tests that called the 4-arg compute_group_key_from_raw (passing None, discarding the umi offset) are repointed to the canonical 3-arg fgumi_bam_io::grouping::compute_group_key_from_raw — byte-identical grouping key for the inputs exercised (confirmed by reading both bodies and by the passing tests).
  • No layering cycle: fgumi-bam-io does not depend on the root crate, and all three moves are intra-crate. The 8 in-flight per-command legacy-path retirement PRs are not touched — they resolve their unified_pipeline::{BatchWeight,SchedulerStrategy,...} imports through the shims, which the --no-default-features check confirms.

Full gate green: cargo check in all three feature configs (default, --all-features, --no-default-features), ci-fmt/ci-lint/ci-doc, and ci-test (9987 passed / 31 skipped). This is the R6a step; R6b (delete unified_pipeline) follows once the per-command legacy retirements land.

Risk: command output changes—none; grouping remains pinned to fgumi_bam_io. unsafe changes—none; CLAUDE.md needs no update. Memory bounds, queue capacity, and thread/backpressure policy changes—none.

  • Relocate reusable types and utilities from unified_pipeline.
  • Add root modules for BatchWeight and SchedulerStrategy.
  • Add pipeline::backpressure with compatibility re-exports.
  • Update imports and grouper tests to use canonical fgumi_bam_io types.
  • Preserve legacy command compatibility, BamPipelineConfig, and CLI behavior.
  • Full tests and validation pass.

@nh13
nh13 deployed to github-actions September 5, 2026 04:33 — with GitHub Actions Active
@coderabbitai

coderabbitai Bot commented Sep 5, 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: e4c0b528-e06d-4011-b09c-2e14d2101069

📥 Commits

Reviewing files that changed from the base of the PR and between 7b3bb5b and ad76bc5.

📒 Files selected for processing (2)
  • src/lib/commands/common.rs
  • src/lib/mod.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

Shared pipeline contracts move to public neutral modules. Backpressure logic moves to pipeline::backpressure. Consumers use fgumi_bam_io, and legacy unified_pipeline paths remain available through re-exports.

Changes

Pipeline shared contracts

Layer / File(s) Summary
Shared contract definitions
src/lib/batch_weight.rs, src/lib/scheduler_strategy.rs, src/lib/mod.rs
Adds public BatchWeight and SchedulerStrategy modules.
Backpressure contract and behavior
src/lib/pipeline/backpressure.rs, src/lib/pipeline/mod.rs
Adds backpressure thresholds, high-water-mark calculation, and unit tests.
Consumer import and API migration
src/lib/commands/common.rs, src/lib/fastq_parse.rs, src/lib/grouper.rs, src/lib/mi_group.rs, src/lib/template.rs, src/lib/pipeline/steps/tuning.rs
Updates imports and group-key calls to use the relocated APIs.
Legacy compatibility re-exports
src/lib/unified_pipeline/base.rs, src/lib/unified_pipeline/scheduler/mod.rs
Re-exports relocated APIs and removes duplicate local definitions and tests.

Priority: ⬇️ Low

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

Change: Refactor

Merge Risk: ⚪ Minimal · up to ad76b

This change relocates shared pipeline contracts while preserving legacy compatibility paths and reports no behavior or CLI changes. No current merge-blocking risk is identified.

Suggested labels: fgumi group

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required Conventional Commit format. It uses the valid type refactor, the relevant pipeline scope, and a lowercase imperative description that accurately summarizes the relocati…
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 5, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai pause

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews paused.

@codecov

codecov Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #929      +/-   ##
==========================================
- Coverage   94.38%   94.37%   -0.02%     
==========================================
  Files         302      303       +1     
  Lines      150364   150442      +78     
==========================================
+ Hits       141918   141973      +55     
- Misses       8446     8469      +23     

☔ 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 8, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 8, 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 8, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 8, 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.

…R6a)

Repoint the surviving importers (fastq_parse, grouper, mi_group, template,
commands/common) at fgumi_bam_io directly for DecodedRecord, GroupKey,
GroupKeyConfig, Grouper, and MemoryEstimate, which already live there and
were only reached through a unified_pipeline re-export.

Relocate the three items still actually defined in unified_pipeline that
surviving code needs: the BatchWeight trait moves to a new root-crate
module (src/lib/batch_weight.rs) rather than fgumi-bam-io, since its
surviving impls target foreign types and would violate the orphan rule
there; SchedulerStrategy moves to commands/common.rs, next to its only
surviving consumer (SchedulerOptions); the backpressure constants and
stage_high_water_mark move to a new src/lib/pipeline/backpressure.rs.
unified_pipeline keeps pub use shims for all three so the still-present
legacy command paths keep compiling unchanged across every feature
configuration.

Repoint the two grouper unit tests that called the 4-arg
unified_pipeline::compute_group_key_from_raw to the canonical 3-arg
fgumi_bam_io version, dropping the discarded UMI offset return value the
tests never used; the resulting GroupKey is unchanged for valid records.

BamPipelineConfig stays legacy-only and is left in place.
@nh13
nh13 force-pushed the nh/c5-relocate-shared-types branch from 7b3bb5b to ad76bc5 Compare September 8, 2026 18:12
@nh13
nh13 deployed to github-actions September 8, 2026 18:12 — with GitHub Actions Active
@nh13

nh13 commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 8, 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 8, 2026
Merged via the queue into main with commit 6a290a8 Sep 8, 2026
17 checks passed
@nh13
nh13 deleted the nh/c5-relocate-shared-types branch September 8, 2026 19:22
@nh13 nh13 mentioned this pull request Sep 8, 2026

This branch was successfully deployed

1 active deployment
github-actions — ad76bc52 Deployed Sep 8, 2026 by nh13 via coverage #4355
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