-
Notifications
You must be signed in to change notification settings - Fork 233
feat: add a feature to link subgraphs across namespaces #2156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JivusAyrus
merged 69 commits into
main
from
suvij/eng-7794-create-subgraph-linking-on-cosmo
Sep 10, 2025
Merged
Changes from all commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
2804f52
feat: add a feature to link subgraphs across namespaces
JivusAyrus 9416d16
fix: pr suggestions
JivusAyrus 40e0bb0
refactor: clean up linkSubgraph and unlinkSubgraph functions by remov…
JivusAyrus f7ec6e9
fix: update command options for linking subgraphs to use shorthand flags
JivusAyrus c857a12
feat: add linkSubgraph and unlinkSubgraph methods to PlatformService
JivusAyrus c63ce56
fix: tests
JivusAyrus f759e2b
refactor: implement transaction handling in linkSubgraph for improved…
JivusAyrus d122b94
feat: add is_subgraph_linked column to schema_checks and enhance subg…
JivusAyrus 7328e1f
feat: add linked_schema_checks table and enhance schema check functio…
JivusAyrus 383c856
feat: remove is_subgraph_linked column from schema_checks and update …
JivusAyrus 1dbaa2b
fix: correct typo in error message for source namespace not found
JivusAyrus 5ec57d2
feat: enforce NOT NULL constraints on linked_schema_checks table
JivusAyrus 8b927db
fix: update labels assignment in checkSubgraphSchema function
JivusAyrus 33ef538
Merge branch 'main' into suvij/eng-7794-create-subgraph-linking-on-cosmo
JivusAyrus 6849be2
feat: enhance schema check functionality with linked subgraph checks
JivusAyrus 7a35d13
refactor: streamline schema check response structure in checkSubgraph…
JivusAyrus ba3b7c9
feat: integrate linked schema check results into getCheckSummary
JivusAyrus 121ee0a
feat: add LinkedCheck to GetCheckSummaryResponse and implement linked…
JivusAyrus 74c0c8c
feat: add ui
JivusAyrus d0ea262
fix: ci
JivusAyrus b60a003
Merge branch 'main' into suvij/eng-7794-create-subgraph-linking-on-cosmo
JivusAyrus 809133f
fix: handle conflicts when inserting linked schema checks in SchemaCh…
JivusAyrus 4588b76
chore: add comments
JivusAyrus a13effc
feat: add detailed comments for linked check failure fields in CheckS…
JivusAyrus b47c78a
fix: correct typo in error message for nonexistent source namespace i…
JivusAyrus 983310a
fix: ci
JivusAyrus 68bc6d4
feat: enhance GetCheckSummaryResponse and related logic
JivusAyrus 1b497fb
chore: merge migrations
JivusAyrus 78d9540
Merge branch 'main' into suvij/eng-7794-create-subgraph-linking-on-cosmo
JivusAyrus 1da21c6
fix: improve ui
JivusAyrus 1f0bcd2
Merge branch 'suvij/eng-7794-create-subgraph-linking-on-cosmo' of git…
JivusAyrus bfa1829
fix: update heading for linked checks in CheckDetails component
JivusAyrus e677f19
feat: add LinkedCheck to SchemaCheck and update related logic
JivusAyrus 124be3f
fix: adjust target limit in checkSubgraphSchema function
JivusAyrus 1d9f833
fix: update hasClientTraffic logic in SubgraphRepository
JivusAyrus 163516f
fix: include organizationId in linked schema check retrieval
JivusAyrus 2dd7dfb
chore: revert
JivusAyrus 4b7c8db
fix: compute GraphQL schema conditionally in checkSubgraphSchema func…
JivusAyrus a87a212
fix: enhance linked schema check retrieval with organization context
JivusAyrus 67bf6dd
feat: add linked subgraph support to GetSubgraphByNameResponse
JivusAyrus 509dcdc
fix: typo
JivusAyrus 5266a00
fix: correct punctuation in linked check failure message for clarity
JivusAyrus 422f446
fix: pr suggestions
JivusAyrus 925770c
refactor: remove reason display from check details component
JivusAyrus f53f290
Merge branch 'main' into suvij/eng-7794-create-subgraph-linking-on-cosmo
JivusAyrus 2d449de
feat: enhance subgraph verification checks
JivusAyrus 090c794
fix: lint
JivusAyrus d88c2e6
fix: improve target subgraph validation
JivusAyrus e0bc161
fix: add validation for identical source and target subgraphs
JivusAyrus 71b6df9
fix: prevent self-linking of subgraphs
JivusAyrus 2936b7f
fix: update schema parsing in subgraph validation
JivusAyrus c176c96
fix: refine GraphQL schema computation logic
JivusAyrus de07989
Merge branch 'main' into suvij/eng-7794-create-subgraph-linking-on-cosmo
JivusAyrus e65e62c
fix: update link command description for clarity
JivusAyrus 7972033
feat: enhance InfoTooltip and Alert components
JivusAyrus 6be6324
fix: correct typo in link command description
JivusAyrus eefab47
refactor: update SchemaCheck to support multiple linked checks
JivusAyrus 19f706e
fix: correct target subgraph option syntax in link command
JivusAyrus 7d4020b
Merge branch 'main' into suvij/eng-7794-create-subgraph-linking-on-cosmo
JivusAyrus 90a1cf3
fix: update hasClientTraffic logic in checkSubgraphSchema
JivusAyrus 9ad97dc
feat: add isForcedSuccess field to SchemaCheck and related components
JivusAyrus 9ce750f
test: add validation for checks associated with contracts in federate…
JivusAyrus 337d976
Merge branch 'main' into suvij/eng-7794-create-subgraph-linking-on-cosmo
JivusAyrus 1551163
fix: update namespace option syntax in link and unlink commands
JivusAyrus 871f60a
Merge branch 'main' into suvij/eng-7794-create-subgraph-linking-on-cosmo
JivusAyrus 9ad06b8
feat: enhance proposal handling with linked traffic and pruning checks
JivusAyrus 5bec09a
refactor: update linked checks logic to account for forced success
JivusAyrus f4a09e4
refactor: standardize linked checks logic formatting
JivusAyrus c8f9de4
Merge branch 'main' into suvij/eng-7794-create-subgraph-linking-on-cosmo
JivusAyrus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common/common_pb'; | ||
| import { Command, program } from 'commander'; | ||
| import ora from 'ora'; | ||
| import pc from 'picocolors'; | ||
| import { getBaseHeaders } from '../../../core/config.js'; | ||
| import { BaseCommandOptions } from '../../../core/types/types.js'; | ||
|
|
||
| export default (opts: BaseCommandOptions) => { | ||
| const command = new Command('link'); | ||
| command.description( | ||
| 'Links a subgraph to another subgraph on the control plane. When performing schema checks on the source subgraph, traffic and pruning checks will also be performed on the target subgraph. This is useful for verifying the impact of the schema changes before they are propagated to the next environment.', | ||
| ); | ||
| command.argument('<source-subgraph-name>', 'The name of the subgraph to link.'); | ||
| command.option('-n, --namespace <string>', 'The namespace of the source subgraph.', 'default'); | ||
| command.requiredOption( | ||
| '-t, --target-subgraph <string>', | ||
| 'The name of the subgraph to link to. Format: <namespace>/<subgraph-name>', | ||
| ); | ||
|
|
||
| command.action(async (name, options) => { | ||
| // Split on all slashes, take first as namespace, join rest as subgraph name | ||
| const [targetNamespace, ...rest] = options.targetSubgraph.split('/'); | ||
| if (!targetNamespace || rest.length === 0) { | ||
| program.error('Target subgraph must be in the format <namespace>/<subgraph-name>'); | ||
| } | ||
|
|
||
| const targetSubgraphName = rest.join('/'); | ||
|
|
||
| // Prevent self-linking | ||
| if (options.namespace === targetNamespace && name === targetSubgraphName) { | ||
| program.error('The source and target subgraphs cannot be the same subgraphs.'); | ||
| } | ||
|
|
||
| const spinner = ora(`The subgraph "${name}" is being linked to "${targetSubgraphName}"...`).start(); | ||
|
|
||
| const resp = await opts.client.platform.linkSubgraph( | ||
| { | ||
| sourceSubgraphName: name, | ||
| sourceSubgraphNamespace: options.namespace, | ||
| targetSubgraphName, | ||
| targetSubgraphNamespace: targetNamespace, | ||
| }, | ||
| { | ||
| headers: getBaseHeaders(), | ||
| }, | ||
| ); | ||
|
|
||
| if (resp.response?.code === EnumStatusCode.OK) { | ||
| spinner.succeed('Subgraph was linked successfully.'); | ||
| } else { | ||
| spinner.fail('Failed to link subgraph.'); | ||
| if (resp.response?.details) { | ||
| console.log(pc.red(pc.bold(resp.response?.details))); | ||
| } | ||
| process.exitCode = 1; | ||
| // eslint-disable-next-line no-useless-return | ||
| return; | ||
| } | ||
| }); | ||
|
|
||
| return command; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common/common_pb'; | ||
| import { Command } from 'commander'; | ||
| import ora from 'ora'; | ||
| import pc from 'picocolors'; | ||
| import { getBaseHeaders } from '../../../core/config.js'; | ||
| import { BaseCommandOptions } from '../../../core/types/types.js'; | ||
|
|
||
| export default (opts: BaseCommandOptions) => { | ||
| const command = new Command('unlink'); | ||
| command.description('Unlinks a subgraph from another subgraph on the control plane.'); | ||
| command.argument('<source-subgraph-name>', 'The name of the subgraph to unlink.'); | ||
| command.option('-n, --namespace <string>', 'The namespace of the source subgraph.', 'default'); | ||
|
|
||
| command.action(async (name, options) => { | ||
| const spinner = ora(`The subgraph "${name}" is being unlinked...`).start(); | ||
|
|
||
| const resp = await opts.client.platform.unlinkSubgraph( | ||
| { | ||
| sourceSubgraphName: name, | ||
| sourceSubgraphNamespace: options.namespace, | ||
| }, | ||
| { | ||
| headers: getBaseHeaders(), | ||
| }, | ||
| ); | ||
|
|
||
| if (resp.response?.code === EnumStatusCode.OK) { | ||
| spinner.succeed('Subgraph was unlinked successfully.'); | ||
| } else { | ||
| spinner.fail('Failed to unlink subgraph.'); | ||
| if (resp.response?.details) { | ||
| console.log(pc.red(pc.bold(resp.response?.details))); | ||
| } | ||
| process.exitCode = 1; | ||
| // eslint-disable-next-line no-useless-return | ||
| return; | ||
| } | ||
|
JivusAyrus marked this conversation as resolved.
|
||
| }); | ||
|
|
||
| return command; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.