Skip to content

Fix MR subvariable in filters - #505

Merged
slobodan-ilic merged 1 commit into
masterfrom
fix-mr-subvariable-in-filter
Jul 16, 2026
Merged

slobodan-ilic merged 1 commit into
masterfrom
fix-mr-subvariable-in-filter

Conversation

@slobodan-ilic

Copy link
Copy Markdown
Contributor

Summary

  • avoid whole-MR expansion when an expression is already scoped to a subvariable via axes
  • add regression coverage for both subvar1 in [1] and MyMrVar[subvar1] in [1]

Diagnosis

The 0.18.24 MR rewrite treats list-valued filters on MR variables as whole-variable filters that need expansion across all subvariables. If the variable term has already been rewritten to {var: parent, axes: [subvar]}, there is no array list to update, so _update_values_for_multiple_response() crashes on arrays[0] with IndexError: list assignment index out of range.

Tests

  • venv/bin/python -m pytest scrunch/tests/test_expressions.py::TestExpressionProcessing::test_multiple_response_subvar_in scrunch/tests/test_expressions.py::TestExpressionProcessing::test_multiple_response_subvar_equality scrunch/tests/test_expressions.py::TestExpressionProcessing::test_process_in_multiple_response_without_entity_key scrunch/tests/test_expressions.py::TestExpressionProcessing::test_process_in_multiple_response scrunch/tests/test_expressions.py::TestExpressionProcessing::test_process_all_multiple_response scrunch/tests/test_expressions.py::TestExpressionProcessing::test_multiple_response_any_process_single_subvariables scrunch/tests/test_expressions.py::TestExpressionProcessing::test_multiple_response_any_process_two_subvariables -q
  • venv/bin/python -m pytest scrunch/tests -q

@slobodan-ilic
slobodan-ilic force-pushed the fix-mr-subvariable-in-filter branch 3 times, most recently from 0722b99 to 7d1e879 Compare July 16, 2026 13:47
@slobodan-ilic
slobodan-ilic force-pushed the fix-mr-subvariable-in-filter branch from 7d1e879 to 3745be8 Compare July 16, 2026 13:51
@slobodan-ilic
slobodan-ilic merged commit a1454fd into master Jul 16, 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