refactor(controlplane): convert # private methods to TypeScript private in CompositionService#2935
Conversation
…te in CompositionService
WalkthroughThis PR refactors ChangesCompositionService Private Method Refactoring
🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
controlplane/src/core/services/CompositionService.ts (2)
976-994:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd explicit return type on
deployGraph.
deployGraphis async and should declarePromise<void>explicitly to follow the TypeScript guideline.Suggested patch
private async deployGraph({ @@ - }) { + }): Promise<void> {As per coding guidelines, "Use explicit type annotations for function parameters and return types in TypeScript".
🤖 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/CompositionService.ts` around lines 976 - 994, The async method deployGraph lacks an explicit return type; update its signature to declare Promise<void> (e.g., change "private async deployGraph({...}: {...})" to "private async deployGraph(...): Promise<void>" ) so TypeScript has an explicit return annotation; keep the existing parameter types and body unchanged and ensure the compiler still type-checks with the new return type.Source: Coding guidelines
480-492:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd explicit return type on
legacyComposeAndDeployFeatureFlag.This async method currently relies on inference; please annotate its return type explicitly for consistency with the TS guideline.
Suggested patch
private async legacyComposeAndDeployFeatureFlag({ @@ - }) { + }): Promise<ComposeAndDeployResult> {As per coding guidelines, "Use explicit type annotations for function parameters and return types in TypeScript".
🤖 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/CompositionService.ts` around lines 480 - 492, Add an explicit return type to the async method legacyComposeAndDeployFeatureFlag; update its signature to include the appropriate Promise return type (e.g., Promise<void> if it does not return a value) so the function no longer relies on inferred types—modify the declaration of legacyComposeAndDeployFeatureFlag to append the explicit return type after the parameter list while keeping the existing parameter types (actorId, featureFlag, enabled, orgFeatures, prevFederatedGraphs).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.
Outside diff comments:
In `@controlplane/src/core/services/CompositionService.ts`:
- Around line 976-994: The async method deployGraph lacks an explicit return
type; update its signature to declare Promise<void> (e.g., change "private async
deployGraph({...}: {...})" to "private async deployGraph(...): Promise<void>" )
so TypeScript has an explicit return annotation; keep the existing parameter
types and body unchanged and ensure the compiler still type-checks with the new
return type.
- Around line 480-492: Add an explicit return type to the async method
legacyComposeAndDeployFeatureFlag; update its signature to include the
appropriate Promise return type (e.g., Promise<void> if it does not return a
value) so the function no longer relies on inferred types—modify the declaration
of legacyComposeAndDeployFeatureFlag to append the explicit return type after
the parameter list while keeping the existing parameter types (actorId,
featureFlag, enabled, orgFeatures, prevFederatedGraphs).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 31f44717-bd00-4d1e-a903-b004d3fd8849
📒 Files selected for processing (1)
controlplane/src/core/services/CompositionService.ts
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2935 +/- ##
===========================================
+ Coverage 41.27% 65.13% +23.86%
===========================================
Files 1045 327 -718
Lines 132938 47127 -85811
Branches 6359 5239 -1120
===========================================
- Hits 54867 30697 -24170
+ Misses 76298 16406 -59892
+ Partials 1773 24 -1749
🚀 New features to boost your workflow:
|
Summary
#privatemethods inCompositionServiceto TypeScriptprivatemethods@tracedclass decorator to instrument them with Sentry spansWhy
ECMAScript
#private methods use slot-based access that bypasses prototype reflection, so@tracedcannot see or wrap them. TypeScriptprivateprovides the same compile-time enforcement while remaining on the prototype at runtime.Summary by CodeRabbit