feat: store changelog diff for feature flag compositions#3068
feat: store changelog diff for feature flag compositions#3068JivusAyrus wants to merge 4 commits into
Conversation
…59-controlplane-store-schema-changelogdiff-for-feature-flag
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughFeature-flag schema history is now used when composing and diffing feature-flag graphs. ChangesFeature-flag composition changelog
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
controlplane/src/core/repositories/FeatureFlagRepository.ts (1)
1621-1655: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winNew method looks correct; consider consolidating with similar "latest valid flag composition" queries.
getLatestFeatureFlagSchemaVersionis logically sound: it scopes byschemaVersion.targetId+featureFlagId, requiresisFeatureFlagComposition/isComposable, excludes rows with deployment/admission errors, and orders bygraphCompositions.createdAt desc— correctly isolating the prior valid feature-flag composition per federated graph. Org-scoping is preserved transitively via theschemaVersion.organizationIdfilter.This query is structurally near-identical to
getLatestValidFlagCompositionClientSchema(lines 1523-1563) and shares most of its predicate logic withgetFeatureFlagSchemaVersionByBaseSchemaVersion(lines 1567-1619). Three separate near-duplicate implementations of "the latest valid feature-flag-composed schema version" increase the risk that a future change to the composability rules (e.g., adding another error condition) is applied inconsistently across them.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@controlplane/src/core/repositories/FeatureFlagRepository.ts` around lines 1621 - 1655, Consolidate getLatestFeatureFlagSchemaVersion with the existing getLatestValidFlagCompositionClientSchema and getFeatureFlagSchemaVersionByBaseSchemaVersion query logic by extracting shared predicates or a reusable helper for selecting the latest valid feature-flag composition. Preserve each method’s distinct filters and return shape while centralizing composability and error-condition rules so future changes remain consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@controlplane/src/core/composition/composer.ts`:
- Around line 489-490: Update the comment above the guard in the composition
flow to remove the outdated reference to feature-flag compositions, accurately
documenting only that changelogs are skipped when the router execution config or
composed schema version ID is unavailable.
---
Nitpick comments:
In `@controlplane/src/core/repositories/FeatureFlagRepository.ts`:
- Around line 1621-1655: Consolidate getLatestFeatureFlagSchemaVersion with the
existing getLatestValidFlagCompositionClientSchema and
getFeatureFlagSchemaVersionByBaseSchemaVersion query logic by extracting shared
predicates or a reusable helper for selecting the latest valid feature-flag
composition. Preserve each method’s distinct filters and return shape while
centralizing composability and error-condition rules so future changes remain
consistent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fafaccd6-3c10-4ae5-89d5-c4c3837d4fde
📒 Files selected for processing (8)
controlplane/src/core/bufservices/proposal/createProposal.tscontrolplane/src/core/bufservices/proposal/updateProposal.tscontrolplane/src/core/bufservices/subgraph/fixSubgraphSchema.tscontrolplane/src/core/composition/composer.tscontrolplane/src/core/repositories/FeatureFlagRepository.tscontrolplane/src/core/repositories/SubgraphRepository.tscontrolplane/src/core/services/CompositionService.tscontrolplane/test/composition/getCompositionDetails.test.ts
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3068 +/- ##
==========================================
+ Coverage 61.66% 71.05% +9.38%
==========================================
Files 261 335 +74
Lines 30649 49325 +18676
Branches 0 6033 +6033
==========================================
+ Hits 18901 35046 +16145
- Misses 10222 14253 +4031
+ Partials 1526 26 -1500
🚀 New features to boost your workflow:
|
Summary by CodeRabbit
Checklist
Open Source AI Manifesto
This project follows the principles of the Open Source AI Manifesto. Please ensure your contribution aligns with its principles.