Skip to content

fix(codec): emit fgbio KV metrics format (thread-consistent, seeded rows) - #513

Merged
nh13 merged 1 commit into
mainfrom
nh/fix-codec-kv-metrics
Jul 13, 2026
Merged

nh13 merged 1 commit into
mainfrom
nh/fix-codec-kv-metrics

Conversation

@nh13

@nh13 nh13 commented Jul 9, 2026 •

Copy link
Copy Markdown
Member

Summary

codec wrote its statistics as the wide ConsensusMetrics table in both the single- and multi-threaded paths, unlike simplex and duplex which emit fgbio's vertical key/value/description format (ConsensusKvMetric). The wide format is not readable by fgbio's Metric.read and does not carry the raw_reads_rejected_for_* rejection rows in a fgbio-parseable shape.

This converts both codec paths to to_kv_metrics_seeded, so codec now emits the same fgbio KV format as the other consensus tools.

Stacked on #511 (nh/fix-consensus-rejection-parity) — it uses that PR's to_kv_metrics_seeded and rejection-reason work. Merge order: #504 → #511 → this.

What changed

  • Both codec stats paths (execute and execute_threads_mode) now write to_kv_metrics_seeded(&CODEC_SEEDED_REJECTIONS).
  • New CODEC_SEEDED_REJECTIONS seeds the usedByCodec rejection reasons fgumi models (non_paired_reads, single_strand_only, potential_umi_collision) — codec is a duplex-style caller, so it shares the duplex-seeded set.
  • The codec threading-parity test now also asserts the output is the KV format (contains a seeded raw_reads_rejected_for_* row) in addition to the existing single==threaded equality check.

Codec's metrics were already thread-consistent (both paths use the same caller stats), so no value changes were needed — only the output format.

Not addressed (follow-ups)

  • fgbio additionally seeds codec-specific rejection reasons (r1_r2_overlap_too_short, indel_error_between_strands, high_duplex_disagreement, clip_overlap_failed, not_primary_fr_pair) that fgumi does not yet model as distinct RejectionReasons.
  • Whether codec's consensus_reads_emitted counts emitted reads vs. consensus events (the analogue of the duplex fix in fix(consensus): fgbio rejection-reason parity + thread-independent duplex metrics #511) was not audited here — it is consistent across thread counts, which is what this PR targets.

Testing

  • Codec threading-parity test: single==threaded stats equality and KV format.
  • Full suite: 2215 tests pass; ci-fmt and ci-lint clean.

Summary by CodeRabbit

  • New Features

    • Added a new rejection reason for non-paired reads, including updated metric keys and descriptions.
    • Updated end-of-run stats output to always emit fgbio-compatible seeded KV-metrics TSV rows.
  • Bug Fixes

    • Refined duplicate-UMI rejection messaging and ensured the correct TSV/KV identifiers are produced.
    • Improved single-threaded vs multi-threaded consistency by enforcing exact byte-level consensus record parity and matching stats contents.
  • Tests

    • Strengthened rejection-reason and metrics-key assertions across all variants.
    • Expanded threading-mode coverage and made stats comparisons stricter, including presence checks for the new non-paired metric row.

@nh13
nh13 temporarily deployed to github-actions July 9, 2026 06:15 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

Review Change Stack

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: a6bfb3d7-33ff-428c-a960-faddd09cd7c0

📥 Commits

Reviewing files that changed from the base of the PR and between fc11325 and 183cffb.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !**/*.lock
📒 Files selected for processing (3)
  • crates/fgumi-metrics/Cargo.toml
  • crates/fgumi-metrics/src/rejection.rs
  • src/lib/commands/codec.rs

Walkthrough

NonPairedReads is added to rejection metrics, duplicate UMI keys are aligned with fgbio, and codec statistics now use seeded KV metrics consistently across single-threaded and threaded execution.

Changes

Rejection and metrics alignment

Layer / File(s) Summary
Rejection taxonomy and centralized mapping
crates/fgumi-metrics/Cargo.toml, crates/fgumi-metrics/src/rejection.rs
Adds NonPairedReads, updates duplicate UMI descriptions and TSV keys, enables test-only enum iteration, and expands mapping coverage tests.
Codec statistics serialization and parity validation
src/lib/commands/codec.rs
Uses shared finalization for seeded KV metrics in both execution paths, parameterizes coordinate rejection across threading modes, and verifies identical statistics and consensus records across threading modes.

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

Sequence Diagram(s)

sequenceDiagram
  participant Codec as Codec execute path
  participant Finalize as finalize_stats
  participant Metrics as CodecConsensusStats metrics
  participant StatsFile as KV stats TSV
  Codec->>Finalize: finalize merged consensus statistics
  Finalize->>Metrics: convert to standard metrics
  Finalize->>StatsFile: write seeded fgbio KV rows
Loading

Possibly related PRs

Suggested labels: enhancement

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary codec change: fgbio KV metrics output with thread-consistent seeded rows.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch nh/fix-codec-kv-metrics

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

@codecov

codecov Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.62%. Comparing base (3e400a8) to head (183cffb).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #513   +/-   ##
=======================================
  Coverage   92.61%   92.62%           
=======================================
  Files         166      166           
  Lines       99803    99793   -10     
=======================================
- Hits        92431    92429    -2     
+ Misses       7372     7364    -8     

☔ 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 force-pushed the nh/fix-codec-kv-metrics branch from 2119c7f to fb4e5e2 Compare July 9, 2026 21:21
@nh13
nh13 changed the base branch from nh/fix-consensus-rejection-parity to nh/fix-consensus-sort-order-guards July 9, 2026 21:21
@nh13
nh13 temporarily deployed to github-actions July 9, 2026 21:21 — with GitHub Actions Inactive
@nh13
nh13 force-pushed the nh/fix-consensus-sort-order-guards branch from e80c30b to 37e2e83 Compare July 11, 2026 01:06
@nh13
nh13 force-pushed the nh/fix-codec-kv-metrics branch from fb4e5e2 to e9ce631 Compare July 11, 2026 01:08
@nh13
nh13 temporarily deployed to github-actions July 11, 2026 01:08 — with GitHub Actions Inactive
@nh13
nh13 force-pushed the nh/fix-consensus-sort-order-guards branch from 37e2e83 to d52374b Compare July 11, 2026 01:11
@nh13
nh13 force-pushed the nh/fix-codec-kv-metrics branch from e9ce631 to 5f41a16 Compare July 11, 2026 01:12
@nh13
nh13 temporarily deployed to github-actions July 11, 2026 01:12 — with GitHub Actions Inactive
@nh13
nh13 force-pushed the nh/fix-consensus-sort-order-guards branch 2 times, most recently from 0fe810a to ae3dee2 Compare July 11, 2026 04:57
@nh13

nh13 commented Jul 11, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 11, 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
crates/fgumi-metrics/src/rejection.rs (1)

186-244: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Manually-maintained ALL_REASONS array risks silent test-coverage drift.

ALL_REASONS must be updated by hand every time a variant is added; nothing forces it to stay in sync (unlike description()/tsv_key(), which are compiler-enforced via exhaustive match). A forgotten update silently drops coverage from test_tsv_key_prefix and test_kv_description_non_empty.

Prefer strum::EnumIter to generate the reason list automatically, and use rstest to parameterize these two tests over it, per the repo's Rust test guidelines.

Based on coding guidelines: "Use rstest for parameterized tests in Rust test files."

🤖 Prompt for 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.

In `@crates/fgumi-metrics/src/rejection.rs` around lines 186 - 244, Replace the
manually maintained ALL_REASONS array with strum::EnumIter-based iteration over
RejectionReason, ensuring every enum variant is included automatically. Update
test_tsv_key_prefix and test_kv_description_non_empty to use rstest
parameterization over the generated variants, while preserving their existing
assertions and keeping test_duplex_row_keys_match_fgbio unchanged.

Source: Coding guidelines

src/lib/commands/codec.rs (1)

1400-1415: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Parity test checks record count + CB presence, not record identity. records_st/records_mt are already materialized; assert byte/field identity (name, seq, quals) so single- vs multi-threaded content divergence is caught, not just count. As per path instructions: "end-to-end tests that assert a record count but not record identity" should be flagged.

🤖 Prompt for 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.

In `@src/lib/commands/codec.rs` around lines 1400 - 1415, Extend the parity
assertions around records_st and records_mt to compare each corresponding
record’s identity fields, including name, sequence, and qualities, in addition
to count and CB-tag presence. Use the already materialized records and preserve
the existing single-threaded versus multi-threaded comparison structure so
content divergence is detected.

Source: Path instructions

🤖 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 `@crates/fgumi-consensus/src/duplex_caller.rs`:
- Around line 2368-2434: Add a test alongside the existing fragment rejection
tests that builds one MI group containing fragment reads plus valid AB/BA pairs
using the existing ab_r1, ab_r2, ba_r1, and ba_r2 helpers. Call consensus_reads
and assert fragments increment RejectionReason::FragmentRead (mapping to
NonPairedReads), while the paired inputs still produce the duplex consensus with
result.count == 2.

---

Outside diff comments:
In `@crates/fgumi-metrics/src/rejection.rs`:
- Around line 186-244: Replace the manually maintained ALL_REASONS array with
strum::EnumIter-based iteration over RejectionReason, ensuring every enum
variant is included automatically. Update test_tsv_key_prefix and
test_kv_description_non_empty to use rstest parameterization over the generated
variants, while preserving their existing assertions and keeping
test_duplex_row_keys_match_fgbio unchanged.

In `@src/lib/commands/codec.rs`:
- Around line 1400-1415: Extend the parity assertions around records_st and
records_mt to compare each corresponding record’s identity fields, including
name, sequence, and qualities, in addition to count and CB-tag presence. Use the
already materialized records and preserve the existing single-threaded versus
multi-threaded comparison structure so content divergence is detected.
🪄 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: 18d309c0-a61c-4696-9464-8e9d570699a9

📥 Commits

Reviewing files that changed from the base of the PR and between ae3dee2 and 5f41a16.

📒 Files selected for processing (9)
  • crates/fgumi-consensus/src/caller.rs
  • crates/fgumi-consensus/src/duplex_caller.rs
  • crates/fgumi-metrics/src/consensus.rs
  • crates/fgumi-metrics/src/lib.rs
  • crates/fgumi-metrics/src/rejection.rs
  • src/lib/commands/codec.rs
  • src/lib/commands/duplex.rs
  • src/lib/commands/simplex.rs
  • tests/integration/test_duplex_command.rs

Comment thread crates/fgumi-consensus/src/duplex_caller.rs
@nh13
nh13 force-pushed the nh/fix-consensus-sort-order-guards branch from ae3dee2 to 4332216 Compare July 11, 2026 20:36
@nh13
nh13 force-pushed the nh/fix-codec-kv-metrics branch from 5f41a16 to 84dbee9 Compare July 11, 2026 22:07
@nh13
nh13 temporarily deployed to github-actions July 11, 2026 22:07 — with GitHub Actions Inactive
@nh13

nh13 commented Jul 11, 2026

Copy link
Copy Markdown
Member Author

Addressed the two outside-diff-range review comments in the latest push (also rebased onto the updated base branch, so this PR is now a clean single commit on top of it):

  • crates/fgumi-metrics/src/rejection.rs: replaced the hand-maintained ALL_REASONS array with a test-only #[cfg_attr(test, derive(strum::EnumIter))] on RejectionReason. test_tsv_key_prefix and test_kv_description_non_empty now iterate RejectionReason::iter(), so coverage cannot silently drop when a new variant is added. strum is a dev-dependency only (gated behind cfg(test)), so it is not pulled into non-test builds.
  • src/lib/commands/codec.rs: the single- vs multi-threaded parity test (test_threading_parity_mixed_cb) now asserts full record identity — name, sequence, base qualities, and CB-tag presence per record — instead of record count plus CB-tag presence only, so content divergence between thread modes is caught rather than masked.

The inline comment about adding a mixed fragment + valid AB/BA duplex group test is covered by test_consensus_reads_mixed_paired_and_fragments (fragments rejected as NonPairedReads, paired reads still yield result.count == 2).

@nh13

nh13 commented Jul 12, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 12, 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 `@crates/fgumi-metrics/Cargo.toml`:
- Line 20: Move strum from [dependencies] to [dev-dependencies] in the crate
manifest, preserving its derive feature, since rejection.rs uses it only under
test configuration and within mod tests.

In `@src/lib/commands/codec.rs`:
- Around line 470-479: Extract the duplicated statistics-writing logic from the
single- and multi-threaded paths into a shared helper on the relevant command
type, using the existing stats options, metrics conversion, DelimFile writing,
context, and info logging. Replace both inline blocks with calls to that helper
so both paths remain behaviorally identical.
🪄 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: 096c232c-219e-4ef4-bdc0-1da1608f7b4c

📥 Commits

Reviewing files that changed from the base of the PR and between 5f41a16 and 84dbee9.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !**/*.lock
📒 Files selected for processing (3)
  • crates/fgumi-metrics/Cargo.toml
  • crates/fgumi-metrics/src/rejection.rs
  • src/lib/commands/codec.rs

Comment thread crates/fgumi-metrics/Cargo.toml
Comment thread src/lib/commands/codec.rs Outdated
Base automatically changed from nh/fix-consensus-sort-order-guards to main July 12, 2026 15:14
@nh13
nh13 force-pushed the nh/fix-codec-kv-metrics branch 2 times, most recently from 5928bfa to c9c8f07 Compare July 12, 2026 15:21
@nh13
nh13 temporarily deployed to github-actions July 12, 2026 15:21 — with GitHub Actions Inactive
@nh13
nh13 force-pushed the nh/fix-codec-kv-metrics branch from c9c8f07 to fc11325 Compare July 12, 2026 17:37
@nh13
nh13 temporarily deployed to github-actions July 12, 2026 17:37 — with GitHub Actions Inactive
@nh13

nh13 commented Jul 12, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 12, 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 commented Jul 12, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 12, 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 `@src/lib/commands/codec.rs`:
- Around line 999-1041: Parameterize
test_codec_execute_rejects_non_template_coordinate_input with rstest to run
under both ThreadingOptions::none() and the threaded mode used by
test_threading_modes. Pass the selected threading configuration into
create_codec_with_paths so each execute path, including execute_threads_mode and
the fast path, validates non-template-coordinate input and preserves the
existing error assertion.
🪄 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: 20c7204d-60b5-4a71-b838-834747971140

📥 Commits

Reviewing files that changed from the base of the PR and between 84dbee9 and fc11325.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !**/*.lock
📒 Files selected for processing (3)
  • crates/fgumi-metrics/Cargo.toml
  • crates/fgumi-metrics/src/rejection.rs
  • src/lib/commands/codec.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

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 `@src/lib/commands/codec.rs`:
- Around line 999-1041: Parameterize
test_codec_execute_rejects_non_template_coordinate_input with rstest to run
under both ThreadingOptions::none() and the threaded mode used by
test_threading_modes. Pass the selected threading configuration into
create_codec_with_paths so each execute path, including execute_threads_mode and
the fast path, validates non-template-coordinate input and preserves the
existing error assertion.
🪄 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: 20c7204d-60b5-4a71-b838-834747971140

📥 Commits

Reviewing files that changed from the base of the PR and between 84dbee9 and fc11325.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !**/*.lock
📒 Files selected for processing (3)
  • crates/fgumi-metrics/Cargo.toml
  • crates/fgumi-metrics/src/rejection.rs
  • src/lib/commands/codec.rs
🛑 Comments failed to post (1)
src/lib/commands/codec.rs (1)

999-1041: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Negative sort-order test only covers the single-threaded fast path.

check_consensus_sort_order is duplicated verbatim in both the fast path (line 342-345) and execute_threads_mode's caller (line 315-318), but test_codec_execute_rejects_non_template_coordinate_input only runs with default (ThreadingOptions::none()) threading. A regression that drops/breaks the threaded-path check wouldn't be caught. Parameterize with #[rstest] over both threading modes, mirroring test_threading_modes.

As per coding guidelines, "Use rstest for parameterized tests in Rust test files."

♻️ Proposed fix
-    #[test]
-    fn test_codec_execute_rejects_non_template_coordinate_input() -> Result<()> {
+    #[rstest]
+    #[case::fast_path(ThreadingOptions::none())]
+    #[case::threaded(ThreadingOptions::new(2))]
+    fn test_codec_execute_rejects_non_template_coordinate_input(
+        #[case] threading: ThreadingOptions,
+    ) -> Result<()> {
         // CONS-01: codec requires template-coordinate-sorted input...
         ...
-        let cmd = create_codec_with_paths(input_path, output_path);
+        let mut cmd = create_codec_with_paths(input_path, output_path);
+        cmd.threading = threading;
         let err = cmd.execute("test").expect_err("codec must reject non-template-coordinate input");

Also applies to: 310-318, 340-345

🤖 Prompt for 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.

In `@src/lib/commands/codec.rs` around lines 999 - 1041, Parameterize
test_codec_execute_rejects_non_template_coordinate_input with rstest to run
under both ThreadingOptions::none() and the threaded mode used by
test_threading_modes. Pass the selected threading configuration into
create_codec_with_paths so each execute path, including execute_threads_mode and
the fast path, validates non-template-coordinate input and preserves the
existing error assertion.

Source: Coding guidelines

The `codec` command wrote its statistics as the wide `ConsensusMetrics` table
(`write_tsv([metrics])`) in both the single- and multi-threaded paths, unlike
`simplex` and `duplex` which emit fgbio's vertical key/value/description format
(`ConsensusKvMetric`). The wide format is not readable by fgbio's `Metric.read`
and does not carry the `raw_reads_rejected_for_*` rejection rows in a
fgbio-parseable shape.

Convert both codec paths to `to_kv_metrics_seeded`, seeding the `usedByCodec`
rejection reasons fgumi models (`non_paired_reads`, `single_strand_only`,
`potential_umi_collision`) via a new `CODEC_SEEDED_REJECTIONS`. Codec is a
duplex-style caller, so it shares the duplex-seeded set.

The metrics output was already thread-consistent for codec (both paths use the
same caller stats); this keeps that and adds a KV-format assertion to the
codec threading-parity test.

Note: fgbio additionally seeds codec-specific rejection reasons
(`r1_r2_overlap_too_short`, `indel_error_between_strands`,
`high_duplex_disagreement`, `clip_overlap_failed`, `not_primary_fr_pair`) that
fgumi does not yet model as distinct `RejectionReason`s — a separate follow-up.

Stacked on #511 (uses its `to_kv_metrics_seeded` + rejection-reason work).
@nh13
nh13 force-pushed the nh/fix-codec-kv-metrics branch from fc11325 to 183cffb Compare July 13, 2026 03:04
@nh13
nh13 temporarily deployed to github-actions July 13, 2026 03:04 — with GitHub Actions Inactive
@nh13

nh13 commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

Addressed the outside-diff finding on the negative sort-order test (it had no inline thread — "comments failed to post" on the last review).

test_codec_execute_rejects_non_template_coordinate_input is now #[rstest]-parameterized over ThreadingOptions::none() (fast path), new(1), and new(2) (pipeline path), mirroring test_threading_modes. This exercises the check_consensus_sort_order invocation on both the single-threaded fast path and the --threads pipeline path, so a regression that drops the check on either branch is now caught. All three cases pass.

@nh13

nh13 commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 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 commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 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 commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 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 merged commit bb91867 into main Jul 13, 2026
10 checks passed
@nh13
nh13 deleted the nh/fix-codec-kv-metrics branch July 13, 2026 14:06
nh13 added a commit that referenced this pull request Jul 14, 2026
…585)

test_codec_allow_unmapped_gates_pregroup_filter parsed the codec stats
file as a wide ConsensusMetrics TSV, but codec emits fgbio's vertical
key-value format (ConsensusKvMetric). The header mismatch made read_tsv
fail with "Error parsing delimited data file header" in all four cases.

The break was a semantic merge conflict: #513 switched codec stats to the
KV format, then #509 (merged after) added this test using the old wide
layout. Both merged cleanly textually, so the failure only surfaced on the
merged main tip.

Read the rows back as ConsensusKvMetric and look up the counts by key
(raw_reads_considered, consensus_reads_emitted), mirroring the sibling
simplex tests. The assertions' intent is unchanged: the supplementary
alignment is filtered before grouping (2 raw reads considered) and the
single FR molecule is emitted (1 consensus read).

This branch was previously deployed

1 inactive deployment
github-actions — 183cffb5 Deployed Jul 13, 2026 by nh13 via coverage #2487
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