router
router copied to clipboard
feat(federation): implement handle_requires
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.
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.
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
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
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/@includedoesnt work)
I see two tests failing with different symptoms with PR, but I think their root cause hasn't changed (likely FED-240).
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
Superseded by https://github.com/apollographql/router/pull/5309 as integration tests relying on entitlements don't work on forks.....