Skip to content

fix(plan): add validation for metered entitlement template#3946

Merged
tothandras merged 1 commit into
mainfrom
fix/plan-entitlements-validation
Mar 15, 2026
Merged

fix(plan): add validation for metered entitlement template#3946
tothandras merged 1 commit into
mainfrom
fix/plan-entitlements-validation

Conversation

@tothandras
Copy link
Copy Markdown
Contributor

@tothandras tothandras commented Mar 14, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added validation to ensure metered entitlements are properly configured with required settings.
  • Tests

    • Enhanced test coverage for new metered entitlement validation requirements.

@tothandras tothandras added the release-note/bug-fix Release note: Bug Fixes label Mar 14, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 14, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ff811c3f-e158-4c34-92c1-f8341ae4487b

📥 Commits

Reviewing files that changed from the base of the PR and between 0d75c55 and 7bbef2d.

📒 Files selected for processing (4)
  • e2e/productcatalog_test.go
  • openmeter/productcatalog/errors.go
  • openmeter/productcatalog/ratecard.go
  • openmeter/subscription/errors_test.go

📝 Walkthrough

Walkthrough

This PR adds validation for metered entitlement templates to require issueAfterReset to be configured. It introduces a new validation error code and issue in the productcatalog module, implements the validation check in RateCardMeta, and updates both e2e and unit tests to reflect the new validation requirement.

Changes

Cohort / File(s) Summary
Error Definition
openmeter/productcatalog/errors.go
Introduces new validation error code entitlement_template_issue_after_reset_required and corresponding ErrEntitlementTemplateIssueAfterResetRequired issue with warning severity for metered entitlements missing issueAfterReset.
Validation Logic
openmeter/productcatalog/ratecard.go
Adds validation check in RateCardMeta.Validate that appends the new error when a metered entitlement template has IssueAfterReset == nil.
Test Updates
e2e/productcatalog_test.go, openmeter/subscription/errors_test.go
Updates test expectations to validate the new entitlement template validation issue across e2e and unit test scenarios.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • chrisgacsal
  • turip
  • GAlexIHU
✨ 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 fix/plan-entitlements-validation
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can make CodeRabbit's review stricter and more nitpicky using the `assertive` profile, if that's what you prefer.

Change the reviews.profile setting to assertive to make CodeRabbit's nitpick more issues in your PRs.

@tothandras tothandras marked this pull request as ready for review March 15, 2026 07:23
@tothandras tothandras requested a review from a team as a code owner March 15, 2026 07:23
@tothandras tothandras merged commit 0c2d53e into main Mar 15, 2026
26 of 28 checks passed
@tothandras tothandras deleted the fix/plan-entitlements-validation branch March 15, 2026 07:24
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants