Skip to content

feat(api): a window can hold windows of its own, such as a myopic pathway with foresight whose decades each roll through their hours - #1890

Merged
FBumann merged 15 commits into
claude/wizardly-lamport-e3g6om-chainsfrom
claude/wizardly-lamport-e3g6om-windows
Oct 12, 2026
Merged

FBumann merged 15 commits into
claude/wizardly-lamport-e3g6om-chainsfrom
claude/wizardly-lamport-e3g6om-windows

Conversation

@FBumann

@FBumann FBumann commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Prompt: Dont include nested windows yet. But do it in a stacked draft PR

Note

The following content was generated by AI.

EachWindow may stand anywhere in a tuple of axes. One stitch spans every window axis, so the answer is over every windowed dimension and keeps only what each window owns at every level. The API is unchanged from #1888.

sweep = sps.solve_over('pathway.yaml', sources, (
    sps.EachWindow('period', steps=1, lookahead=1, into='y', carry={'existing': 'capacity'}),
    sps.EachWindow('snapshot', steps=24, lookahead=24, into='t', carry={'soc_initial': 'soc'}),
))
sweep.primal('soc')  # (period, snapshot, value)
What changed
  • The windows-last refusal is gone. Two windows over one local index are refused instead, since one local index cannot stand for two dimensions.
  • Stitch spans several window axes: locals, dims, the window keys it drops and the outer keys it keeps. owned holds one row per coordinate every window owns: an inner window's owned rows are joined to the outer window's owned rows, so an hour the decade window solved only as lookahead is not in it. restore joins on every owned column but the dimensions.
  • Slice.owns holds one count per axis, and a window's carry reads its own axis's seam: the decade window hands on the capacity at the last decade it owns.
  • The spill manifest names the stitch's locals, dims, keys and outer keys (inside ANSWER_LAYOUT 5 from feat(api): a sweep can be cut by several axes at once, each carrying its own state, such as a rolling horizon per scenario or a pathway whose decades roll through their hours #1888, which is unreleased).
  • The archive's uncut sources drop every window's local index, and a number over a window's local index is spread over that window's dimension for each window axis.
  • Docs: the "Several axes" rules say any axis may be windows, the stitch rule covers every level, and the windows-last message gives way to the pathway example.
Tests
  • Windows inside windows: decades with a one-decade lookahead, hours rolling inside each. The answer is over (period, snapshot) with each pair once (the lookahead decade dropped), and per window it keeps both keys and both locals.
  • A decade window hands its fleet on: the oracle is the loop by hand. Each decade window is solved as its own hourly horizon over its decade and the next, with existing set to the capacity the window before ended its own decade with; every window's objectives match.
  • While building it, each decade's owned cost (the spend expression summed over its hours) matched the decade solved alone, when no carry couples them: 2804.0, 6947.5, 11380.0. Primals did not match exactly, because the window also solves the lookahead decade and this LP has several optimal vertices for the store.
  • The refusal case window-outside became one-local-index-for-two-windows; Slice.owns assertions read one count per axis.
Mutation table

python -m tools.mutate for the deletion, scoped to tests/test_nested_sweep.py and tests/test_strategy.py; the hand mutations by sed, restored with git checkout --, __pycache__ dropped on both sides. Taken on 507123e, before main was merged in, so the line numbers are that commit's; tree clean after every run.

guard result
two windows over one local index (axes.py:354-358) caught
by hand: an inner coordinate is owned only under the outer window that owns its decade (join dropped) caught (2 failed)
by hand: a window carry reads its own axis's seam (owns[-1]) caught (1 failed)
Verification
Deliberately not done
  • Reading one outer window as a whole. per_window=True returns the innermost windows, keyed by every window key; there is no read per decade window.
  • A number over two local indexes at once in an archive's uncut sources is spread over each window's dimension in turn, not over both; no test covers it.

🤖 Generated with Claude Code

https://claude.ai/code/session_014wLrXpeSGDqoBFxyrs8NEz

claude added 2 commits October 8, 2026 10:09
…hway with foresight whose decades each roll through their hours

EachWindow may stand anywhere in a tuple of axes. One stitch spans every
window axis: owned holds each coordinate every window owns, under the
key columns of the axes outside it, so the answer keeps only what each
window owns at every level. Slice.owns holds one count per axis, and a
window's carry reads its own axis's seam. Two windows over one local
index are refused.

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

read-the-docs-community Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

@codspeed

codspeed Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 93 untouched benchmarks
⏩ 307 skipped benchmarks1


Comparing claude/wizardly-lamport-e3g6om-windows (06d149d) with claude/wizardly-lamport-e3g6om-chains (7edf615)

Open in CodSpeed

Footnotes

  1. 307 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 added this pull request to stack #1886 October 8, 2026 10:52
claude added 7 commits October 8, 2026 11:10
…ort-e3g6om-windows

Brings main through the stack: polars 2.0, the 0.7.0 release and
load_inputs. The stitch collects through collected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wLrXpeSGDqoBFxyrs8NEz
…ort-e3g6om-windows

The stack below now holds main too; the tree is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wLrXpeSGDqoBFxyrs8NEz
…ort-e3g6om-windows

Brings the shorter start= prose and the refusal of a start from a last
answer that left no values, from the branches below.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wLrXpeSGDqoBFxyrs8NEz
…ort-e3g6om-windows

Brings main, which now holds the stack below, and the start= redesign:
'previous' is the default and carries the solver on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wLrXpeSGDqoBFxyrs8NEz
…ort-e3g6om-windows

Brings main through #1888.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wLrXpeSGDqoBFxyrs8NEz
…ort-e3g6om-windows

Brings main through #1888: the column names now live in
relational/names.py (#1889), and the stitch over every window and the
uncut archive read VALUE from there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wLrXpeSGDqoBFxyrs8NEz
@FBumann
FBumann removed this pull request from stack #1886 October 9, 2026 08:46
@FBumann
FBumann added this pull request to stack #1917 October 9, 2026 08:46
claude added 6 commits October 9, 2026 09:41
…ort-e3g6om-windows

Brings main through #1888: answers carry their spec (#1913), and the
layouts are ANSWER_LAYOUT 6 and INPUTS_LAYOUT 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wLrXpeSGDqoBFxyrs8NEz
…ort-e3g6om-windows

Brings main's 0.8.0 release through #1888: the layouts are
ANSWER_LAYOUT 5 and INPUTS_LAYOUT 2, and this PR's changelog line
stays under Upcoming version beside #1888's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wLrXpeSGDqoBFxyrs8NEz
…ort-e3g6om-windows

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wLrXpeSGDqoBFxyrs8NEz
…ort-e3g6om-windows

Brings main's single-write archive through #1888: sweep_manifest now
names the stitch's locals, dims, keys and outer keys, as the manifest
this branch wrote by hand did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wLrXpeSGDqoBFxyrs8NEz
…rdly-lamport-e3g6om-windows

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wLrXpeSGDqoBFxyrs8NEz
@FBumann
FBumann merged commit e1a9ebb into main Oct 12, 2026
15 checks passed

FBumann commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator Author

Note

The following content was generated by AI.

Folded into #1888: its branch now holds this PR's commits at e1a9ebb, with main through 9c13352 merged in. The description, tests and mutation rows moved there.


Generated by Claude Code

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