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

Fixing bug when inferring doubly-nested dynamic list field types #3900

Merged
merged 1 commit into from Dec 8, 2023

Conversation

brimoor
Copy link
Contributor

@brimoor brimoor commented Dec 7, 2023

Fixes a very subtle issue when inferring dynamic schemas for doubly-nested list fields. The new unit test fails on develop but passes on this branch.

Copy link

codecov bot commented Dec 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f10accd) 15.86% compared to head (5da9442) 15.86%.
Report is 3 commits behind head on release/v0.23.1.

Additional details and impacted files
@@               Coverage Diff                @@
##           release/v0.23.1    #3900   +/-   ##
================================================
  Coverage            15.86%   15.86%           
================================================
  Files                  731      731           
  Lines                81544    81544           
  Branches              1093     1093           
================================================
  Hits                 12936    12936           
  Misses               68608    68608           
Flag Coverage Δ
app 15.86% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@brimoor brimoor requested a review from a team December 8, 2023 15:39
Comment on lines 1331 to +1339
if is_list_field and not _path.endswith("[]"):
_path += "[]"

# Cache the manual unwind in case we need it recursively
# Insert rather than append so that nested paths are found
# first when using this cache
_clean_path = _path.replace("[]", "")
unwind_cache.insert(0, (_clean_path, _path))

Copy link
Contributor

Choose a reason for hiding this comment

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

I do not entirely understand what's going on here so just making sure it's intentional that this logic only applies when _path.endswith("[]") is False

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this is correct as written. The only way that [] gets into the path is inside this if, which is the time when we need to cache an undeclared list field that we've found.

@brimoor brimoor merged commit 85f7477 into release/v0.23.1 Dec 8, 2023
8 of 9 checks passed
@brimoor brimoor deleted the bug/dynamic-schema branch December 8, 2023 20:29
@brimoor brimoor restored the bug/dynamic-schema branch December 15, 2023 02:36
@brimoor brimoor deleted the bug/dynamic-schema branch December 15, 2023 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants