fix: active subgraph not shown on the subgraph details page - #3063
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3063 +/- ##
===========================================
- Coverage 71.03% 43.72% -27.31%
===========================================
Files 335 1069 +734
Lines 49283 139516 +90233
Branches 6027 7315 +1288
===========================================
+ Hits 35006 61002 +25996
- Misses 14251 76661 +62410
- Partials 26 1853 +1827
🚀 New features to boost your workflow:
|
Router-nonroot image scan passed✅ No security vulnerabilities found in image: |
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds feature subgraph fields to the platform schema, fetches and populates feature subgraphs in WorkspaceService, and updates studio workspace selection logic to use the new namespace data. ChangesFeature Subgraph Support
Estimated code review effort: 3 (Moderate) | ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
controlplane/src/core/services/WorkspaceService.ts (1)
172-203: 📐 Maintainability & Code Quality | 🔵 TrivialNo try/catch around the new DB call.
The coding guidelines require error handling with try-catch blocks for
.tsfiles; this new method has none aroundexecute(). Existing sibling methods share this omission, so this may be intentional (relying on an upstream error boundary) — worth confirming rather than enforcing per-method here.As per coding guidelines: "Add proper error handling with try-catch blocks."
🤖 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/services/WorkspaceService.ts` around lines 172 - 203, The new database read in WorkspaceService.fetchFeatureSubgraphs() calls .execute() without any local error handling, which conflicts with the TypeScript error-handling guideline. Update fetchFeatureSubgraphs() to wrap the query execution and any related DB work in a try-catch, and log/propagate the failure consistently with the surrounding WorkspaceService methods so the new feature-subgraph fetch path handles errors explicitly.Source: Coding guidelines
🤖 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/services/WorkspaceService.ts`:
- Around line 171-212: fetchFeatureSubgraphs currently does one query per
namespace, creating an N+1 pattern on the workspace-selector path. Refactor it
to batch all namespaces in one query like
fetchFederatedGraphs/fetchSubgraphsForFederatedGraphs: collect namespace IDs,
use inArray(...) in the conditions, query feature subgraphs once, then group the
returned rows in memory and assign namespace.featureSubgraphs per namespace.
Keep the existing RBAC check via SubgraphRepository.applyRbacConditionsToQuery
and preserve the fromJson(WorkspaceSubgraphSchema, ...) mapping when building
each feature subgraph.
In `@studio/src/components/dashboard/workspace-selector.tsx`:
- Around line 22-57: The `baseSubgraph` lookup in `workspace-selector.tsx` is
currently dead code because `GraphSelector` only consumes `activeGraph` and
`activeSubgraph`. Remove the `baseSubgraph` state from the `useMemo` return and
related lookup logic, or if feature-subgraph pages need it, thread it through
`GraphSelectorProps` and the `GraphSelector` component instead of leaving it
unused. Keep the fix centered around `useMemo`, `activeSubgraph`, and
`GraphSelector`.
---
Nitpick comments:
In `@controlplane/src/core/services/WorkspaceService.ts`:
- Around line 172-203: The new database read in
WorkspaceService.fetchFeatureSubgraphs() calls .execute() without any local
error handling, which conflicts with the TypeScript error-handling guideline.
Update fetchFeatureSubgraphs() to wrap the query execution and any related DB
work in a try-catch, and log/propagate the failure consistently with the
surrounding WorkspaceService methods so the new feature-subgraph fetch path
handles errors explicitly.
🪄 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: 53456a35-23be-43af-81a7-60ec70807488
⛔ Files ignored due to path filters (1)
connect-go/gen/proto/wg/cosmo/platform/v1/platform.pb.gois excluded by!**/*.pb.go,!**/gen/**
📒 Files selected for processing (5)
connect/src/wg/cosmo/platform/v1/platform_pb.tscontrolplane/src/core/services/WorkspaceService.tsproto/wg/cosmo/platform/v1/platform.protostudio/src/components/dashboard/graph-selector.tsxstudio/src/components/dashboard/workspace-selector.tsx
…ph-not-shown-in-header
…ph-not-shown-in-header
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.
Steps for testing
Subgraphson the sidebarFeature Subgraphstab