fix: let sum_back stop at each group's edge, as its checks already assumed - #65
Merged
Merged
Conversation
…sumed `BUILTINS` never declared `by=` on `sum_back`, so the call was refused at load — while the operator comment beside it already said `by=` partitions the axis for "``shift`` and ``sum_back``", and `_dims_call` already ran the partition checks for both. Two of the three places agreed; the one that gates parsing did not, so the rule they described was unreachable. Declaring the kwarg is the whole fix. The typesetter needed the group as the superscript its operator carries, which `_Step.within` and `translation(step, group=...)` were already shaped for — a partition rides a window exactly as it does a leaf translation, and for the same reason: what the group changes is where the axis ends, not which coordinate is being written. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018SeNnVvhYnokz8C37o7ejW
This was referenced Aug 25, 2026
This was referenced Aug 25, 2026
Closed
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.
What this changes
sum_backacceptsby=<lookup>, so a window stops at each group's edge instead of walking across it.operators.py— declares the kwarg on thesum_backbuiltin (lookup_kwargs,optional_kwargs) and shows it in the usage string.typesetting/walk.py— a new_group()renders the partition as the superscript its operator carries, and the window'slagpasses it through.examples/operators/sum_back_partitioned.yaml, one golden constraint, onetools/spec_math.pyrow; docs and goldens regenerated from those.Extracted from #59, which does the same for both windows. The
sum_forwardhalf stays there, since that operator only exists in #56.Why
Two of the three places that describe this rule already agreed it held. The comment beside
BUILTINSsaysby=partitions the axis for "shiftandsum_back", and_dims_callalready runs every partition check for both names — one lookup only, and it must be over the walked dim. OnlyBUILTINSnever declared the kwarg, and that is the one that gates parsing, so the rule they described was unreachable:Declaring the kwarg is the whole fix. The typesetting side needed the group as a superscript on the operator, which
_Step.withinandtranslation(step, group=...)were already shaped for — a partition rides a window exactly as it rides a leaf translation, and for the same reason: what the group changes is where the axis ends, not which coordinate is being written.This is byte-identical to what #59 renders for the same constraint.
Generated by Claude Code