Skip to content

refactor(metrics): consolidate UmiCountTracker and remove ALL_REJECTIONS duplication - #145

Merged
nh13 merged 1 commit into
mainfrom
refactor/nh/simplify-fgumi-metrics
Mar 3, 2026
Merged

nh13 merged 1 commit into
mainfrom
refactor/nh/simplify-fgumi-metrics

Conversation

@nh13

@nh13 nh13 commented Mar 3, 2026

Copy link
Copy Markdown
Member

Summary

  • Consolidate UmiCountTracker from 3 separate HashMaps (raw counts, error counts, unique counts) into a single HashMap<String, (usize, usize, usize)>, eliminating redundant key cloning on each record() call
  • Replace ALL_REJECTIONS const array (which manually listed CORE + OPTIONAL rejections) with all_rejections() function that chains the two source arrays

Test plan

  • cargo nextest run -p fgumi-metrics — all tests pass
  • cargo ci-fmt — clean
  • cargo ci-lint — clean

…ONS duplication

Replace three separate HashMaps in UmiCountTracker with a single
HashMap<String, (usize, usize, usize)>, eliminating two redundant key
clones per record() call and simplifying iteration.

Replace the manually-maintained ALL_REJECTIONS array with an
all_rejections() function that chains CORE_REJECTIONS and
OPTIONAL_REJECTIONS iterators, removing the duplicated entries.
@nh13
nh13 temporarily deployed to github-actions March 3, 2026 03:25 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Mar 3, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3a460ea and 376a6d6.

📒 Files selected for processing (2)
  • crates/fgumi-metrics/src/consensus.rs
  • crates/fgumi-metrics/src/duplex.rs

📝 Walkthrough

Walkthrough

This pull request refactors internal data structures in the metrics crate. The consensus module replaces a static ALL_REJECTIONS array with a private function that dynamically chains core and optional rejection arrays. The duplex module consolidates three separate per-UMI counter maps into a single map with tuple values. Both changes maintain existing public APIs while simplifying internal implementation and reducing code duplication.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed Title accurately summarizes both main changes: consolidating UmiCountTracker and removing ALL_REJECTIONS duplication.
Description check ✅ Passed Description clearly relates to the changeset, detailing both refactoring efforts and including a comprehensive test plan.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/nh/simplify-fgumi-metrics

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov

codecov Bot commented Mar 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.61%. Comparing base (3a460ea) to head (376a6d6).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #145   +/-   ##
=======================================
  Coverage   83.61%   83.61%           
=======================================
  Files         126      126           
  Lines       51510    51510           
=======================================
  Hits        43069    43069           
  Misses       8441     8441           

☔ View full report in Codecov by Sentry.
📢 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 Mar 3, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 3, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

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 Mar 3, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 3, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

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 2b79922 into main Mar 3, 2026
7 checks passed
@nh13
nh13 deleted the refactor/nh/simplify-fgumi-metrics branch March 3, 2026 17:11
This was referenced Mar 3, 2026

This branch was previously deployed

1 inactive deployment
github-actions — 376a6d68 Deployed Mar 3, 2026 by nh13 via coverage #509
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