Skip to content

criteria: add where_substitutions to read the substitutions of a where criterion - #7

Merged
m-messer merged 1 commit into
feat/split-criteriafrom
feat/where-substitutions
Oct 16, 2026
Merged

m-messer merged 1 commit into
feat/split-criteriafrom
feat/where-substitutions

Conversation

@m-messer

@m-messer m-messer commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Stacked on #6: merge that first, and this PR's base will then switch to main.

Moves the node-reading half of compareExpressions' parse_where_substitutions into lambdafeedback.criteria.

Changes

  • where_substitutions(substitutions) in the new where.py takes the second child of a WHERE node (one EQUALITY, or a SEPARATOR of them) and returns [(name, expression), ...] with the expressions as text.
  • The caller parses the expressions, so criteria still doesn't depend on expression_parsing.
  • Behaviour change (CHANGELOG): the grammar also accepts other relations after where (where x > 2, where x proportional to y).
    • compareExpressions' where_substitution_nodes returned the node itself for these instead of a list; this raises CriteriaSyntaxError.
    • A SEPARATOR that mixes in such a relation (where a = 2; x > 3) used to be read as substitutions, and also raises now.

Downstream
compareExpressions keeps parsing the expression text itself, and should catch CriteriaSyntaxError where it previously handled a non-list result.

Verification

  • ruff, format and mypy are clean, and all four test suites pass.
  • New tests cover one, two and three substitutions, and each unsupported relation.

🤖 Generated with Claude Code

…ria, raise `CriteriaSyntaxError` for unsupported relations, and update tests, module init, and changelog.
@m-messer
m-messer merged commit 05f21a1 into feat/split-criteria Oct 16, 2026
8 checks passed
@m-messer
m-messer deleted the feat/where-substitutions branch October 16, 2026 10:18
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.

1 participant