Skip to content

feat: store changelog diff for feature flag compositions#3068

Merged
JivusAyrus merged 12 commits into
mainfrom
suvij/eng-9859-controlplane-store-schema-changelogdiff-for-feature-flag
Jul 22, 2026
Merged

feat: store changelog diff for feature flag compositions#3068
JivusAyrus merged 12 commits into
mainfrom
suvij/eng-9859-controlplane-store-schema-changelogdiff-for-feature-flag

Conversation

@JivusAyrus

@JivusAyrus JivusAyrus commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Feature-flag compositions now use feature-flag-aware schema composition and store schema versions for the specific target and feature flag.
    • Added retrieval of the latest valid schema version for a given feature flag to support accurate changelog baselines.
  • Bug Fixes

    • Changelog/diff generation for feature-flag compositions now compares against the correct prior baseline (no longer skipped).
    • Re-composing without schema changes now produces an empty changelog.
  • Tests

    • Added integration tests for feature-flag changelog additions and zero-change scenarios.

Checklist

Open Source AI Manifesto

This project follows the principles of the Open Source AI Manifesto. Please ensure your contribution aligns with its principles.

image

COMPLETES COSMO-126

@JivusAyrus
JivusAyrus requested a review from a team as a code owner July 10, 2026 13:24
…59-controlplane-store-schema-changelogdiff-for-feature-flag
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Feature-flag schema history is now used when composing and diffing feature-flag graphs. FeatureFlagRepository is wired through proposal, schema-check, and composition-service flows, with integration tests covering changed and unchanged schemas.

Changes

Feature-flag composition changelog

Layer / File(s) Summary
Feature-flag schema lookup
controlplane/src/core/repositories/FeatureFlagRepository.ts, controlplane/src/core/composition/composer.ts
Adds retrieval of the latest eligible feature-flag schema version and injects the repository into Composer.
Feature-flag changelog computation
controlplane/src/core/composition/composer.ts
Uses the feature-flag schema baseline for feature-flag compositions and permits changelog generation when required composition metadata is available.
Composition pipeline wiring and validation
controlplane/src/core/bufservices/proposal/*, controlplane/src/core/bufservices/subgraph/fixSubgraphSchema.ts, controlplane/src/core/repositories/SubgraphRepository.ts, controlplane/src/core/services/CompositionService.ts, controlplane/test/composition/getCompositionDetails.test.ts
Passes FeatureFlagRepository through composition entry points and adds tests for schema additions and unchanged recompositions.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: storing changelog diffs for feature flag compositions.
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.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
controlplane/src/core/repositories/FeatureFlagRepository.ts (1)

1621-1655: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

New method looks correct; consider consolidating with similar "latest valid flag composition" queries.

getLatestFeatureFlagSchemaVersion is logically sound: it scopes by schemaVersion.targetId + featureFlagId, requires isFeatureFlagComposition/isComposable, excludes rows with deployment/admission errors, and orders by graphCompositions.createdAt desc — correctly isolating the prior valid feature-flag composition per federated graph. Org-scoping is preserved transitively via the schemaVersion.organizationId filter.

This query is structurally near-identical to getLatestValidFlagCompositionClientSchema (lines 1523-1563) and shares most of its predicate logic with getFeatureFlagSchemaVersionByBaseSchemaVersion (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

📥 Commits

Reviewing files that changed from the base of the PR and between 935b792 and 69953b2.

📒 Files selected for processing (8)
  • controlplane/src/core/bufservices/proposal/createProposal.ts
  • controlplane/src/core/bufservices/proposal/updateProposal.ts
  • controlplane/src/core/bufservices/subgraph/fixSubgraphSchema.ts
  • controlplane/src/core/composition/composer.ts
  • controlplane/src/core/repositories/FeatureFlagRepository.ts
  • controlplane/src/core/repositories/SubgraphRepository.ts
  • controlplane/src/core/services/CompositionService.ts
  • controlplane/test/composition/getCompositionDetails.test.ts

Comment thread controlplane/src/core/composition/composer.ts Outdated
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.07843% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.16%. Comparing base (85f3294) to head (310ce70).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...src/core/bufservices/subgraph/fixSubgraphSchema.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3068      +/-   ##
==========================================
+ Coverage   61.83%   71.16%   +9.33%     
==========================================
  Files         262      335      +73     
  Lines       30810    49389   +18579     
  Branches        0     6049    +6049     
==========================================
+ Hits        19050    35148   +16098     
- Misses      10232    14215    +3983     
+ Partials     1528       26    -1502     
Files with missing lines Coverage Δ
...ne/src/core/bufservices/proposal/createProposal.ts 78.98% <100.00%> (ø)
...ne/src/core/bufservices/proposal/updateProposal.ts 76.32% <100.00%> (ø)
controlplane/src/core/composition/composer.ts 66.11% <100.00%> (ø)
...ane/src/core/repositories/FeatureFlagRepository.ts 93.01% <100.00%> (ø)
...lplane/src/core/repositories/SubgraphRepository.ts 91.67% <100.00%> (ø)
...ntrolplane/src/core/services/CompositionService.ts 87.98% <100.00%> (ø)
...src/core/bufservices/subgraph/fixSubgraphSchema.ts 1.05% <0.00%> (ø)

... and 590 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wilsonrivera wilsonrivera left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

Claude Code Review is paused for this repository. To reconnect it, an admin of this repository's GitHub organization (or the account owner, for personal repositories) who can also manage your Claude organization's Code Review settings needs to re-link GitHub in Code Review settings. This is a one-time step.

Tip: disable this comment in your organization's Code Review settings.

@JivusAyrus
JivusAyrus requested a review from wilsonrivera July 20, 2026 10:50
@JivusAyrus
JivusAyrus merged commit 9ed6dbb into main Jul 22, 2026
11 of 12 checks passed
@JivusAyrus
JivusAyrus deleted the suvij/eng-9859-controlplane-store-schema-changelogdiff-for-feature-flag branch July 22, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants