Repository navigation
refactor(web): derive week paging from the owning page set - #5439
Merged
Merged
Conversation
`pagedWindowStart` restated which offsets `computeVisibleWindowOffset` can produce, as `offset % visibleDayCount !== 0 && offset !== lastPage`. That admits multiples of the column count past `lastPage`, which are not pages, and the forward branch then clamps them with `Math.min(offset + visibleDayCount, lastPage)` and lands earlier in the week than it started. On five of the seven column widths, "next week" moved the view backwards. Derive the page set from `computeVisibleWindowOffset` instead and step between neighbours, so there is no second copy of the page arithmetic to drift. Behavior is unchanged on every page offset. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HmwVQGtuqunekRQpZAP4dB
tyler-dane
enabled auto-merge
December 5, 2026 11:20
Contributor
|
Boot bundle: 608.7 KB gzip (+0.0 KB vs main) |
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 and why
Scheduled tech-debt sweep,
.agents/skills/tech-debt-sweep/SKILL.md. Onefinding, in the admissible "drifted copy of a shared definition" class.
computeVisibleWindowOffsetowns which offsets within the calendar week theweek view can land on:
min(floor(anchorIndex / count) * count, 7 - count)over the seven anchor days, which is
{0, 3, 4}at three columns,{0, 2}atfive and
{0, 1}at six. #5437's newpagedWindowStartrestated that set as acondition rather than reading it, as
offset % visibleDayCount !== 0 && offset !== lastPagemeaning "not a page".That admits every multiple of the column count, including the ones past
lastPage, which are not pages; the forward branch then clamps those withMath.min(offset + visibleDayCount, lastPage)and returns an offset lower thanthe one it started from, so paging forward moves the view backwards in time.
Reachable through
shiftViewByDay, which sets the anchor tostart.add(days, "day")with no bound and is reached both from the Shift+J /Shift+K day-shift shortcuts in
useWeekShortcutOwnerand fromonCrossed, theShift+Arrow nudge that carries an event across the window edge. Six day-shifts
forward from Sunday on a six-column viewport puts the anchor at offset 6;
pressing J then moved the window from Sat..Thu back to Mon..Sat, five days
backwards within the same week. Enumerated over all seven widths and all seven
offsets, five pairs regress: count 2 at offset 6 (-1d), count 3 at offset 6
(-2d), count 4 at offset 4 (-1d), count 5 at offset 5 (-3d) and count 6 at
offset 6 (-5d). Before #5437
pageWindowwasstart.add(direction * visibleDayCount, "day")and none of them could happen,so this is new. #5437's four
pagedWindowStarttests pin page offsets and onehand-shifted offset that takes the correct branch; none of the five covered.
Closed by derivation rather than by correcting the condition, since the owning
function is importable here. A private
weekPageOffsetsenumeratescomputeVisibleWindowOffsetover the seven anchor days and dedupes, andpagedWindowStartlooks its offset up in that list and steps to theneighbouring page, crossing weeks at the ends. No second copy of the page
arithmetic is left to drift: change the owning formula and paging follows it.
Behavior is identical on every page offset, checked against the previous
implementation for all seven widths. The only change is that the five non-page
offsets now take the hand-shifted branch and move forward by the column count,
which is what the function's own doc comment already said they should do, so
this is a defect against the stated contract rather than a product decision.
Two tests pin it: one asserts paging is monotonic across all 49
width-and-offset pairs, and one pins the step between pages against
computeVisibleWindowOffset's own image. The monotonic test fails on thepre-change implementation with exactly the five pairs above.
Churn guard: no
refactorcommit has touchedweek-window.util.tsoruseWeek.tsin 30 days; their history is #5283, #5405 and #5437, a chore andtwo fixes. The ledger's only prior entry on this file is the 2026-12-01
weekViewDateStringentry (#5405), a different function, not re-opened.Examined and deliberately left alone, recorded in
judged-fine.mdso the nextsweep does not redo it: #5437's change to
computeVisibleWindowOffsetitself(centred-and-clamped to floor-paged) is the behavior change that PR exists to
make, with the e2e expectations moved with it and
anchorDateForWindowOffsetdeleted rather than orphaned; its deletion of the old round-trip test was
correct, the gap it left being the paging direction this PR closes; #5436 is the
previous sweep's own output; #5427 and #5438 are Dependabot bumps, with the
mswmajor smoke-checked over the whole Week view rather than taken on trust.The ledger also records a pattern worth a person's attention: both of the last
two findings are the same shape, a rule owned in one place and restated as a
literal condition somewhere that has to agree with it, and both arrived inside a
same-day fix to a surface under active iteration rather than in old code.
Verify
bun run verify --strictNo
Baseline against origin/main:block: nothing failed, so there are noPRE-EXISTING or FLAKY lists to paste.
Generated by Claude Code