Repository navigation
fix: refuse a negated named amount, and one read where there is no coordinate - #63
Merged
Merged
Conversation
This was referenced Aug 24, 2026
…ordinate Two of the three rules #62 collected, and the first is why it was filed. `shift(offset=-lead)` loaded clean and then raised a bare `AssertionError` out of the typesetter, because `_amount` matches a unary minus and asserts the operand is a number. That assert was reading a rule the language stated and never enforced --- and it is the rule the whole treatment of a named offset rests on: `walk.py` renders one as always-backward *because* a negated one is refused. It is refused now, at load, in a sentence, so the assert is a precondition rather than a hope. Its docstring said `by=` throughout, which was the kwarg's name two renames ago and is now a different kwarg on the same operator. The second rule is the dim half of the same idea: an amount is read at the coordinate its operator walks, so a parameter varying over a dim that coordinate does not carry has nowhere to be read from. It rendered as a bare symbol, which on the page says "one number" about a column --- the same way an unchecked width did before #58, and wrong in the same direction. `by=` is what makes such a parameter readable again, one amount per group, so the rule admits the dims a partition maps into. That half was `shift`'s alone until #59 gave the windows a partition too; both get it here, and a width per representative day now says what it means. Refs #62 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
FBumann
force-pushed
the
fix/named-amount-sign-and-reach
branch
from
August 25, 2026 05:41
b731ebf to
6672353
Compare
FBumann
marked this pull request as ready for review
August 25, 2026 05:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two of the three rules in #62. The third is split out — see below. Base is
fix/window-width-rules(#61), stacked on #59 → #56.1. A negated named amount crashed instead of being refused
_amountmatches a unary minus and asserts the operand is aNumberNode, so a negated parameter trips the assert. It was reading a rule the language stated and never enforced.That rule is load-bearing.
walk.pyrenders a named offset as always-backward because a negated one is refused; #56's argument thatsum_forwardcan't be a composition is thatoffset=-(p-1)is refused. Both were true by convention only.Now refused at load, in a sentence, so the assert documents a guaranteed precondition. Windows get the same rule with their own wording — a width counts positions and has no direction to negate;
sum_back/sum_forwardis how the language says which way.Also fixed:
_amount's docstring saidby=throughout. That was the kwarg's name two renames ago, andby=is now a different kwarg on the same operator — actively misleading since #59.2. An amount read where there is no coordinate
lead_dayis a column with a value per day, andxcarries nodaydim, so there is no coordinate at which to read it. It rendered as a bare symbol — which on the page says "one number" about a column. Same failure as the unchecked width in #61, arriving through dims instead of dtype.by=is the rescue, and now for windows tooThe rule admits dims a partition maps into, so a
by=makes such a parameter readable again — one amount per group:The second line is new capability rather than just a check: #59 gave the windows a partition, and this rule is what makes a per-group width mean something. A representative day with its own window length now says so.
Split out of #62
The third rule — a named offset requires an
edge=— is deliberately not here, and is now #64. Its justification is a downstream frame limitation and the docs hedge it ("cannot yet say"). Enforcing it would bake a consuming lane's current constraint into a package that is deliberately lane-independent. That's a design decision, not a bug fix.Review notes
test_dimensions.py: three rejections, two positive (by=rescuing both operators). Fixture gainsbus_leadand asnap_buslookup oversnapshot, each with a comment saying why.🤖 Generated with Claude Code