Skip to content

feat: add disable resolvability validation flag#2065

Merged
Aenimus merged 7 commits intomainfrom
david/eng-7635-add-disable-resolvability-validation-flag
Jul 21, 2025
Merged

feat: add disable resolvability validation flag#2065
Aenimus merged 7 commits intomainfrom
david/eng-7635-add-disable-resolvability-validation-flag

Conversation

@Aenimus
Copy link
Copy Markdown
Member

@Aenimus Aenimus commented Jul 18, 2025

Summary by CodeRabbit

  • New Features

    • Added a new CLI flag --disable-resolvability-validation to various commands, allowing users to optionally disable resolvability validation for federated graphs, subgraphs, contracts, and feature flags. This is intended for troubleshooting scenarios only.
  • Bug Fixes

    • Fixed minor formatting and type naming issues in CLI and internal types for improved consistency and clarity.
  • Documentation

    • Updated CLI command descriptions to document the new troubleshooting flag.
  • Style

    • Improved import order and code formatting for better readability.
  • Tests

    • Enhanced test coverage to verify behavior when resolvability validation is disabled, including new integration and utility tests.

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/cosmo-docs.
  • I have read the Contributors Guide.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jul 18, 2025

Walkthrough

This change introduces a new option to disable resolvability validation across the entire stack for federated GraphQL graph operations. The option is added to CLI commands, protobuf schemas, backend service handlers, composition logic, and test utilities. Type and function signatures are updated throughout to propagate and support the new disableResolvabilityValidation flag, including changes to request/response types, composition factories, and federation result types. Extensive test updates and new test cases verify the correct behavior when resolvability validation is disabled.

Changes

File(s) Change Summary
cli/src/commands/... Added --disable-resolvability-validation flag to relevant CLI commands (contract, feature-flag, subgraph, federated-graph, router, graph version). The flag is documented as for troubleshooting only and passed to backend API calls.
cli/src/utils.ts, router/commands/compose.ts Updated composeSubgraphs to accept and pass through the new flag. Imports reordered for clarity.
composition/src/federation/* Refactored federation entry points to accept parameter objects with disableResolvabilityValidation. Updated internal calls and types accordingly.
composition/src/normalization/types.ts Renamed normalization result types (removed "Result" suffix) for clarity and consistency.
composition/src/types/types.ts Added type alias ContractName = string.
composition/src/v1/federation/types.ts Added parameter types for federation functions, supporting the new flag.
composition/src/v1/federation/federation-factory.ts, composition/src/v1/federation/utils.ts Added disableResolvabilityValidation to factory params and logic. Updated constructor and method signatures.
composition/src/index.ts Re-exported new/updated types for wider availability.
connect/src/wg/cosmo/platform/v1/platform_pb.ts Added optional boolean disableResolvabilityValidation to multiple request message classes.
proto/wg/cosmo/platform/v1/platform.proto Added disable_resolvability_validation field to relevant protobuf request messages.
controlplane/src/core/bufservices/* Integrated the new flag into all relevant service handlers by passing it as composition options. Updated imports and parameter orders for consistency.
controlplane/src/core/composition/composer.ts, composition.ts Updated composition methods to accept and propagate CompositionOptions, including the new flag.
controlplane/src/core/repositories/FederatedGraphRepository.ts, SubgraphRepository.ts Updated method signatures to accept and pass through compositionOptions. Reordered parameters for clarity.
controlplane/src/core/util.ts Updated utility functions to accept and pass CompositionOptions. Added newCompositionOptions helper.
controlplane/src/types/index.ts Added new exported type alias CompositionOptions.
Tests: composition/tests/* Updated all test utilities and test suites to use new federation function signatures and result types. Added/updated helper functions for success/failure cases. Added new tests for resolvability validation disabling.
controlplane/test/integrations.test.ts Added integration test to verify disabling resolvability validation works as intended.
controlplane/test/test-util.ts Added exported SDL constants for resolvability validation tests.
shared/src/router-config/builder.ts Made kind property in subgraph interfaces readonly.
shared/test/router.config.test.ts, shared/test/testdata/utils.ts Updated test calls to new federation function signatures and result types.
✨ 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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 18, 2025

Router-nonroot image scan passed

✅ No security vulnerabilities found in image:

ghcr.io/wundergraph/cosmo/router:sha-334c07d3156dc7e40158a56cc549406d0991aaaf-nonroot

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (14)
proto/wg/cosmo/platform/v1/platform.proto (14)

95-95: Same observation as above – see main comment.


136-136: Same observation as above – see main comment.


177-177: Same observation as above – see main comment.


636-636: Same observation as above – see main comment.


655-655: Same observation as above – see main comment.


686-686: Same observation as above – see main comment.


2072-2072: Same observation as above – see main comment.


2200-2200: Same observation as above – see main comment.


2219-2219: Same observation as above – see main comment.


2249-2249: Same observation as above – see main comment.


2265-2265: Same observation as above – see main comment.


2279-2279: Same observation as above – see main comment.


2293-2293: Same observation as above – see main comment.


2599-2599: Same observation as above – see main comment.

🧹 Nitpick comments (3)
cli/src/commands/feature-flag/commands/enable.ts (1)

24-24: Consider the property ordering change.

The enabled: true property was moved before name and namespace. While this doesn't affect functionality, ensure this reordering was intentional and aligns with any API documentation or conventions.

composition/tests/v1/types/unions.test.ts (1)

472-475: LGTM! Test function replacements are consistent.

All test cases have been correctly updated to use the new helper functions. However, some calls retain explicit type assertions (e.g., as FederationResultSuccess) which are now redundant since the helper functions return correctly typed results.

Consider removing these redundant type assertions for consistency:

-      ) as FederationResultSuccess;
+      );

Also applies to: 500-503, 528-531, 538-541, 582-585, 626-629, 638-641, 650-653, 733-736, 816-819, 853-856, 890-893, 920-923, 965-968, 1010-1013

proto/wg/cosmo/platform/v1/platform.proto (1)

58-58: Document & harmonise disable_resolvability_validation flag across messages

Good to see the flag added, but it lacks any explanatory comment and the name diverges from the existing skip_traffic_check boolean.
Consider:

  1. Adding a short doc-comment before every occurrence to describe when it should be set and its default behaviour (validation ON when unset).
  2. Evaluating a more consistent verb such as skip_resolvability_validation (mirrors skip_traffic_check) to keep the API surface uniform.
  3. If this option will be reused elsewhere, encapsulate it in a small CompositionOptions message and embed that instead of duplicating a scalar across 15+ request types (DRY).

None of these is a blocker for wire-compatibility, but tightening them up now will save churn later.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
shared/test/router.config.test.ts (1)

33-33: Update federateTestSubgraphs to use the new object‐based API

The test helper still calls the old signature

federateSubgraphs([,], version)

but the runtime API now expects a single object. Update the implementation in shared/test/testdata/utils.ts so that it matches the new pattern.

Files to change:

  • shared/test/testdata/utils.ts

Suggested diff:

--- a/shared/test/testdata/utils.ts
+++ b/shared/test/testdata/utils.ts
@@
-export function federateTestSubgraphs(): FederationResult {
+export function federateTestSubgraphs(): FederationResult {
   const accounts: Subgraph = { … };
   const inventory: Subgraph = { … };
   // …
-  return federateSubgraphs([accounts, inventory, products, reviews], LATEST_ROUTER_COMPATIBILITY_VERSION);
+  return federateSubgraphs({
+    subgraphs: [accounts, inventory, products, reviews],
+    version: LATEST_ROUTER_COMPATIBILITY_VERSION,
+  });
 }

This change will align your test helper with the updated federateSubgraphs({ subgraphs, version }) signature and resolve the “Cannot read properties of undefined (reading ‘length’)” errors.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 08e3000 and a44ca2f.

⛔ 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 (19)
  • cli/src/commands/graph/federated-graph/commands/check.ts (1 hunks)
  • cli/src/commands/router/commands/compose.ts (3 hunks)
  • cli/src/commands/subgraph/commands/fix.ts (2 hunks)
  • cli/src/commands/subgraph/commands/update.ts (3 hunks)
  • composition/src/federation/federation.ts (1 hunks)
  • composition/src/v1/federation/federation-factory.ts (10 hunks)
  • composition/tests/v1/directives/inaccessible.test.ts (13 hunks)
  • composition/tests/v1/entities.test.ts (23 hunks)
  • composition/tests/v1/types/enums.test.ts (10 hunks)
  • composition/tests/v1/types/inputs.test.ts (7 hunks)
  • composition/tests/v1/types/unions.test.ts (13 hunks)
  • connect/src/wg/cosmo/platform/v1/platform_pb.ts (32 hunks)
  • controlplane/src/core/bufservices/federated-graph/checkFederatedGraph.ts (2 hunks)
  • controlplane/src/core/bufservices/subgraph/fixSubgraphSchema.ts (4 hunks)
  • controlplane/src/core/repositories/FederatedGraphRepository.ts (9 hunks)
  • controlplane/src/core/repositories/SubgraphRepository.ts (6 hunks)
  • proto/wg/cosmo/platform/v1/platform.proto (17 hunks)
  • shared/src/router-config/builder.ts (3 hunks)
  • shared/test/router.config.test.ts (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • shared/src/router-config/builder.ts
🚧 Files skipped from review as they are similar to previous changes (15)
  • controlplane/src/core/bufservices/subgraph/fixSubgraphSchema.ts
  • composition/tests/v1/directives/inaccessible.test.ts
  • cli/src/commands/subgraph/commands/update.ts
  • cli/src/commands/router/commands/compose.ts
  • cli/src/commands/graph/federated-graph/commands/check.ts
  • composition/tests/v1/types/inputs.test.ts
  • composition/tests/v1/types/enums.test.ts
  • composition/tests/v1/types/unions.test.ts
  • composition/tests/v1/entities.test.ts
  • controlplane/src/core/repositories/SubgraphRepository.ts
  • composition/src/federation/federation.ts
  • connect/src/wg/cosmo/platform/v1/platform_pb.ts
  • proto/wg/cosmo/platform/v1/platform.proto
  • controlplane/src/core/repositories/FederatedGraphRepository.ts
  • composition/src/v1/federation/federation-factory.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
controlplane/src/core/bufservices/federated-graph/checkFederatedGraph.ts (1)
controlplane/src/utils/utils.ts (1)
  • newCompositionOptions (3-10)
🪛 GitHub Actions: Shared CI
shared/test/router.config.test.ts

[error] 33-33: Test failure: TypeError: Cannot read properties of undefined (reading 'length') in 'Build Subgraph schema' test.


[error] 114-114: Test failure: TypeError: Cannot read properties of undefined (reading 'length') in 'Build config with plugin subgraph' test.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (16)
  • GitHub Check: build-router
  • GitHub Check: build_test
  • GitHub Check: build_push_image
  • GitHub Check: integration_test (./. ./fuzzquery ./lifecycle ./modules)
  • GitHub Check: integration_test (./telemetry)
  • GitHub Check: build_push_image
  • GitHub Check: build_test
  • GitHub Check: integration_test (./events)
  • GitHub Check: build_push_image (nonroot)
  • GitHub Check: image_scan
  • GitHub Check: image_scan (nonroot)
  • GitHub Check: build_push_image
  • GitHub Check: build_test
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: build_test
🔇 Additional comments (6)
shared/test/router.config.test.ts (3)

202-205: LGTM: Correct API update for object-based parameters.

The function call has been properly updated to use the new object-based parameter structure, which supports the new disableResolvabilityValidation flag and improves API consistency.


256-259: LGTM: Consistent API update.

This change correctly follows the same object-based parameter pattern as the other federateSubgraphs calls in the file.


310-313: LGTM: Final API update completed.

This change completes the consistent update of federateSubgraphs calls to use the new object-based parameter structure.

controlplane/src/core/bufservices/federated-graph/checkFederatedGraph.ts (2)

19-19: LGTM: Import addition is correct.

The import of newCompositionOptions utility function is properly added and will be used to handle the new disable resolvability validation feature.


103-103: LGTM: Correct integration of disable resolvability validation flag.

The addition of the third parameter using newCompositionOptions(req.disableResolvabilityValidation) properly integrates the new feature flag into the composition process. The utility function correctly handles the conversion from the boolean flag to composition options.

cli/src/commands/subgraph/commands/fix.ts (1)

4-4: LGTM: Good cleanup of unused import.

Removing the unused join import while keeping resolve improves code maintainability.

Copy link
Copy Markdown
Member

@JivusAyrus JivusAyrus left a comment

Choose a reason for hiding this comment

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

Should we write some tests?

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
controlplane/test/integrations.test.ts (1)

198-267: Well-structured integration test for resolvability validation feature.

The test comprehensively verifies the new disableResolvabilityValidation flag functionality by testing both enabled and disabled scenarios. The test logic is sound:

  1. Creates the necessary setup (namespace, federated graph, first subgraph)
  2. Verifies schema checking fails with validation enabled but succeeds when disabled
  3. Confirms publishing behavior matches the validation results
  4. Includes proper cleanup

The assertions correctly verify both status codes and composition error counts for each scenario.

Consider extracting the subgraph name generation and reusing it for better maintainability:

+ const subgraphNameOne = genID('one');
  const publishResponseOne = await client.publishFederatedSubgraph({
-   name: genID('one'),
+   name: subgraphNameOne,
    namespace,
    routingUrl: 'http://localhost:4001',
    schema: resolvabilitySDLOne,
  });
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0450be2 and 659fd11.

📒 Files selected for processing (21)
  • composition/src/v1/federation/federation-factory.ts (10 hunks)
  • composition/tests/v1/resolvability.test.ts (38 hunks)
  • controlplane/src/core/bufservices/contract/createContract.ts (2 hunks)
  • controlplane/src/core/bufservices/contract/updateContract.ts (2 hunks)
  • controlplane/src/core/bufservices/feature-flag/createFeatureFlag.ts (2 hunks)
  • controlplane/src/core/bufservices/feature-flag/deleteFeatureFlag.ts (2 hunks)
  • controlplane/src/core/bufservices/feature-flag/enableFeatureFlag.ts (2 hunks)
  • controlplane/src/core/bufservices/feature-flag/updateFeatureFlag.ts (2 hunks)
  • controlplane/src/core/bufservices/federated-graph/checkFederatedGraph.ts (2 hunks)
  • controlplane/src/core/bufservices/federated-graph/createFederatedGraph.ts (2 hunks)
  • controlplane/src/core/bufservices/federated-graph/updateFederatedGraph.ts (2 hunks)
  • controlplane/src/core/bufservices/graph/setGraphRouterCompatibilityVersion.ts (2 hunks)
  • controlplane/src/core/bufservices/subgraph/checkSubgraphSchema.ts (2 hunks)
  • controlplane/src/core/bufservices/subgraph/deleteFederatedSubgraph.ts (2 hunks)
  • controlplane/src/core/bufservices/subgraph/fixSubgraphSchema.ts (4 hunks)
  • controlplane/src/core/bufservices/subgraph/moveSubgraph.ts (2 hunks)
  • controlplane/src/core/bufservices/subgraph/publishFederatedSubgraph.ts (2 hunks)
  • controlplane/src/core/bufservices/subgraph/updateSubgraph.ts (2 hunks)
  • controlplane/src/core/util.ts (3 hunks)
  • controlplane/test/integrations.test.ts (2 hunks)
  • controlplane/test/test-util.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • controlplane/test/test-util.ts
🚧 Files skipped from review as they are similar to previous changes (19)
  • controlplane/src/core/bufservices/federated-graph/checkFederatedGraph.ts
  • controlplane/src/core/bufservices/feature-flag/deleteFeatureFlag.ts
  • controlplane/src/core/bufservices/subgraph/publishFederatedSubgraph.ts
  • controlplane/src/core/bufservices/subgraph/checkSubgraphSchema.ts
  • controlplane/src/core/bufservices/subgraph/updateSubgraph.ts
  • controlplane/src/core/bufservices/subgraph/moveSubgraph.ts
  • controlplane/src/core/bufservices/feature-flag/createFeatureFlag.ts
  • controlplane/src/core/bufservices/federated-graph/createFederatedGraph.ts
  • controlplane/src/core/bufservices/feature-flag/enableFeatureFlag.ts
  • controlplane/src/core/bufservices/contract/createContract.ts
  • controlplane/src/core/bufservices/subgraph/fixSubgraphSchema.ts
  • controlplane/src/core/bufservices/federated-graph/updateFederatedGraph.ts
  • controlplane/src/core/bufservices/subgraph/deleteFederatedSubgraph.ts
  • controlplane/src/core/bufservices/contract/updateContract.ts
  • controlplane/src/core/bufservices/feature-flag/updateFeatureFlag.ts
  • controlplane/src/core/bufservices/graph/setGraphRouterCompatibilityVersion.ts
  • composition/tests/v1/resolvability.test.ts
  • controlplane/src/core/util.ts
  • composition/src/v1/federation/federation-factory.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
controlplane/test/integrations.test.ts (3)
controlplane/test/test-util.ts (4)
  • SetupTest (66-417)
  • createNamespace (810-815)
  • resolvabilitySDLOne (962-970)
  • resolvabilitySDLTwo (972-976)
controlplane/src/core/test-util.ts (1)
  • genID (53-55)
connect/src/wg/cosmo/platform/v1/platform-PlatformService_connectquery.ts (1)
  • createNamespace (74-83)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (16)
  • GitHub Check: build-router
  • GitHub Check: build_push_image (nonroot)
  • GitHub Check: integration_test (./telemetry)
  • GitHub Check: build_push_image
  • GitHub Check: image_scan (nonroot)
  • GitHub Check: integration_test (./. ./fuzzquery ./lifecycle ./modules)
  • GitHub Check: image_scan
  • GitHub Check: integration_test (./events)
  • GitHub Check: build_test
  • GitHub Check: build_test
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: build_push_image
  • GitHub Check: build_test
  • GitHub Check: build_test
  • GitHub Check: build_push_image
🔇 Additional comments (1)
controlplane/test/integrations.test.ts (1)

9-9: LGTM!

The new imports for resolvabilitySDLOne and resolvabilitySDLTwo are correctly added to support the resolvability validation test.

@Aenimus Aenimus merged commit 0c920cc into main Jul 21, 2025
43 checks passed
@Aenimus Aenimus deleted the david/eng-7635-add-disable-resolvability-validation-flag branch July 21, 2025 11:33
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.

4 participants