Skip to content

feat: resolve feature subgraphs in federated graph field usage - #3144

Open
JivusAyrus wants to merge 2 commits into
mainfrom
suvij/cosmo-392-studio-resolve-feature-subgraphs-in-federated-graph-field
Open

feat: resolve feature subgraphs in federated graph field usage#3144
JivusAyrus wants to merge 2 commits into
mainfrom
suvij/cosmo-392-studio-resolve-feature-subgraphs-in-federated-graph-field

Conversation

@JivusAyrus

@JivusAyrus JivusAyrus commented Aug 7, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Federated graph details now include associated feature subgraphs.
    • Field usage analytics display both regular and feature subgraphs.
    • Feature subgraphs are clearly identified and presented without unavailable navigation links.
  • Bug Fixes

    • Improved subgraph loading and conversion for consistent results.
    • Feature subgraph access now respects permission checks.

Checklist

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The platform response now carries feature subgraphs. The control plane retrieves and converts them with RBAC context. Studio passes them through graph context and displays them without SDL links.

Changes

Feature subgraph response flow

Layer / File(s) Summary
Platform response contract
proto/wg/cosmo/platform/v1/platform.proto, connect/src/wg/cosmo/platform/v1/platform_pb.ts
The federated graph response now includes repeated featureSubgraphs values. Generated bindings expose the field as Subgraph[].
Control plane retrieval and conversion
controlplane/src/core/repositories/FeatureFlagRepository.ts, controlplane/src/core/util.ts, controlplane/src/core/bufservices/federated-graph/getFederatedGraphByName.ts
The control plane retrieves feature subgraphs with RBAC context and converts regular and feature subgraphs to protobuf values. Error responses include empty feature subgraph collections.
Studio graph context and display
studio/src/components/layout/graph-layout.tsx, studio/src/components/analytics/field-usage.tsx
Studio adds feature subgraphs to graph context. Field usage resolves both collections and renders feature subgraphs without SDL links.

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

Possibly related PRs

🚥 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 and concisely describes the main change: resolving feature subgraphs in federated graph field usage.
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/src/core/repositories/FeatureFlagRepository.ts`:
- Around line 464-472: Update the feature-subgraph query flow in the repository
method accepting federatedGraphId, namespaceId, fedGraphLabelMatchers, limit,
offset, query, and rbac so IdP and RBAC predicates are applied before baseQuery
computes totalCount and applies pagination. Preserve the existing filtering near
line 557 as defense in depth, ensuring counts and pages contain only accessible
feature subgraphs.
🪄 Autofix

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: 7ab8151d-28d1-4bfe-b30e-57608dc290d0

📥 Commits

Reviewing files that changed from the base of the PR and between 5edbee2 and 899b02e.

⛔ Files ignored due to path filters (1)
  • connect-go/gen/proto/wg/cosmo/platform/v1/platform.pb.go is excluded by !**/*.pb.go, !**/gen/**
📒 Files selected for processing (7)
  • connect/src/wg/cosmo/platform/v1/platform_pb.ts
  • controlplane/src/core/bufservices/federated-graph/getFederatedGraphByName.ts
  • controlplane/src/core/repositories/FeatureFlagRepository.ts
  • controlplane/src/core/util.ts
  • proto/wg/cosmo/platform/v1/platform.proto
  • studio/src/components/analytics/field-usage.tsx
  • studio/src/components/layout/graph-layout.tsx

Comment thread controlplane/src/core/repositories/FeatureFlagRepository.ts
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Router-nonroot image scan passed

✅ No security vulnerabilities found in image:

ghcr.io/wundergraph/cosmo/router:sha-220c5661c13abd0962fa9155b321714f5fa1aebd-nonroot

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.37037% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.85%. Comparing base (64eaf60) to head (a6c0c96).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
studio/src/components/analytics/field-usage.tsx 0.00% 13 Missing ⚠️
...ervices/federated-graph/getFederatedGraphByName.ts 92.30% 1 Missing ⚠️
...ane/src/core/repositories/FeatureFlagRepository.ts 88.88% 1 Missing ⚠️
studio/src/components/layout/graph-layout.tsx 0.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (70.37%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3144       +/-   ##
===========================================
- Coverage   62.37%   43.85%   -18.52%     
===========================================
  Files         262     1071      +809     
  Lines       31003   140249   +109246     
  Branches        0     7361     +7361     
===========================================
+ Hits        19337    61507    +42170     
- Misses      10158    76879    +66721     
- Partials     1508     1863      +355     
Files with missing lines Coverage Δ
controlplane/src/core/util.ts 80.90% <100.00%> (ø)
...ervices/federated-graph/getFederatedGraphByName.ts 87.91% <92.30%> (ø)
...ane/src/core/repositories/FeatureFlagRepository.ts 92.97% <88.88%> (ø)
studio/src/components/layout/graph-layout.tsx 0.00% <0.00%> (ø)
studio/src/components/analytics/field-usage.tsx 0.00% <0.00%> (ø)

... and 816 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.

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
controlplane/src/core/repositories/FeatureFlagRepository.ts (1)

464-472: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Pass authContext.rbac to the public handler call.

Without it, both repository RBAC filters are skipped, including the final subgraph lookup. Make rbac required if unrestricted internal calls are not valid.

🤖 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 464
- 472, Update the public handler that invokes the repository method containing
the rbac parameter to pass authContext.rbac explicitly, ensuring both repository
RBAC filters and the final subgraph lookup execute. Make the rbac parameter
required in the relevant method signature unless unrestricted internal calls are
intentionally supported.
🤖 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.

Outside diff comments:
In `@controlplane/src/core/repositories/FeatureFlagRepository.ts`:
- Around line 464-472: Update the public handler that invokes the repository
method containing the rbac parameter to pass authContext.rbac explicitly,
ensuring both repository RBAC filters and the final subgraph lookup execute.
Make the rbac parameter required in the relevant method signature unless
unrestricted internal calls are intentionally supported.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9b143f6b-57d2-43e0-9afc-d5fc9f7207d0

📥 Commits

Reviewing files that changed from the base of the PR and between 899b02e and a6c0c96.

📒 Files selected for processing (1)
  • controlplane/src/core/repositories/FeatureFlagRepository.ts

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