Repository navigation
feat(api): add customer entitlement value lookup by feature key - #5212
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openmeterio/openmeter/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (18)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe change adds an endpoint that returns a customer’s entitlement value for a feature key. It includes API and result types, server handling, Go and JavaScript client methods, and tests for evaluation time, value expansion, and access states. ChangesFeature-key value lookup
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant Client
participant ServerRoute
participant EntitlementHandler
participant EntitlementService
Client->>ServerRoute: GET feature value with customer, feature key, and optional parameters
ServerRoute->>EntitlementHandler: Forward request parameters
EntitlementHandler->>EntitlementService: Request entitlement access at evaluation time
EntitlementService-->>EntitlementHandler: Return access result
EntitlementHandler-->>Client: Return feature value or no-access result
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The feature-key value endpoint and clients have no identified issue that needs resolution before merge. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The new lookup makes entitlement values accessible by feature key, but the reviewed route uses the existing customer namespace and entitlement evaluation path. No authorization bypass was established. The intended permission scope for callers who can read balances and configuration still needs confirmation. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Hardening Proposals
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Overview
Add
GET /api/v3/openmeter/customers/{customerId}/entitlement-access/features/{featureKey}/valueto look up a customer's entitlement value by feature key.The endpoint uses the same access evaluation and optional value expansion as the entitlement-ID value route. For a feature without an entitlement, it returns
200withhas_access: falseand omitstypeandvalue, consistent with the feature check endpoint.Regenerate the OpenAPI spec, Go and TypeScript clients, and server interface; wire the handler and add handler and e2e coverage.
Notes for reviewer
Summary by CodeRabbit
The PR appears safe to merge; the remaining concern is non-blocking TypeScript client runtime coverage.
Fix with agent prompt
Summary
Adds a v3 customer entitlement-value lookup by feature key, including an optional evaluation time and metered-value expansion.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR Client[Client] --> Route[Feature-key value route] Route --> Handler[Namespace-scoped handler] Handler --> Service[Customer entitlement access service] Service --> Lookup[Entitlement active at requested time] Lookup --> Response{Entitlement found?} Response -->|No| Denied[No access; omit type and value] Response -->|Yes| Value[Map access and optional value expansion]Reviews (1) · Last reviewed commit: "feat(api): add customer entitlement valu..."