Skip to content
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

feat: Bump strawberry minumum version to 0.257.0 #688

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

bellini666
Copy link
Member

@bellini666 bellini666 commented Jan 9, 2025

Bump the minimum version of strawberry to 0.257.0, which contains strawberry.cast and allows us to mitigate GHSA-5xh2-23cc-5jc6

…ith multiple possibilities

Follow up to the security fix on Strawberry, which requires changes
to this integration as well.
@bellini666 bellini666 self-assigned this Jan 9, 2025
Copy link
Contributor

sourcery-ai bot commented Jan 9, 2025

Reviewer's Guide by Sourcery

This pull request bumps the minimum version of Strawberry to 0.257.0 and introduces a new get_node_caster function to handle type casting of resolved nodes. It also modifies the is_type_of method to consider type casts when determining the type of an object.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Type casting is now handled by the get_node_caster function.
  • Added a new function get_node_caster to handle type casting of resolved nodes.
  • Modified resolve_model_nodes and resolve_model_node to use the get_node_caster function for type casting.
  • Added a type variable _T to support generic type casting in get_node_caster function
strawberry_django/relay.py
Updated the is_type_of method to consider type casts.
  • Modified the is_type_of method to check for type casts using get_strawberry_type_cast before checking instance types
strawberry_django/type.py
Bumped the minimum version of Strawberry to 0.257.0
  • Updated the strawberry-graphql dependency version in pyproject.toml.
  • Regenerated poetry.lock to reflect the updated dependency version
pyproject.toml
poetry.lock
Added tests for relay query
  • Added a new test file test_query.py to verify correct model resolution in relay queries.
  • Added tests to check the correct model type is returned based on the provided node ID
tests/relay/test_query.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @bellini666 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟡 Testing: 1 issue found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

tests/relay/test_query.py Show resolved Hide resolved
tests/relay/test_query.py Show resolved Hide resolved
@bellini666 bellini666 merged commit dbaf898 into main Jan 9, 2025
30 checks passed
@bellini666 bellini666 deleted the is_type_of_security_issue branch January 9, 2025 18:41
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 93.75000% with 1 line in your changes missing coverage. Please review.

Project coverage is 89.05%. Comparing base (a30755f) to head (b1f19e1).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
strawberry_django/relay.py 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #688      +/-   ##
==========================================
+ Coverage   89.04%   89.05%   +0.01%     
==========================================
  Files          42       42              
  Lines        3823     3836      +13     
==========================================
+ Hits         3404     3416      +12     
- Misses        419      420       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

3 participants