feat(dev): add missing snapshots checker#6736
Conversation
WalkthroughIntroduces a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
✨ Simplify code
📝 Coding Plan
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/dev/subcommands/archive_missing_cmd.rs (1)
54-59: Consider usingexpect()instead ofunwrap()for consistency with coding guidelines.While this regex pattern is a compile-time constant that will always succeed, using
expect()with a descriptive message is preferred per the project's coding guidelines.Suggested change
fn extract_height(url: &Url) -> Option<ChainEpoch> { - static RE: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"_height_(\d+)").unwrap()); + static RE: LazyLock<Regex> = + LazyLock::new(|| Regex::new(r"_height_(\d+)").expect("valid regex pattern")); let path = url.path(); let caps = RE.captures(path)?; caps[1].parse().ok() }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/dev/subcommands/archive_missing_cmd.rs` around lines 54 - 59, The regex uses Regex::new(...).unwrap() in extract_height which violates the guideline; replace the unwrap() with expect(...) supplying a short descriptive message (e.g., "invalid regex in extract_height") when initializing the static RE so the Regex::new call still panics on programmer error but with a clear message; keep the rest of extract_height (path, captures, parse) unchanged and reference the static RE and function extract_height when applying the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/dev/subcommands/archive_missing_cmd.rs`:
- Around line 54-59: The regex uses Regex::new(...).unwrap() in extract_height
which violates the guideline; replace the unwrap() with expect(...) supplying a
short descriptive message (e.g., "invalid regex in extract_height") when
initializing the static RE so the Regex::new call still panics on programmer
error but with a clear message; keep the rest of extract_height (path, captures,
parse) unchanged and reference the static RE and function extract_height when
applying the change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 52bf56a5-b4a5-4912-a9e4-1b5433f8c7fb
📒 Files selected for processing (2)
src/dev/subcommands/archive_missing_cmd.rssrc/dev/subcommands/mod.rs
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 15 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Summary of changes
Changes introduced in this pull request:
Reference issue to close (if applicable)
Closes
Other information and links
Change checklist
Outside contributions
Summary by CodeRabbit
New Features