Skip to content

Conversation

tninesling
Copy link
Contributor

@tninesling tninesling commented Jul 16, 2025

This change builds on #7875 to merge specs imported by subgraphs into the resulting supergraph. The main functions are collect_core_directives_to_compose (JS source) and validate_and_maybe_add_specs (JS source).

The former iterates over the subgraphs and creates a list of specs to merge in, along with their composition specifications. The output is then passed into the latter to actually apply the specs to the supergraph. The combination of these functions happens in prepare_supergraph which will be implemented in a future ticket.

This also includes a Rust implementation of the JS applyFeatureToSchema.


Checklist

Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.

  • PR description explains the motivation for the change and relevant context for reviewing
  • PR description links appropriate GitHub/Jira tickets (creating when necessary)
  • Changeset is included for user-facing changes
  • Changes are compatible1
  • Documentation2 completed
  • Performance impact assessed and acceptable
  • Metrics and logs are added3 and documented
  • Tests added and passing4
    • Unit tests
    • Integration tests
    • Manual tests, as necessary

Exceptions

Note any exceptions here

Notes

Footnotes

  1. It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this.

  2. Configuration is an important part of many changes. Where applicable please try to document configuration examples.

  3. A lot of (if not most) features benefit from built-in observability and debug-level logs. Please read this guidance on metrics best-practices.

  4. Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

@tninesling tninesling requested review from a team as code owners July 16, 2025 20:25
@apollo-librarian
Copy link

apollo-librarian bot commented Jul 16, 2025

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: 7de12cfbb67bebffd911fe88

Copy link
Contributor

@tninesling, please consider creating a changeset entry in /.changesets/. These instructions describe the process and tooling.

HashMap::new();

for subgraph_core_directive in directives_merge_info {
let mut name_in_supergraph: Option<&Name> = None;
Copy link
Contributor

Choose a reason for hiding this comment

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

Sachin had some code where we would return from the function if there was no compositionSpec, but I don't really see how that would be even in the old code, so I guess it's ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a section down below where we skip the current link if there's no name in the supergraph. It matches the JS implementation fairly faithfully, but we can always come back and change it later

@tninesling tninesling merged commit b7a0ec7 into dev Jul 18, 2025
15 checks passed
@tninesling tninesling deleted the tninesling/merge-links branch July 18, 2025 18:07
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