-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: broken namespace aliases and mutable selections #108
Conversation
Codecov Report
@@ Coverage Diff @@
## main #108 +/- ##
==========================================
+ Coverage 67.67% 68.48% +0.81%
==========================================
Files 24 24
Lines 2738 2618 -120
==========================================
- Hits 1853 1793 -60
+ Misses 734 690 -44
+ Partials 151 135 -16
Continue to review full report at Codecov.
|
Thanks @gmac, looks like an improvement on what we had. I'd like to refactor that whole piece at some point, as assuming the error is actually not an error makes the conditions read quite weird. That would require another way to figure out the field requested is a namespace, which I'm sure is possible but just requires some thinking. For now would you mind chucking a comment in the else case to say the error is ignored as it's assumed to be a namespace if |
b870bbc
to
81cb6ac
Compare
@lucianjon – comment added! I had the same thought about that error line, the logic is weird and goes against the grain of exceptions being exceptional. For a refactor, I've sort of been thinking that the FederationObjects: {
MyNamespace: { Kind: "namespace", Implementations: nil },
MyBoundary: { Kind: "boundary", Implementations: nil },
MyInterface: { Kind: "interface", Implementations: ["MyBoundary"] },
} That kind of structure would be able to distinguish boundaries and namespaces, and would provide a pre-compiled cache of all abstract boundaries so that they wouldn't have to be enumerated repeatedly. |
Wicked cheers, will get this in. Yeah agreed on the refactor, we have access to all the information we need when we merge schemas and could easily just keep it all stored on there. Can write an issue up for it or if you'd like to, go for it! |
Fixes some problems with namespace operations in the query planner, and simplifies the overall logic in the process.
Problems + Fixes
The namespace handler condition was demonstrably broken by field aliases: it composed its insertion point using field
Name
rather thanAlias
. This issue is now fixed.The namespace condition could also corrupt the user's original selection because it modified fields directly rather than making copies. This was problematic because it modified the selection used to filter the final result, as described in Filtering base interface selections is not type-aware #106. This is also fixed.
With the above adjustments made, the namespace condition ended up basically identical to the normal composite field handler. So, this simplifies the logic so that a failed location lookup now just flows into the normal field handlers; this new pattern has the added advantage of handing both leaf values and composite fields.
Resolves #106 by happy accident.