PR https://github.com/apollographql/router/pull/6120 was the wrong solution. JS doesn't actually maintain the order
of the conditions, like I thought. Instead, it always puts @skip first
and @include second, the opposite of what Rust was doing.
This changes the implementation of Conditions::from_directives to
pick the directives out manually instead of iterating. Technically, this
does two iterations of the directive list...but, the code is a bit
simpler, I think.
In the second commit I do a small refactor to replace the is_negated
boolean by a ConditionKind enum. I found it quite tricky to
constantly translate the skip/include concepts to negation or not
while reading the code, so I hope this simplifies it a bit.
[ ] events - Stress test for events with a lot of users and deduplication ENABLED
[ ] events_big_cap_high_rate - Stress test for events with a lot of users, deduplication enabled and high rate event with a big queue capacity
[ ] events_big_cap_high_rate_callback - Stress test for events with a lot of users, deduplication enabled and high rate event with a big queue capacity using callback mode
[ ] events_callback - Stress test for events with a lot of users and deduplication ENABLED in callback mode
[ ] events_without_dedup - Stress test for events with a lot of users and deduplication DISABLED
[ ] events_without_dedup_callback - Stress test for events with a lot of users and deduplication DISABLED using callback mode
PR https://github.com/apollographql/router/pull/6120 was the wrong solution. JS doesn't actually maintain the order of the conditions, like I thought. Instead, it always puts
@skip
first and@include
second, the opposite of what Rust was doing.https://github.com/apollographql/federation/blob/cc4573471696ef78d04fa00c4cf8e5c50314ba9f/query-graphs-js/src/pathContext.ts#L13-L33
The queries I was testing with just happened to pass in https://github.com/apollographql/router/pull/6120.
This changes the implementation of
Conditions::from_directives
to pick the directives out manually instead of iterating. Technically, this does two iterations of the directive list...but, the code is a bit simpler, I think.In the second commit I do a small refactor to replace the
is_negated
boolean by aConditionKind
enum. I found it quite tricky to constantly translate the skip/include concepts to negation or not while reading the code, so I hope this simplifies it a bit.