Skip to content

fix(diffguard-core): propagate GlobSetBuilder error instead of panicking#1607

Merged
EffortlessSteven merged 1 commit into
mainfrom
claude/find-fix-bug-OHEsf
May 16, 2026
Merged

fix(diffguard-core): propagate GlobSetBuilder error instead of panicking#1607
EffortlessSteven merged 1 commit into
mainfrom
claude/find-fix-bug-OHEsf

Conversation

@EffortlessSteven
Copy link
Copy Markdown
Member

Summary

Fixes #1475.

compile_filter_globs in diffguard-core/src/check.rs called .expect("globset build should succeed") on GlobSetBuilder::build(). That function already returns Result<GlobSet, PathFilterError>, so a build failure was being turned into a panic instead of a propagated error — exactly the pattern this codebase is migrating away from (ADR-0404, rust.no_unwrap).

Changes

  • Add PathFilterError::GlobSetBuild { source: globset::Error } variant.
  • Replace Ok(b.build().expect(...)) with b.build().map_err(|source| PathFilterError::GlobSetBuild { source }), mirroring how Glob::new() errors are mapped two lines above.
  • Update the existing exhaustive match in compile_filter_globs_rejects_invalid to cover the new variant (the test still asserts the invalid-glob path).

In practice the build call rarely fails because each Glob::new() is validated up front, but using .expect() on a Result-returning call is a latent panic and a code-smell — surfacing it as PathFilterError::GlobSetBuild lets callers handle the failure normally.

Test plan

  • cargo build --workspace — clean
  • cargo test -p diffguard-core — 141 + 6 tests pass
  • cargo clippy -p diffguard-core --all-targets -- -D warnings — clean
  • Existing compile_filter_globs_rejects_invalid test still passes (now exhaustive over both variants)

Generated by Claude Code

…ing (#1475)

`compile_filter_globs` called `.expect()` on `GlobSetBuilder::build()`,
which would panic on failure rather than returning an error from a
function that already returns `Result<_, PathFilterError>`.

Add a `PathFilterError::GlobSetBuild` variant and replace the `.expect()`
with `.map_err(...)` so the failure is surfaced through the existing
error path, matching how `Glob::new()` errors are handled above.
@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Warning

Rate limit exceeded

@EffortlessSteven has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 40 minutes and 32 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f4cedc55-b903-4482-8632-bc8823a7c4d1

📥 Commits

Reviewing files that changed from the base of the PR and between 29bd0ad and 079fd94.

📒 Files selected for processing (1)
  • crates/diffguard-core/src/check.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/find-fix-bug-OHEsf

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.

@EffortlessSteven EffortlessSteven marked this pull request as ready for review May 16, 2026 18:45
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@EffortlessSteven EffortlessSteven merged commit b3caa9c into main May 16, 2026
11 checks passed
@EffortlessSteven EffortlessSteven deleted the claude/find-fix-bug-OHEsf branch May 16, 2026 18:48
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.

check.rs:268: GlobSetBuilder::build() error dropped instead of propagated

2 participants