Skip to content

fix: incorrect number of feature flag composition when publishing feature subgraphs#3031

Merged
wilsonrivera merged 5 commits into
mainfrom
wilson/eng-9834-controlplane-incorrect-number-of-composition-when-publishing
Jun 29, 2026
Merged

fix: incorrect number of feature flag composition when publishing feature subgraphs#3031
wilsonrivera merged 5 commits into
mainfrom
wilson/eng-9834-controlplane-incorrect-number-of-composition-when-publishing

Conversation

@wilsonrivera

@wilsonrivera wilsonrivera commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Improved schema update recomposition when split-config is enabled: only feature flags that depend on the updated published feature subgraph are marked for reprocessing, avoiding unnecessary recomposition.
    • Preserved existing behavior when split-config is disabled, including handling of affected federated graphs.
  • Tests
    • Added integration tests for split-config loading that validate selective recomposition counts after feature subgraph publish/update events, with base feature-flag execution configuration remaining unchanged.

Checklist

Open Source AI Manifesto

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

@wilsonrivera
wilsonrivera requested a review from a team as a code owner June 29, 2026 22:10
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7d67f2b3-bab7-4a0f-ac62-0de1db0bccf1

📥 Commits

Reviewing files that changed from the base of the PR and between 601808c and 8bd1d99.

📒 Files selected for processing (1)
  • controlplane/test/feature-flag/feature-flag-integration.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • controlplane/test/feature-flag/feature-flag-integration.test.ts

Walkthrough

SubgraphRepository.writeSchemaAndCollectAffected now branches on split-config state when collecting affected feature flags and federated graphs. New integration tests publish feature subgraph updates and verify selective recomposition.

Changes

Affected feature flag scoping

Layer / File(s) Summary
Affected feature flag collection logic
controlplane/src/core/repositories/SubgraphRepository.ts
Legacy mode still marks federated graphs and enabled feature flags as affected; split-config mode now marks only feature flags whose featureSubgraphs include the published subgraph.
Selective recomposition integration tests
controlplane/test/feature-flag/feature-flag-integration.test.ts
Two split-config-loading tests publish feature subgraph updates and assert recomposition count deltas only for matching feature flags, while the base feature-flag execution config remains false.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • wundergraph/cosmo#2860: Modifies the same SubgraphRepository feature-subgraph recomposition tracking logic including affectedFeatureFlagIds and split-config gating.
  • wundergraph/cosmo#2969: Also modifies writeSchemaAndCollectAffected's affected feature flag/federated graph collection flow with memoized caching changes that overlap with this diff.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main fix: feature flag composition counts when publishing feature subgraphs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

🤖 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/test/feature-flag/feature-flag-integration.test.ts`:
- Around line 4120-4122: The test is only checking the total composition count,
so it can miss an unintended recomposition of the base graph. In feature-flag
integration test around the existing assertNumberOfCompositions and
assertFeatureFlagExecutionConfig calls, add the base-graph-only assertion using
excludeFeatureFlagCompositions to verify the base graph did not recompose, and
also verify the new feature-flag composition is associated with ffName2.
🪄 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: 99b7be8b-c99d-4815-aa63-961aea5e0450

📥 Commits

Reviewing files that changed from the base of the PR and between b7d9865 and 166ca37.

📒 Files selected for processing (2)
  • controlplane/src/core/repositories/SubgraphRepository.ts
  • controlplane/test/feature-flag/feature-flag-integration.test.ts

Comment thread controlplane/test/feature-flag/feature-flag-integration.test.ts Outdated
Comment thread controlplane/test/feature-flag/feature-flag-integration.test.ts
Comment thread controlplane/test/feature-flag/feature-flag-integration.test.ts Outdated
Comment thread controlplane/test/feature-flag/feature-flag-integration.test.ts Outdated

@Aenimus Aenimus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@Aenimus
Aenimus enabled auto-merge (squash) June 29, 2026 22:32
@Aenimus
Aenimus disabled auto-merge June 29, 2026 22:34
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.49%. Comparing base (b7d9865) to head (8bd1d99).

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3031       +/-   ##
===========================================
+ Coverage   46.52%   65.49%   +18.96%     
===========================================
  Files        1121      335      -786     
  Lines      154989    48737   -106252     
  Branches    10061     5424     -4637     
===========================================
- Hits        72111    31918    -40193     
+ Misses      81042    16793    -64249     
+ Partials     1836       26     -1810     
Files with missing lines Coverage Δ
...lplane/src/core/repositories/SubgraphRepository.ts 89.02% <100.00%> (+0.01%) ⬆️

... and 786 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 merged commit db31b60 into main Jun 29, 2026
13 checks passed
@wilsonrivera
wilsonrivera deleted the wilson/eng-9834-controlplane-incorrect-number-of-composition-when-publishing branch June 29, 2026 22:51
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