Skip to content

Fix multiple response filters without entity metadata - #504

Merged
slobodan-ilic merged 1 commit into
masterfrom
issue-503-mr-filter-entity
Jul 15, 2026
Merged

slobodan-ilic merged 1 commit into
masterfrom
issue-503-mr-filter-entity

Conversation

@slobodan-ilic

@slobodan-ilic slobodan-ilic commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • support multiple-response variable metadata that is exposed without an entity key
  • use table-derived metadata for multiple-response expansion so sparse variables.index metadata still works
  • keep scalar subvariable equality untouched while expanding list-style MR filters
  • add a regression test for the add_filter-style metadata shape from [BUG] KeyError 'entity' when using add_filter function in scrunch v0.18.23 #503

@slobodan-ilic
slobodan-ilic force-pushed the issue-503-mr-filter-entity branch 6 times, most recently from ef8c117 to 2983e18 Compare July 13, 2026 13:17
Comment thread scrunch/expressions.py Outdated
def _get_categories_from_var_index(vars_by_alias, var_alias):
return vars_by_alias[var_alias].entity.body.categories
"""Return subvariable alias -> id from table metadata subreferences."""
subreferences = var_index[var_url].get("subreferences", {})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
subreferences = var_index[var_url].get("subreferences", {})
subreferences = var_index[var_url].get("subreferences", {}) or {}

I've found this pattern bits me when the key exists and the value is None. In this case it's going to be super duper weird for this to happen though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed, thanks!

@slobodan-ilic
slobodan-ilic force-pushed the issue-503-mr-filter-entity branch from 2983e18 to ef0441d Compare July 15, 2026 08:36
@slobodan-ilic
slobodan-ilic merged commit 0d5cbfc into master Jul 15, 2026
5 checks passed
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.

2 participants