refactor(productcatalog): separate plan validation - #4909
Open
GAlexIHU wants to merge 3 commits into
Open
Conversation
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughPlan validation now separates structural checks from versioning checks. Create-plan validation applies both layers, while subscription plan conversion applies structural validation without temporary key or version values. ChangesPlan validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CreatePlanInput
participant Plan
participant ValidatePlanVersioning
participant ValidatePlanStructure
participant PlanFromPlanInput
CreatePlanInput->>Plan: ValidateWith(versioning, structure)
Plan->>ValidatePlanVersioning: Validate plan key
Plan->>ValidatePlanStructure: Validate plan structure
Plan-->>CreatePlanInput: Aggregated validation result
PlanFromPlanInput->>Plan: ValidateWith(structure)
Plan->>ValidatePlanStructure: Validate plan structure
Plan-->>PlanFromPlanInput: Structural validation result
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 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 |
GAlexIHU
marked this pull request as ready for review
August 11, 2026 11:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Why
Inline subscription plans intentionally have no catalog identity, but the shared plan validator required a key. The conversion path worked around that by mutating the plan with fake identity fields before validation. Separating structural validation from catalog versioning removes that mutation and keeps the full validator list in one place.
This preserves the existing versioning rules: a catalog plan requires a key, while its numeric version is assigned later and is not newly validated here.
Validation
POSTGRES_HOST=127.0.0.1 go test -tags=dynamic ./openmeter/productcatalog/... -count=1go vet -tags=dynamic ./openmeter/productcatalog/...git diff --checkSummary by CodeRabbit
Bug Fixes
Tests
Greptile Summary
The PR separates structural plan validation from catalog identity validation, allowing inline subscription plans to remain keyless while catalog plans still require a key.
Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Reviews (3): Last reviewed commit: "refactor(productcatalog): move plan meta..." | Re-trigger Greptile
Context used: