router icon indicating copy to clipboard operation
router copied to clipboard

Port shallow type addition for composition merge step

Open tninesling opened this issue 5 months ago • 1 comments

Overview

Ports Merger.addTypesShallow from JS federation (primary source). This involves adding a new check for determining whether a given type is an interface object type; some new utilities in TypeDefinitionPosition for adding empty, named positions to the merged schema; and some rather complicated updates to the error reporter (more details below).

Mismatch reporter updates

The logic to report unexpected type mismatches calls MismatchReporter.reportMismatchError, which has been ported along with the underlying MismatchReporter.reportMismatch. These functions assemble error messages in a fairly convoluted way. I would love to refactor them, but I'm too scared to do so while we don't have merge tests running. So, I've kept these as close to the JS source as possible for now.

Future directions

  1. In the short-term, we'll need to decide on an implementation of ASTNode, which is collected and attached to errors in the MismatchReporter. The new mismatch reporting utilities have a generic parameter which is a placeholder for whatever that struct ends up being, and I have marked the relevant codepoints with TODO comments so we can fill those in at a later date.
  2. Once we get merge tests ported over, we should seriously consider refactoring this error construction logic. It shouldn't take this many nested closures to create error strings with some subgraphs in them.

Checklist

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

  • [X] Changes are compatible[^1]
  • [ ] Documentation[^2] completed
  • [ ] Performance impact assessed and acceptable
  • [ ] Metrics and logs are added[^3] and documented
  • Tests added and passing[^4]
    • [ ] Unit Tests
    • [ ] Integration Tests
    • [ ] Manual Tests

Exceptions

Note any exceptions here

Notes

[^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 avatar Jun 11 '25 18:06 tninesling

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

github-actions[bot] avatar Jun 11 '25 18:06 github-actions[bot]

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 1 changed, 0 removed
* graphos/routing/(latest)/self-hosted/containerization/kubernetes/other-considerations.mdx

Build ID: 92decc295fca2f25a1042985

URL: https://www.apollographql.com/docs/deploy-preview/92decc295fca2f25a1042985

apollo-librarian[bot] avatar Jun 26 '25 14:06 apollo-librarian[bot]