Skip to content

Conversation

@chrisgacsal
Copy link
Collaborator

@chrisgacsal chrisgacsal commented Dec 22, 2025

Overview

Fix static entitlement mapping in order to properly populate config attribute.

Summary by CodeRabbit

  • New Features
    • Static entitlement configuration is now included in API responses for improved data completeness.

✏️ Tip: You can customize this high-level summary in your review settings.

@chrisgacsal chrisgacsal self-assigned this Dec 22, 2025
@chrisgacsal chrisgacsal added the release-note/bug-fix Release note: Bug Fixes label Dec 22, 2025
@chrisgacsal chrisgacsal requested a review from a team as a code owner December 22, 2025 14:03
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 22, 2025

📝 Walkthrough

Walkthrough

This change propagates the static entitlement Config field through the API response and updates its type from string to []byte in the creation inputs, standardizing how configuration is handled in the mapping layer.

Changes

Cohort / File(s) Summary
Static entitlement config handling
openmeter/entitlement/driver/v2/mapping.go
Added public Config field ([]byte) to EntitlementStaticV2 and updated its population in the mapping. Changed EntitlementStaticCreateInputs.Config type from string to []byte, with direct field assignment replacing explicit conversion.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5–10 minutes

This is a focused type change and field propagation across a single file with straightforward logic.

Possibly related PRs

Suggested reviewers

  • tothandras
  • 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 directly reflects the main change—fixing static entitlement mapping to properly populate the config attribute.
✨ 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/static-entitlement

📜 Recent 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 1cda562 and 108dfd5.

📒 Files selected for processing (1)
  • openmeter/entitlement/driver/v2/mapping.go
🧰 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
⏰ 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). (8)
  • GitHub Check: Quickstart
  • GitHub Check: E2E
  • GitHub Check: Lint
  • GitHub Check: Test
  • GitHub Check: Code Generators
  • GitHub Check: Build
  • GitHub Check: Repository Scan
  • GitHub Check: Analyze (go)
🔇 Additional comments (2)
openmeter/entitlement/driver/v2/mapping.go (2)

344-344: Good simplification by removing the explicit type conversion.

Since json.RawMessage is literally a type alias for []byte, the direct assignment Config: v.Config works perfectly and eliminates unnecessary conversion overhead. This aligns the code with the internal model type while improving readability.


140-140: Config field is now properly propagated to the API response.

Both changes look solid. The direct mapping at line 140 is clean, and removing the unnecessary []byte conversion at line 344 makes sense since json.RawMessage is already a []byte alias. Types align well across the layer—staticentitlement validates Config as required at creation, and the API models expect the same. This properly completes the fix for static entitlement mapping.


Comment @coderabbitai help to get the list of available commands and usage tips.

@chrisgacsal chrisgacsal merged commit ddf8a23 into main Dec 22, 2025
32 of 33 checks passed
@chrisgacsal chrisgacsal deleted the fix/static-entitlement branch December 22, 2025 14:11
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.

4 participants