Skip to content

fix: validating ratecard with feature - #4352

Merged
chrisgacsal merged 1 commit into
mainfrom
fix/rc-feat-validation
May 13, 2026
Merged

chrisgacsal merged 1 commit into
mainfrom
fix/rc-feat-validation

Conversation

@chrisgacsal

@chrisgacsal chrisgacsal commented May 13, 2026 •

Copy link
Copy Markdown
Collaborator

Overview

Fix evaluating both FeatureID and FeatureKey for Ratecard in order to determine whether it has Feature assigned or not.

Summary by CodeRabbit

  • Improvements

    • Strengthened validation for rate cards to ensure entitlement templates and usage-based pricing require a linked feature, improving consistency and preventing invalid configurations.
  • Tests

    • Updated test doubles and validation tests to align with the enhanced rate card validation behavior.

Review Change Stack

@chrisgacsal chrisgacsal self-assigned this May 13, 2026
@chrisgacsal
chrisgacsal requested a review from a team as a code owner May 13, 2026 05:41
@chrisgacsal chrisgacsal added the release-note/bug-fix Release note: Bug Fixes label May 13, 2026
@coderabbitai

coderabbitai Bot commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f476a602-3d5e-468b-9917-10e8ad7a9b64

📥 Commits

Reviewing files that changed from the base of the PR and between d6a2294 and e134a0d.

📒 Files selected for processing (2)
  • openmeter/productcatalog/ratecard.go
  • openmeter/subscription/addon/extend_test.go
✅ Files skipped from review due to trivial changes (1)
  • openmeter/subscription/addon/extend_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • openmeter/productcatalog/ratecard.go

📝 Walkthrough

Walkthrough

The RateCard interface gains HasFeature() bool. RateCardMeta implements it (true when FeatureID or FeatureKey is set). Two validations in RateCardMeta.Validate() now use HasFeature(). A test stub (nonPointerRateCard) implements the new method.

Changes

RateCard feature presence abstraction

Layer / File(s) Summary
HasFeature() method and validation updates
openmeter/productcatalog/ratecard.go, openmeter/subscription/addon/extend_test.go
RateCard adds HasFeature() bool. RateCardMeta implements HasFeature() by checking FeatureID or FeatureKey. RateCardMeta.Validate() replaces direct FeatureKey checks with HasFeature() for entitlement-template and usage-based-price validations. Test double nonPointerRateCard now implements HasFeature().

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • gergely-kurucz-konghq
  • turip
  • tothandras
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: validating ratecard with feature' directly describes the main change: adding validation logic to check both FeatureID and FeatureKey when determining if a RateCard has a feature assigned.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/rc-feat-validation

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@chrisgacsal
chrisgacsal merged commit 183750f into main May 13, 2026
26 checks passed
@chrisgacsal
chrisgacsal deleted the fix/rc-feat-validation branch May 13, 2026 06:58

This branch was previously deployed

1 inactive deployment
dev — e134a0de Deployed May 13, 2026 by chrisgacsal via Migration Checks #14339
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