Skip to content

fix: dedupe and exclude disabled feature flags in schema page dropdown - #2938

Merged
JivusAyrus merged 4 commits into
mainfrom
suvij/eng-9696-controlplane-fix-duplicate-and-disabled-feature-flags-in
Jun 9, 2026
Merged

fix: dedupe and exclude disabled feature flags in schema page dropdown#2938
JivusAyrus merged 4 commits into
mainfrom
suvij/eng-9696-controlplane-fix-duplicate-and-disabled-feature-flags-in

Conversation

@JivusAyrus

@JivusAyrus JivusAyrus commented Jun 9, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes

    • Disabled feature flags are now excluded from API responses and router configuration.
    • Duplicate feature-flag entries are deduplicated so each flag appears only once when multiple composed versions exist.
    • Improved consistency when retrieving feature flags from the latest composition.
  • Tests

    • Added tests validating deduplication and disabled-flag filtering behavior.

Checklist

  • I have discussed my proposed changes in an issue and have received approval to proceed.
  • I have followed the coding standards of the project.
  • Tests or benchmarks have been added or updated.
  • Documentation has been updated on https://github.com/wundergraph/docs-website.
  • I have read the Contributors Guide.

@JivusAyrus
JivusAyrus requested a review from a team as a code owner June 9, 2026 11:26
@coderabbitai

coderabbitai Bot commented Jun 9, 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: d6f8ca7b-24e4-460e-a886-9e2421ee08cb

📥 Commits

Reviewing files that changed from the base of the PR and between 32530d9 and 1ed68e6.

📒 Files selected for processing (1)
  • controlplane/test/feature-flag/get-feature-flags-in-latest-composition-by-federated-graph.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • controlplane/test/feature-flag/get-feature-flags-in-latest-composition-by-federated-graph.test.ts

Walkthrough

Repository query now returns one latest composed schema-version per feature flag; the handler filters out disabled flags when building the response; tests were added to validate deduplication and disabled-flag filtering.

Changes

Feature flag deduplication and enabled filtering

Layer / File(s) Summary
Repository deduplication query
controlplane/src/core/repositories/FeatureFlagRepository.ts
getFeatureFlagSchemaVersionsByBaseSchemaVersion uses deduplication (SELECT DISTINCT ON by featureFlagId) joined with schemaVersion, ordered by schemaVersion.createdAt descending to keep one latest composed schema-version entry per feature flag.
Handler enabled flag filtering
controlplane/src/core/bufservices/feature-flag/getFeatureFlagsInLatestCompositionByFederatedGraph.ts
Fetched flags are added to the response only when the flag exists and flag.isEnabled is true, excluding disabled flags even if schema-version rows still exist.
Deduplication and disabled flag validation
controlplane/test/feature-flag/get-feature-flags-in-latest-composition-by-federated-graph.test.ts
New test enables split-config-loading, recomposes the same flag twice and asserts deduplication (single returned entry), composes a second flag and verifies both appear, then disables the second and verifies it is excluded; toggleFeatureFlag and formatISO imports were added.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


Possibly related PRs

  • wundergraph/cosmo#2930: Both PRs modify controlplane/src/core/repositories/FeatureFlagRepository.ts to ensure callers get the latest (deduped) feature-flag schema-version per base schema version/feature flag.
  • wundergraph/cosmo#2729: Both PRs touch the GetFeatureFlagsInLatestCompositionByFederatedGraph endpoint and the repository method that supplies composed schema-version rows, making them directly related to dedup/disabled-flag behavior.
🚥 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 accurately summarizes the two main changes: deduplicating feature flags and excluding disabled ones from the dropdown display.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

@github-actions

This comment has been minimized.

@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.13%. Comparing base (35a0ad6) to head (1ed68e6).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2938   +/-   ##
=======================================
  Coverage   65.12%   65.13%           
=======================================
  Files         327      327           
  Lines       47130    47135    +5     
  Branches     5239     5241    +2     
=======================================
+ Hits        30695    30700    +5     
  Misses      16411    16411           
  Partials       24       24           
Files with missing lines Coverage Δ
...FeatureFlagsInLatestCompositionByFederatedGraph.ts 77.33% <100.00%> (ø)
...ane/src/core/repositories/FeatureFlagRepository.ts 88.59% <100.00%> (+0.05%) ⬆️
🚀 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.

@JivusAyrus
JivusAyrus merged commit 8887e60 into main Jun 9, 2026
13 checks passed
@JivusAyrus
JivusAyrus deleted the suvij/eng-9696-controlplane-fix-duplicate-and-disabled-feature-flags-in branch June 9, 2026 13:18
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