Skip to content

Conversation

z9905080
Copy link
Contributor

@z9905080 z9905080 commented Apr 1, 2025

This PR updates the Complexity functions to use the context correctly.

Fixes #3629

@StevenACoffman
Copy link
Collaborator

It looks like you need to do this:

go generate ./...

and then commit your changes

@z9905080
Copy link
Contributor Author

z9905080 commented Apr 1, 2025

It looks like you need to do this:

go generate ./...

and then commit your changes

Thank you, @StevenACoffman!
Yes, this is my first time committing to this project.

@StevenACoffman
Copy link
Collaborator

StevenACoffman commented Apr 1, 2025

Thanks! I appreciate you working on this. It looks like you are still missing adding the ctx context.Context, argument change in at least two other places:

@z9905080
Copy link
Contributor Author

z9905080 commented Apr 1, 2025

I checked and found two additional places that need to be fixed:

  • graphql/handler/testserver/testserver.go

@coveralls
Copy link

coveralls commented Apr 1, 2025

Coverage Status

coverage: 73.349%. remained the same
when pulling b1eda1f on z9905080:master
into 492bf92 on 99designs:master.

@z9905080
Copy link
Contributor Author

z9905080 commented Apr 1, 2025

Coverage Status

coverage: 73.349%. remained the same when pulling b1eda1f on z9905080:master into 492bf92 on 99designs:master.

Do I need to take additional steps to address the test coverage issues?

@z9905080
Copy link
Contributor Author

z9905080 commented Apr 1, 2025

image

Perhaps I could add some inconsequential test cases, but I'm not sure if that's a good approach.
In general, we don't specifically pursue such test cases.

@StevenACoffman
Copy link
Collaborator

StevenACoffman commented Apr 1, 2025

Thank you for your persistence in continuing to work on this!

I'm not overly concerned with the specific code coverage number, and don't want inconsequential test cases cluttering things.

However, your original issue did not describe the symptom that would have been seen without your fix, or how to reproduce the circumstances when it would occur.

Now, we do not have a test that prevents someone from accidentally re-introducing the same bug.

Before your change, when resolver did NOT retrieve the context correctly, what would the error have been?

Would there be any possible test case that could have simulated the old error before your change?

Could you think of a test case that would provide some regression safety here? I'm going to merge it as is, but if you think of a useful test case, I would still love another PR for it.

Otherwise, I'm looking forward to your next contribution!

@StevenACoffman StevenACoffman merged commit 4ca0dd6 into 99designs:master Apr 1, 2025
17 checks passed
john-markham pushed a commit to john-markham/gqlgen that referenced this pull request Apr 4, 2025
…xt (99designs#3630)

* feat: add GraphQL models and update complexity functions to use context

* feat: update Complexity function to use context parameter

* fix: update Complexity functions to accept context parameter

* Update complexity/complexity.go

---------

Co-authored-by: Steve Coffman <StevenACoffman@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regarding the use of context.TODO() in the code for complexity in codegen, which results in the resolver not retrieving the context correctly
3 participants