Skip to content

chore(typeset): a legend section is titled the way an equation section is - #629

Merged
FBumann merged 1 commit into
claude/blissful-heisenberg-z5rpwo-templatefrom
claude/blissful-heisenberg-z5rpwo-typeset
Sep 23, 2026
Merged

FBumann merged 1 commit into
claude/blissful-heisenberg-z5rpwo-templatefrom
claude/blissful-heisenberg-z5rpwo-typeset

Conversation

@FBumann

@FBumann FBumann commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Prompt: Review the packages code as a whole. Do you see room for simplififcation? Or reuction of concepts? … Lets tackle that. With stacked PRs.

Note

The following content was generated by AI.

Format.glossary() now returns only the rows, and section() sets the title, as it already does for the equations. This removes the Glossary class, three copies of each heading, and the cases_row protocol member. The output is byte-identical. Stacked on #628.

Method, gate output, alternatives

What this changes

  • glossary(entries): the rows only. typeset calls section(title, glossary(entries)).
  • Walk.glossaries returns (title, entries) pairs, the same shape as the equation sections. The Glossary class is deleted.
  • cases_row is out of the Format protocol. Only each format's own cases() read it, so the literal is now inline.
  • The typeset_declaration docstring says "none of the five", not "none of the four".

Gates

  • pixi run lint: green.
  • pixi run test: 1560 passed, golden output included, so the output is byte-identical in all three formats.
  • docs-build and compile-tex did not run: the session proxy blocks their downloads.

Tried and dropped

I moved the five-kind table from typeset_declaration into Walk.line, so that it would be written once. test_the_golden_model_reaches_every_line_of_the_walk then fails, because no model can reach a refusal. The refusal belongs outside the walk, so I reverted the move.

I did not merge the three identical escape bodies. That needs a new hook for the character escape, which gives one member for one member.

🤖 Generated with Claude Code

https://claude.ai/code/session_017XwKgY5wZXv1bKgkfCW2q1


Generated by Claude Code

@read-the-docs-community

read-the-docs-community Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

@FBumann
FBumann added this pull request to stack #637 September 22, 2026 20:48
@FBumann
FBumann force-pushed the claude/blissful-heisenberg-z5rpwo-typeset branch from d02f7de to a57176d Compare September 23, 2026 08:16
…n is

A format's glossary() returns the rows and section() sets the title, so the
Glossary class and three copies of each heading go. cases_row leaves the
Format protocol, since only a format's own cases() read it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017XwKgY5wZXv1bKgkfCW2q1
@FBumann
FBumann force-pushed the claude/blissful-heisenberg-z5rpwo-typeset branch from a57176d to 44035a3 Compare September 23, 2026 11:25
@FBumann
FBumann removed this pull request from stack #637 September 23, 2026 11:30
@FBumann
FBumann added this pull request to stack #644 September 23, 2026 11:32
@FBumann
FBumann merged commit 3e954f1 into main Sep 23, 2026
5 checks passed
FBumann added a commit to fluxopt/specsolve that referenced this pull request Sep 23, 2026
…at() (#1718)

> **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.

<details><summary>What moved</summary>

* **`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**
(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**
(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.

</details>

<details><summary>Mutation table</summary>

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 |

</details>

<details><summary>Gate</summary>

```
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.

</details>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01LzN7uYEvHW9dDGCmtAzbkD

---
_Generated by [Claude
Code](https://claude.ai/code/session_01LzN7uYEvHW9dDGCmtAzbkD)_

---------

Co-authored-by: Claude <noreply@anthropic.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