Skip to content

feat(language): a where may read a predicate through a relation with at() - #1718

Merged
FBumann merged 2 commits into
mainfrom
claude/kind-allen-76xzst
Sep 23, 2026
Merged

FBumann merged 2 commits into
mainfrom
claude/kind-allen-76xzst

Conversation

@FBumann

@FBumann FBumann commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Prompt: Update lpspec to the latest mathspec release (119)

Note

The following content was generated by AI.

The pin moves from math-spec alpha.116 to alpha.119. Both lanes now build the new at(<predicate>, by=, over=, into=) in a where: (energy-models/mathspec#634), and they agree on the result. A coordinate with no relation row reads false. 70 insertions, 34 deletions.

What moved
  • PulledBackPredicate: the relational lane walks the coordinates the operand admits through walk_join, as an expression's at does. The linopy lane reads the evaluated mask through operator_at. Before this change, both lanes hit assert_never.
  • PiecewiseExpansionError is gone upstream (refactor(language): an expression resolves straight into the program's own nodes energy-models/mathspec#638). A piecewise block now raises DimensionError, so lps.PiecewiseExpansionError goes too, with no alias. test_api, test_architecture and test_piecewise follow, and so does docs/reference/api.md.
  • ArithmeticComparison is gone upstream (refactor(program): a comparison of expressions is one node before and after lowering energy-models/mathspec#631). The two lanes' branches for it were never reached, so they go. NEVER_LOWERED in test_resolution_parity goes with them.
  • Tests: test_a_where_reads_a_relation gains 2 cases and test_a_relation_where_agrees_with_the_oracle gains 3: a total relation, a partial one, a negation and a conjunction. COVERED_ELSEWHERE names the oracle test for PulledBackPredicate. Before the implementation, the coverage guard failed on it.
  • Upstream now refuses sum() over a scalar, so the carried-parameter probe in test_strategy reads soc_initial bare. It still asserts the refusal names "carried".
  • uv.lock is relocked. Only the math-spec entry changed.
Mutation table

Run by hand on the committed tree. Each file was restored through git checkout -- and __pycache__ was dropped. The runs cover test_label_coords.py and test_resolution_parity.py.

Mutation Result
linopy: a missing relation row reads true (fillna(True)) caught, 1 failed
polars: a missing row reads true (fill_null(True)) caught, 5 failed
polars: the operand's mask is ignored (masked(..., None)) caught, 5 failed
Gate
ruff check .            clean
ruff format --check .   327 files already formatted
pyrefly check           0 errors (20 suppressed)
pytest -q -n auto       3796 passed, 403 skipped, 1 xfailed, 11 failed

The run used uv with the [linopy] extra, not pixi. The xfail is the known osemosys_utopia / #894 case. Of the 11 failures, one was the test_strategy probe, which is fixed in the second commit. The other 10 are the gurobi and xpress parametrizations of test_diagnostics and TestThePositionalHandoff. They raise ModuleNotFoundError because neither package is installed here, and they fail the same way on origin/main.

Not run: docs-build, docs-test, test-floors, test-bench, the gurobi and xpress sinks. I did not regenerate the gallery pages. The typesetter changed upstream (energy-models/mathspec#629), but the doc tests passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LzN7uYEvHW9dDGCmtAzbkD


Generated by Claude Code

…at()

math-spec 0.0.0-alpha.119 carries `at(<predicate>, by=, over=, into=)` in a
where as `PulledBackPredicate`. Both lanes read it as they read an
expression's `at`: the relational lane walks the admitted coarse
coordinates through the relation, the linopy lane reads the evaluated mask
through `operator_at`. A fine coordinate the relation has no row for is
false.

The pin moves from alpha.116, with `uv.lock` relocked. Upstream dropped
`PiecewiseExpansionError` (a piecewise block now raises `DimensionError`),
so `lps.PiecewiseExpansionError` goes too, and `ArithmeticComparison`,
which no lowered program carried, so the two lanes' dead branches go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LzN7uYEvHW9dDGCmtAzbkD
…ed-parameter probe reads it bare

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

Copy link
Copy Markdown

Documentation build overview

📚 lpspec | 🛠️ Build #34716847 | 📁 Comparing ec3a5bb against latest (813aeb3)

  🔍 Preview build  

1 file changed
± reference/api/index.html

@codspeed

codspeed Bot commented Sep 23, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 24 untouched benchmarks
⏩ 58 skipped benchmarks1


Comparing claude/kind-allen-76xzst (ec3a5bb) with main (813aeb3)

Open in CodSpeed

Footnotes

  1. 58 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@FBumann
FBumann merged commit cfaa01b into main Sep 23, 2026
12 checks passed
@FBumann
FBumann deleted the claude/kind-allen-76xzst branch September 23, 2026 11:50
fluxopt-release-bot Bot added a commit that referenced this pull request Sep 23, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.0.1-alpha.350](v0.0.1-alpha.349...v0.0.1-alpha.350)
(2026-09-23)


### Features

* **language:** a where may read a predicate through a relation with
at() ([#1718](#1718))
([cfaa01b](cfaa01b))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: fluxopt-release-bot[bot] <307443024+fluxopt-release-bot[bot]@users.noreply.github.com>
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