Skip to content

fix: include final windows in endpoint reducers - #2474

Closed
pcbeingused333 wants to merge 2 commits into
observablehq:mainfrom
pcbeingused333:fix/window-tail-c2195
Closed

pcbeingused333 wants to merge 2 commits into
observablehq:mainfrom
pcbeingused333:fix/window-tail-c2195

Conversation

@pcbeingused333

Copy link
Copy Markdown

Fixes #2472

The difference, ratio, first, and last reducers stop before the final full window in strict mode and omit trailing truncated windows in non-strict mode. Include the final full window and iterate over all output positions when truncation is allowed. Existing endpoint helpers skip undefined values beyond the available indices.

Add regression coverage for all four reducers, all three anchors, both strict settings, and window sizes from one through larger than the input. Update strict expectations to include the previously missing full window. Regenerate the metroUnemploymentSlope snapshot: each division now includes its final line segment; the snapshot diff is confined to those endpoints.

Testing and validation

The real Vitest suite passes 1370 tests, with 2 skipped and one existing environment-dependent failure in projectionDomainRatioNC. All 55 window transform tests and the updated metroUnemploymentSlope snapshot pass. Prettier passes for both changed JavaScript files.

With the window implementation restored from main (2245188), 24 tests in the window test file and the metroUnemploymentSlope snapshot fail. projectionDomainRatioNC fails with or without this change, so its snapshot is left unchanged.

This change was generated with assistance from OpenAI Codex.

@Fil Fil closed this Nov 11, 2026
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.

window transform: difference, ratio, first and last drop the trailing outputs of each series

2 participants