Skip to content

fix(federation): keep all components when normalizing interleaved origins - #10366

Open
inanna-apollo wants to merge 1 commit into
devfrom
inanna/fix-18-normalize-interleaved-origins
Open

inanna-apollo wants to merge 1 commit into
devfrom
inanna/fix-18-normalize-interleaved-origins

Conversation

@inanna-apollo

@inanna-apollo inanna-apollo commented Oct 2, 2026 •

Copy link
Copy Markdown

group_components_by_origin_and_sort grouped components with chunk_by, which only groups consecutive runs, and then collected the runs into an IndexMap keyed by origin. When components with the same origin were not adjacent, a later run overwrote an earlier one and its fields/directive applications were silently dropped.

Normalization itself produces that interleaving (it sorts by content across definition and extension origins), so normalizing an already normalized schema lost data, e.g. type Query { a z } extend type Query { m } normalizes to a, m, z and then to m, z. Group by origin across the whole input instead, preserving multiplicity.

Reachability

Test utility only: normalize_valid_schema is public but its only caller outside the module is the supergraph reversibility test. Freshly parsed SDL is never interleaved, but schemas built in code (such as extracted subgraphs) can be, and normalizing twice always loses data.

Testing

The regression test(s) in this PR fail on dev and pass with this change; neighboring test suites pass with no snapshot changes. Found during property-based testing of apollo-federation.


Checklist

  • 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 compatible
  • Documentation completed
  • Performance impact assessed and acceptable
  • Metrics and logs are added and documented
  • Tests added and passing
    • Unit tests
    • Integration tests
    • Manual tests, as necessary

@apollo-librarian

apollo-librarian Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 1 changed, 0 removed
* graphos/routing/(latest)/_sidebar.yaml

Build ID: 28412638d96b3fdfb1704620
Build Logs: View logs

URL: https://www.apollographql.com/docs/deploy-preview/28412638d96b3fdfb1704620


✅ AI Style Review — No Changes Detected

No MDX files were changed in this pull request.

Review Log: View detailed log

This review is AI-generated. Please use common sense when accepting these suggestions, as they may not always be accurate or appropriate for your specific context.

@github-actions

This comment has been minimized.

@inanna-apollo
inanna-apollo force-pushed the inanna/fix-18-normalize-interleaved-origins branch from c2fac2c to 7dc7af2 Compare October 5, 2026 18:04
@inanna-apollo
inanna-apollo marked this pull request as ready for review October 5, 2026 18:04
@inanna-apollo
inanna-apollo requested review from a team as code owners October 5, 2026 18:04
…gins

`group_components_by_origin_and_sort` grouped components with
`chunk_by`, which only groups consecutive runs, and then collected the
runs into an `IndexMap` keyed by origin. When components with the same
origin were not adjacent, a later run overwrote an earlier one and its
fields/directive applications were silently dropped.

Normalization itself produces that interleaving (it sorts by content
across definition and extension origins), so normalizing an already
normalized schema lost data, e.g. `type Query { a z } extend type Query
{ m }` normalizes to `a, m, z` and then to `m, z`. Group by origin
across the whole input instead, preserving multiplicity.
@inanna-apollo
inanna-apollo force-pushed the inanna/fix-18-normalize-interleaved-origins branch 3 times, most recently from 7dc7af2 to 4d85187 Compare October 5, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant