Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: issueAfterReset and Grants used together error#3609

Merged
chrisgacsal merged 1 commit intomainfrom
fix/validation-error
Nov 17, 2025
Merged

fix: issueAfterReset and Grants used together error#3609
chrisgacsal merged 1 commit intomainfrom
fix/validation-error

Conversation

@chrisgacsal
Copy link
Collaborator

@chrisgacsal chrisgacsal commented Nov 17, 2025

Overview

Fix missing error wrapping for entitlement error where both issueAfterReset and grants are provided for create inputs.

Summary by CodeRabbit

  • Bug Fixes
    • Improved error reporting for conflicting configuration options to provide better validation feedback.

@chrisgacsal chrisgacsal requested a review from GAlexIHU November 17, 2025 10:14
@chrisgacsal chrisgacsal self-assigned this Nov 17, 2025
@chrisgacsal chrisgacsal requested a review from a team as a code owner November 17, 2025 10:14
@chrisgacsal chrisgacsal added release-note/bug-fix Release note: Bug Fixes release-note/misc Miscellaneous changes labels Nov 17, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 17, 2025

📝 Walkthrough

Walkthrough

This PR updates error handling in the entitlement driver by replacing a plain error return with a properly wrapped generic validation error when conflicting input parameters are detected.

Changes

Cohort / File(s) Summary
Error Handling Improvement
openmeter/entitlement/driver/v2/mapping.go
Wrapped validation error using models.NewGenericValidationError instead of returning a raw error string when both issueAfterReset and grants parameters are provided simultaneously

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

This is a straightforward error handling improvement affecting a single validation case. The change is localized and follows an established pattern for error wrapping in the codebase.

Suggested reviewers

  • GAlexIHU

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing error handling when both issueAfterReset and Grants parameters are used together in entitlement validation.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/validation-error

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
openmeter/entitlement/driver/v2/mapping.go (1)

285-287: Nice fix! Error wrapping looks good.

The change correctly wraps the validation error with models.NewGenericValidationError(), which should help with proper error handling upstream. The error message is clear and accurately describes the conflict.

One small thought for consistency: there are a few other validation errors in this function (like line 240: "input is nil", line 321: "usage period is required...", and line 386: "unknown entitlement type") that might benefit from the same wrapping treatment. Not critical, but could make error handling more consistent across the board.

Based on coding guidelines

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 66511f3 and 20b1555.

📒 Files selected for processing (1)
  • openmeter/entitlement/driver/v2/mapping.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

⚙️ CodeRabbit configuration file

**/*.go: In general when reviewing the Golang code make readability and maintainability a priority, even potentially suggest restructuring the code to improve them.

Performance should be a priority in critical code paths. Anything related to event ingestion, message processing, database operations (regardless of database) should be vetted for potential performance bottlenecks.

Files:

  • openmeter/entitlement/driver/v2/mapping.go
🧬 Code graph analysis (1)
openmeter/entitlement/driver/v2/mapping.go (1)
pkg/models/errors.go (1)
  • NewGenericValidationError (138-140)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (go)

@chrisgacsal chrisgacsal merged commit 96243e5 into main Nov 17, 2025
33 of 34 checks passed
@chrisgacsal chrisgacsal deleted the fix/validation-error branch November 17, 2025 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/bug-fix Release note: Bug Fixes release-note/misc Miscellaneous changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants