Skip to content

build(deps): a rule the language now enforces has one home again - #1258

Merged
FBumann merged 1 commit into
mainfrom
build/pin-alpha-11
Aug 25, 2026
Merged

FBumann merged 1 commit into
mainfrom
build/pin-alpha-11

Conversation

@FBumann

@FBumann FBumann commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Prompt: "DO a PR bumping the pin. Reject things we dont yet implement! And remove duplication."

Note

The following content was generated by AI.

math-spec moves from v0.0.0-alpha.10 to v0.0.0-alpha.11. The release does
two things to this repository: it takes over four rules that had a second
implementation here, and it declares a keyword neither lane builds.

The four rules have one home again

alpha.11 enforces, for both shift(offset=…) and sum_back(within=…), what
the reference always said a named amount obeys — integral, constant along the
axis its operator walks, read at a coordinate the expression carries, and never
negated at the call site. Every one of them was also implemented here, in
_named_width and _named_offset, and the language now speaks first: lowering
calls dims_of before it reads the amount, so those arms became unreachable
the moment the pin moved. They are deleted, with _within_reach and the two
messages that served only them.

What stays is the one rule the language does not hold: a named offset must
say what the vacated positions contribute
(#850). That is about a presence
frame keyed by the translated dimension alone, which is this repository's, not
the language's.

Coverage moved rather than went:

deleted here now proved in math-spec
test_a_named_offset_that_cannot_mean_a_lag_is_refused[not-an-integer] a-named-offset-is-integral
…[along-the-shifted-dim] a-named-offset-does-not-span-the-axis-it-walks
…[not-a-parameter] resolution's own unknown-name tests
test_a_named_width_that_cannot_mean_a_window_is_refused[not-an-integer] a-named-width-is-integral
…[along-the-summed-dim] a-named-width-does-not-span-the-summed-axis
test_a_named_offset_carries_its_sign_in_the_data a-named-offset-is-not-negated-at-the-call
test_an_offset_over_a_dim_nothing_puts_in_reach_is_refused[nothing-puts-it-in-reach] a-named-offset-is-read-where-the-expression-has-a-coordinate
…[not-what-the-partition-groups-into] nothing — see below

sum_back(by=…) is refused

alpha.11 gives the window a partition, so it stops at each group's edge
(energy-models/mathspec#65). Neither lane builds it, and ignoring the keyword
is a wrong answer rather than a missing one — measured on this tree at the old
pin, four hours split a a b b, within=3:

What the unread keyword built
c2:
+1.0 x0
+1.0 x1
+1.0 x2      <- hours 1,2,3: the window reaches across the seam into day a
<= 1.0
c3:
+1.0 x1
+1.0 x2
+1.0 x3
<= 1.0

The eager lane answered the same file with
TypeError: _operator_sum_back() got an unexpected keyword argument 'by'.

Now both refuse, in one sentence from one place — lpspec.linopy.build runs
the lowering pass before it evaluates anything, so the eager operators never
see the call. That is also why the refusal is not duplicated into
linopy/operators.py: a guard there is unreachable through either entry point,
which I checked by deleting the lowering guard and reading the traceback
(linopy/__init__.py:110).

Verified

  • suite: 3103 passed, 249 skipped, 1 xfailed. The 35 failures are
    xpress-parametrised and pre-existing on this machine (InterfaceError, the
    licence) — red at the old pin too, checked case by case.

  • ruff check · ruff format --check . · pyrefly 0 errors (through the
    worktree's own interpreter — the project-mode run resolves the primary
    checkout's .venv and reports 18 phantom missing-imports).

  • mutation table:

    mutation result
    the partitioned-window refusal (lowering.py:364-365) caught
    the vacated-positions rule (lowering.py:410-411) caught

Deliberately not done

  • The stray-dim case with a partition (offset over a dim that is not what
    by= groups into) has no twin in math-spec's own tests, though math-spec now
    owns the rule. Deleted here rather than kept as a second home; worth filing
    upstream.
  • test_both_lanes_read_every_keyword_the_language_declares keeps its
    blanket interception
    of by= on the eager side, which is why it stays green
    here. It is a real hole — it would credit sum_back a keyword only at and
    sum are dispatched by name — but narrowing it demands the eager lane read
    by= itself, which is only true once the window is built. The narrowing
    belongs to the follow-up that implements the partition, and lands with it.
  • Implementing the partitioned window, which is the stacked PR on top of
    this one.

math-spec v0.0.0-alpha.11 enforces the two rules a named `offset=` or
`within=` was always documented to obey — integral, and constant along the axis
its operator walks — plus the stray-dim rule and the refusal of a negation at
the call site. All four had a second implementation here, reached later and
worded differently; the language speaks first through `dims_of`, so those arms
were unreachable the moment the pin moved. `_named_width`, three quarters of
`_named_offset` and `_within_reach` go with them. What stays is the one rule
the language does not hold: a named offset must say what the vacated positions
contribute, which is about a presence frame this repository owns.

The same release gives `sum_back` a `by=`, and neither lane builds a window
that stops at each group's edge. It is refused rather than ignored: unread, the
window spans the seam between two groups and sums rows that are not
neighbours — a model that builds, solves and reports optimal. One refusal
serves both lanes, `lpspec.linopy.build` lowering before it evaluates.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codspeed

codspeed Bot commented Aug 25, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 16 untouched benchmarks
⏩ 42 skipped benchmarks1


Comparing build/pin-alpha-11 (881baa3) with main (64b994f)

Open in CodSpeed

Footnotes

  1. 42 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 0a37a72 into main Aug 25, 2026
7 checks passed
@FBumann
FBumann deleted the build/pin-alpha-11 branch August 25, 2026 06:32
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