Skip to content

fix(language): a where string names several columns in at's over= and into=, as an expression does - #782

Merged
FBumann merged 2 commits into
mainfrom
claude/elegant-wozniak-m1axih
Sep 29, 2026
Merged

FBumann merged 2 commits into
mainfrom
claude/elegant-wozniak-m1axih

Conversation

@FBumann

@FBumann FBumann commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Prompt: "Discuss hs request with me" … "Do all 3" … "post it and fix the issue with a PR"

Note

The following content was generated by AI.

A where: string now accepts at(p, by=r, over=a, into=[b, c]) and a list in over=, as an expression already did. Before, it failed to parse. The bracketed name list is now one grammar element that both parsers use.

Closes #781.

What this changes

  • _expression_parser.NAME_LIST is the bracketed name list, moved to module level. The expression grammar and the where grammar both read a kwarg value as a quoted keyword, a name list, or arithmetic.
  • The where resolver already read a list through relation_ref, so nothing changes there. The read is held to the same rules as at in an expression.
  • expressions.md says that over= and into= each name one column or a list, in a where: too.

Why

A piecewise block in #630 with a where: and a link that walks into: [flow, effect] writes this where: into its rows and assumptions. That load failed with SchemaError: Assertion failed, what a method assumes is stated in the language. fluxopt's investment cost curve (fluxopt/fluxopt#26) has that shape.

Test, gates, and what was not run

Test. TestAPredicateIsAnOperand::test_a_read_names_several_columns_as_an_expression_does, parametrized by into-names-several-columns and over-names-several-columns. Each case loads a constraint with the list, checks the mask's dims and what it reads, checks that to_yaml() loads again to the same program, and checks that markdown, LaTeX and Typst print the operand and the relation.

Without the fix (the src/ change stashed), both cases fail:

E   mathspec.errors.SchemaError: Constraint 'k': Failed to parse where string: 'at(has_curve, by=cost_of, over=curve, into=[flow, effect])'
E   mathspec.errors.SchemaError: Constraint 'k': Failed to parse where string: 'at(has_cost, by=pair_of, over=[flow, effect], into=curve)'
2 failed

Gates run in a uv venv (Python 3.12) with the pinned tool versions, since pixi cannot be installed here:

Gate Result
pytest -q -n auto 2597 passed, 2 skipped
ruff check, ruff format --check (0.16.1) clean
pyrefly check (1.2.0) 0 errors
prettier --check on expressions.md, typos clean
docs-build, compile-tex not run: the proxy refuses docs.python.org, and there is no tectonic

Not done: #630 is not changed here. Once this merges, #630 takes main and adds its block with where: and into: [flow, effect] as a regression test.

🤖 Generated with Claude Code

https://claude.ai/code/session_015VUkQfE5dT7mEGoTQXSxN3


Generated by Claude Code

… into=, as an expression does

The where grammar read one name or arithmetic after a kwarg's `=`, so
`at(p, by=r, over=a, into=[b, c])` failed to parse in a where string
while the expression grammar took the list. The bracketed name list is
now one grammar element both parsers use.

Closes #781.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015VUkQfE5dT7mEGoTQXSxN3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015VUkQfE5dT7mEGoTQXSxN3
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 mathspec | 🛠️ Build #34823281 | 📁 Comparing c9bd5dd against latest (fcb654d)

  🔍 Preview build  

2 files changed
± changelog/index.html
± reference/language/expressions/index.html

@FBumann
FBumann merged commit ae4a44c into main Sep 29, 2026
5 checks passed
FBumann pushed a commit that referenced this pull request Sep 29, 2026
Takes #782, which lets a where string name several columns in at's
over= and into=. CHANGELOG keeps both lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015VUkQfE5dT7mEGoTQXSxN3
FBumann pushed a commit that referenced this pull request Sep 29, 2026
fluxopt's investment cost curve reads each effect of a sized flow off
its curve, so its mask reaches the cost row as at(…, into=[flow, effect]).
Without #782 the load fails on the assertion that what a method assumes
is stated in the language.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015VUkQfE5dT7mEGoTQXSxN3
FBumann pushed a commit that referenced this pull request Sep 29, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AzXL2w5xdUm8FsYMNWf1KW
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.

A where string refuses at() with a list into=, which an expression accepts

2 participants