Repository navigation
Conversation
extract_fields read .name on every child of an inline fragment, so a nested inline fragment raised AttributeError. Infrahub calls it through GraphQLQueryAnalyzer.calculate_depth after it runs an operation, and answered such a query with HTTP 500. An inline fragment now contributes the fields that extract_fields returns for its selection set. A fragment spread inside an inline fragment is skipped, as it already was outside one, instead of being reported as a field named after the fragment. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Deploying infrahub-sdk-python with
|
| Latest commit: |
393241e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ad33c7e3.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://pog-em-extract-fields-nested.infrahub-sdk-python.pages.dev |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## pog-em/analyzer-resolve-top-level-fragments #1569 +/- ##
===============================================================================
+ Coverage 87.90% 87.95% +0.04%
===============================================================================
Files 157 157
Lines 15674 15669 -5
Branches 2118 2116 -2
===============================================================================
+ Hits 13779 13782 +3
+ Misses 1334 1330 -4
+ Partials 561 557 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
polmichel
marked this pull request as draft
December 1, 2026 14:17
extract_fields merged two selections of the same field with dict.update,
which replaced the nested dictionaries of the first selection. For
`cars { edges { node { id } } } cars { edges { node { name } } }` only
`name` remained under `node`. A field selected first without
sub-fields and then with them kept none.
The merge now uses deep_merge_dict, so the selections are combined at
every level.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
polmichel
marked this pull request as ready for review
December 1, 2026 15:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1557.
A nested inline fragment made
extract_fieldsraiseextract_fields(infrahub_sdk/utils.py) read.nameon every child of an inline fragment. An inline fragment written inside another inline fragment has no name, so the call raisedAttributeError: 'InlineFragmentNode' object has no attribute 'name'.GraphQLQueryAnalyzer.get_fields,calculate_depthandcalculate_heightraised the same error.Infrahub calls
calculate_depthfor its metrics after it runs an operation. On a live stack that ran opsmill/infrahub#11815:query { ... on Query { ... { BuiltinTag { count } } } }returned HTTP 500, also without credentials.infrahub_sdk/utils.pyis identical atdaf2fa02, the commit Infrahubstablepins.An inline fragment now contributes what
extract_fieldsreturns for its selection set... on TestPerson { id ...Names }gave{"id": None, "Names": None}.A field selected twice lost sub-fields
Reported by cubic on this pull request. The behavior is older than this pull request and does not need a fragment.
cars { edges { node { id } } } cars { edges { node { name { value } } } }reported onlynameundernode. Both are now reported.cars cars { id }reportedcarswithout sub-fields. It now reportsid.The merge used
dict.update; it now usesdeep_merge_dict. The depth and height of such a query can be higher than before. Fixed in its own commit, with 5 test cases intest_extract_fields_merges_a_field_selected_twice, 4 of which fail without it.Tests
Written first. For the nested inline fragment, all 6 fail without the fix.
test_extract_fields_nested_inline_fragment: 4 cases (at the operation root, below a field, three levels, merged with the same field of the enclosing fragment).test_extract_fields_ignores_fragment_spread_in_inline_fragment.test_depth_and_height_of_nested_inline_fragments: a query has the same fields, depth and height written plainly or inside nested inline fragments.On the same live stack with
python_sdkmoved to this branch (60bed4a4):Not run against Infrahub's CI yet.
🤖 Generated with Claude Code