-
Notifications
You must be signed in to change notification settings - Fork 0
fix(11139): Team.agendaItems returns null for non-nullable field #4
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
base: master
Are you sure you want to change the base?
Conversation
| {authToken, dataLoader}: GQLContext | ||
| ) { | ||
| if (!isTeamMember(authToken, teamId)) return null | ||
| if (!isTeamMember(authToken, teamId)) return [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is the right call. While it fixes the symptom, it would be good to know why the client is requesting agendaItems for non-teammembers as it probably points to a (slightly) broader issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, good point @Dschoordsch. For simplicity, I'll consider that a new (broader) issue #5 and consider this (smaller) issue reproduced. Should we land a fix for the symptom in the mean time? If so, I can clean this up and contribute the small fix in the mean time.
@priyankc will run WorkBack with your feedback and check if it can reproduce the bug #5 more upstream to find a broader issue. We'll open a separate PR for that to keep things clean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer if we look for the real fix first. If we just make this error case not an error anymore, we will just hide the potential logic issue.
The backtrace shows it's happening during accepting a team invitation. So I think the user in question might in fact be a team member, but the subscription is evaluated before the auth token of that user was updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great feedback and thanks for the pointers. @priyankc will take ownership of this issue from here 👍
|
I’ve rerun the tool based on your feedback. The issue stems from a race condition: the Here's a more detailed analysis: https://gist.github.com/priyankc/26b49eb1e176ed40b8e4f3be7f6a3d5d As to why these nulls started showing on the issue date, I can't exactly put my finger on. But my theory is that the code changes related to accepting invite might have introduced a delay aggravating the race condition in v9.1.2 release: ParabolInc#11156 (it would be good to check datadog again) If you think this is a good hypothesis, I can run the tool to create the PR. I personally think Option 3 in the above report could be a good approach. |
Description
Reproduces and fixes: ParabolInc#11139
Root cause: https://hyperdrive.engineering/#report-73a346fc-6197-4132-aa59-acb964032a74
Other changes:
Bug Reproduction: Team.agendaItems Resolver Returns Null for Non-nullable Field
I've successfully verified that the bug exists in the codebase. The issue is in the Team.agendaItems resolver in
packages/server/graphql/types/Team.tswhere it returnsnullwhen a user is not a team member, which violates the non-nullable constraint defined in the GraphQL schema.Steps to Reproduce
Examined the code in
packages/server/graphql/types/Team.tsand confirmed that the agendaItems resolver returns null for non-team members:Confirmed that the GraphQL schema defines agendaItems as a non-nullable field (
[AgendaItem!]!)Created and executed a test file
packages/server/__tests__/teamAgendaItemsResolver.test.tsto document the issue:Applied fix
Ran test again and confirmed the bug is fixed
Expected Behavior
The resolver should return an empty array
[]when a user is not a team member, which would satisfy the non-nullable constraint in the GraphQL schema.Actual Behavior
The resolver returns
nullwhen a user is not a team member, which violates the non-nullable constraint in the GraphQL schema, causing the error: "Cannot return null for non-nullable field Team.agendaItems".Additional Information
The issue only manifests in specific contexts, particularly during the team invitation acceptance flow when the AcceptTeamInvitationPayload.team resolver is used. This is because:
The fix requires changing:
to: