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

Faceted Search: fix infinite recursion on duplicate facets #3799

Merged
merged 4 commits into from Nov 29, 2023

Conversation

nl0
Copy link
Member

@nl0 nl0 commented Nov 28, 2023

  • Unit tests
  • Changelog entry (skip if change is not significant to end users, e.g. docs only)

@nl0 nl0 requested a review from fiskus November 28, 2023 14:05
Copy link

codecov bot commented Nov 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3773477) 34.71% compared to head (098bb5d) 89.15%.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #3799       +/-   ##
===========================================
+ Coverage   34.71%   89.15%   +54.43%     
===========================================
  Files         709       79      -630     
  Lines       31063     9899    -21164     
  Branches     4638        0     -4638     
===========================================
- Hits        10783     8825     -1958     
+ Misses      19131     1074    -18057     
+ Partials     1149        0     -1149     
Flag Coverage Δ
api-python 91.22% <ø> (ø)
catalog ?
lambda 86.26% <ø> (ø)

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.

fiskus
fiskus previously approved these changes Nov 28, 2023
Copy link
Member

@fiskus fiskus left a comment

Choose a reason for hiding this comment

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

What is a source of this conflict? Can we make it so it doesn't happen?


Few suggestions to make code more readable for me, if you care:

  • don't use abbreviations when not necessary: KTreeKeyedTree, it requires additional energy to keep in mind what K means
  • const children = new Map(a.children)const aChildren = new Map(a.children), to not confuse with b.children
  • resolveFacetConflictmergeDuplicateFacets. Resolve - is a function under-the-hood, but merge duplicates is what function's intention

* master:
  Quilt3 v5.4.0 (#3798)
  Bump cryptography from 41.0.4 to 41.0.6 in /lambdas/es/indexer (#3804)
@nl0
Copy link
Member Author

nl0 commented Nov 29, 2023

@fiskus

What is a source of this conflict? Can we make it so it doesn't happen?

not sure tbh. like, it shouldn't be happening, but for some reason it does -- i wasn't able to determine the root cause on the back-end yet. anyways, it's better to not crash on it, just record the fact and continue normal operation.

const children = new Map(a.children) → const aChildren = new Map(a.children), to not confuse with b.children

it's not a's children, it's resulting children, which is initialized with the value of a, and then merged with b, so it will be incorrect to label it aChildren

resolveFacetConflict → mergeDuplicateFacets. Resolve - is a function under-the-hood, but merge duplicates is what function's intention

that's not quite true, because 1) this function is called "resolve" in Tree's api -- it's used to resolve conflicts (entries with conflicting keys) while merging the trees, and 2) it's purpose is not to merge duplicate facets (this is only an edge case that shouldn't be happening at all), it is to rebuild the [part of the] tree representing the hierarchy of facets to expose differently-typed facets with the same path.

@nl0 nl0 added this pull request to the merge queue Nov 29, 2023
Merged via the queue into master with commit 4727871 Nov 29, 2023
42 checks passed
@nl0 nl0 deleted the fs-fix-recursion branch November 29, 2023 11:29
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.

None yet

3 participants