Repository navigation
test: in-process Command::execute for Phase 4 commands (#352) - #356
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #356 +/- ##
==========================================
- Coverage 90.97% 90.88% -0.09%
==========================================
Files 78 78
Lines 51102 51102
==========================================
- Hits 46491 46446 -45
- Misses 4611 4656 +45 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3bf6bd0 to
517f938
Compare
bedf332 to
040eef4
Compare
|
@coderabbitai resume |
|
@coderabbitai review |
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR converts four integration test modules from spawning the fgumi binary via subprocess to invoking commands in-process through the library API (Command::try_parse_from(...).execute("test")). Tests were updated to assert Result success/error and to preserve existing output and determinism checks. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
✅ Actions performedReview triggered.
|
✅ Actions performedReviews resumed. |
|
@coderabbitai resume |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
✅ Actions performedReviews resumed. |
|
@coderabbitai resume |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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_downsample_command.rs`:
- Around line 317-344: Refactor the two invalid-fraction assertions in
tests/integration/test_downsample_command.rs to use rstest parameterization and
ensure each case writes to a unique output path: use Downsample::try_parse_from
for the same argument sets but supply distinct output files (e.g.,
output_zero.bam for fraction "0.0" and output_gt1.bam for fraction "1.5")
instead of sharing output_bam; keep invoking cmd.execute("test") and asserting
is_err() for each parameter so artifacts from the first run cannot make the
second pass spuriously.
In `@tests/integration/test_sort_correctness.rs`:
- Around line 23-25: The current fgumi_sort_in_process maps OsString to &str
with to_str().unwrap(), which can panic on non-UTF-8; instead stop converting
and pass the OsString values directly to clap by calling Sort::try_parse_from
with the original args (or an iterator over them) so remove the str_args mapping
and use Sort::try_parse_from(&args) / an OsString iterator to avoid the UTF-8
roundtrip and potential panic.
In `@tests/integration/test_sort_write_index.rs`:
- Around line 83-94: Remove the .to_str().unwrap() calls inside the arrays
passed to Sort::try_parse_from and pass the PathBuf variables directly (e.g.,
input_bam, sorted_bam_path and the other temp path variables used in the other
Sort::try_parse_from invocations); Sort::try_parse_from accepts Into<OsString>
so passing PathBuf avoids panics on non-UTF8 paths—update every occurrence where
you currently pass input_bam.to_str().unwrap(),
sorted_bam_path.to_str().unwrap(), etc., to just pass the PathBuf variables.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 04f2b875-9496-4267-91da-2b32a2c8e294
📒 Files selected for processing (4)
tests/integration/test_downsample_command.rstests/integration/test_e2e_regression.rstests/integration/test_sort_correctness.rstests/integration/test_sort_write_index.rs
✅ Actions performedReviews resumed. |
040eef4 to
b964c20
Compare
517f938 to
691eead
Compare
Converts the fgumi sort invocations in two test files to in-process Sort::execute() calls. Samtools invocations stay on the subprocess path (samtools is an external tool). - test_sort_correctness.rs: replaces the fgumi(args) subprocess helper with fgumi_sort_in_process(args), wiring both verify_sorted and sort_bam_with_args through Sort::try_parse_from + execute(). - test_sort_write_index.rs: replaces 4 direct fgumi binary invocations with in-process calls; drops the unused fgumi_binary_path() helper. Merges test_sort_fast_write_index and test_sort_standard_write_index into a single test_sort_write_index because the --fast/standard distinction no longer exists on Sort, so the two tests exercised identical code paths. Drops the --cell-tag CB and --fast arguments at several call sites because Sort no longer exposes these as CLI flags (template-coordinate sort hard-codes SamTag::CB via parse_cell_tag; raw-bytes mode is internal). The flags were dead under subprocess too — both files are #[ignore="requires samtools"] so the parse error never surfaced.
691eead to
76fda55
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
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_e2e_regression.rs`:
- Around line 68-76: The test constructs clap arguments using string coercion
(to_str().unwrap()) when calling GroupedReads::try_parse_from, which can panic
on non-UTF-8 paths; update all such occurrences in
tests/integration/test_e2e_regression.rs (e.g., where
GroupedReads::try_parse_from is called) to use OS-native argument values (use
as_os_str() or convert to OsString) so the args passed into try_parse_from are
native OS strings rather than UTF-8 coerced &strs; apply this replacement
consistently for every to_str().unwrap() used in arg construction in that file.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ed85d69c-24ab-4fa3-a427-f6a6bffafb36
📒 Files selected for processing (4)
tests/integration/test_downsample_command.rstests/integration/test_e2e_regression.rstests/integration/test_sort_correctness.rstests/integration/test_sort_write_index.rs
Convert the remaining fgumi-subprocess uses in the e2e regression file
to direct \`<Struct>::try_parse_from([...]).execute("test")\` calls.
Covers extract, sort, group, simplex, filter, dedup, and the two
simulate subcommands (grouped-reads, fastq-reads).
The \`fgumi_ok\` helper is removed (no callers remain). The \`fgumi\`
helper and \`args!\` macro are retained for
\`test_group_rejects_extract_output_without_sort_step\`, which must pin
exit-status and stderr content of the real binary.
76fda55 to
24a952d
Compare
Summary
Phase 4 of #352, stacked on #355. Wraps up the migration by converting the remaining single-command files (sort, downsample) and the end-to-end pipeline file.
Converted commands:
downsample,sort, plus the in-process e2e pipeline (extract → sort → group → simplex → filter, plus the simulate subcommandsgrouped-readsandfastq-reads, plus dedup).Highlights worth flagging
test_sort_correctness.rsandtest_sort_write_index.rsdrop dead--cell-tag CBand--fastargs that prior subprocess tests passed butSortno longer exposes.Sort::parse_cell_taghard-codesSamTag::CBfortemplate-coordinate; raw-bytes mode selection is internal. The flags were dead under subprocess too — both files are#[ignore = "requires samtools"]so the silent parse error never surfaced in default CI.test_sort_fast_write_indexandtest_sort_standard_write_indexare merged into a singletest_sort_write_indexbecause--fastno longer exists, so the two tests exercised identical code paths.test_group_rejects_extract_output_without_sort_stepintentionally stays on the subprocess path. It asserts on specific stderr substrings (template-coordinate,SS:template-coordinate,fgumi sort) that are CLI-shaped user-facing diagnostics — keeping it subprocess is correct per the issue's acceptance criteria.test_simulate_sort.rsis unchanged. Its tests usecargo run --features simulate --release -- simulate ...(not direct fgumi binary invocations) and are#[ignore]-gated; converting them is low value and out of scope.test_streaming_input.rs,test_bam_pipeline.rs,test_codec_pipeline.rs,test_simplex_pipeline.rs,test_pipeline_concurrency.rs,test_async_reader.rs,test_bgzf_eof.rs,test_error_paths.rsstay subprocess — they're genuine pipeline / pipe-shape tests, exactly the kind of "remaining subprocess invocations" the issue's acceptance criteria allows.Phasing — complete after this PR
Commits
Test plan
cargo nextest run --features compare,simulate --test integration— 193/193 passed, 22 skippedcargo ci-fmtcleancargo ci-lintclean