router icon indicating copy to clipboard operation
router copied to clipboard

feat(federation): implement handle_requires

Open dariuszkuc opened this issue 1 year ago • 1 comments

Implements handle_requires method (port of handleRequires).

Resolves FED-25


Checklist

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

  • [ ] Changes are compatible[^1]
  • [ ] Documentation[^2] completed
  • [ ] Performance impact assessed and acceptable
  • Tests added and passing[^3]
    • [ ] 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]: Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

dariuszkuc avatar May 22 '24 05:05 dariuszkuc

Marking it as ready for review -> simple cases work but others are failing either due to multiple fetch nodes (which might be addressed by optimize) and others are failing when trying to use wrong schemas.

dariuszkuc avatar May 25 '24 18:05 dariuszkuc

Getting close - still debugging following

  • Object type "Query" has no field "t" -> fetch is against wrong subgraph (bad rebase?)
  • Union types don't have field "inner4", only "__typename" --> need to look into this
  • missing condition for skip/include test

dariuszkuc avatar May 29 '24 05:05 dariuszkuc

Object type "Query" has no field "t" -> fetch is against wrong subgraph (bad rebase?) interestingly, i ran into that a few times in the corpus tests. so that might not necessarily be a bug here. but does smell like a rebase gone wrong

lrlna avatar May 29 '24 10:05 lrlna

With latest changes handle_requires no longer crashes and generates a query plan.

Outstanding known issues

  • we generate extra fetch nodes which are not merged together
  • conditionals are not passed in (so @skip/@include doesnt work)

dariuszkuc avatar May 30 '24 06:05 dariuszkuc

I see two tests failing with different symptoms with PR, but I think their root cause hasn't changed (likely FED-240).

duckki avatar May 30 '24 21:05 duckki

NOTE: I've removed the "unneeded inline fragment" removal logic from the current from_element methods as I believe that was incorrect place to apply it. This had a side effect on breaking some of the passing tests (that now have those extra inline fragments). Fixing this should be tackled on as part of https://apollographql.atlassian.net/browse/FED-241

dariuszkuc avatar May 31 '24 15:05 dariuszkuc

Superseded by https://github.com/apollographql/router/pull/5309 as integration tests relying on entitlements don't work on forks.....

dariuszkuc avatar May 31 '24 18:05 dariuszkuc