Skip to content

refactor(web): drop dead date field keyboard flags and share the duplicate-copy grouping pass - #4562

Merged
tyler-dane merged 2 commits into
mainfrom
claude/kind-dirac-phf4la
Oct 18, 2026
Merged

tyler-dane merged 2 commits into
mainfrom
claude/kind-dirac-phf4la

Conversation

@tyler-dane

Copy link
Copy Markdown
Contributor

What and why

A debt pass over the last 7 days of merged changes (2026-10-15 to 2026-10-18).
No issue: this is the scheduled tech-debt sweep, not a product change. Two
behavior-preserving cleanups, one commit each.

1. refactor(web): drop dead date field keyboard flags

EventFormDateField grew two boolean props, arrowDownOpensCalendar and
keyboardOpensCalendar. Both defaulted to true, and no call site ever
passed false: DatePickers passed arrowDownOpensCalendar explicitly as
true, TimePickers relied on the default, and keyboardOpensCalendar was
never passed at all. The three branches they guarded were configuration
nobody could reach, and no test covered the false side. Both props are
gone; every caller keeps the behavior it already had.

While in that handler:

  • switch (true) becomes a plain switch (event.key). Two of its cases
    carried a && !isOpen term that the if (isOpen) return above already
    guaranteed, so the ladder was hiding dead conditions.
  • the repeated preventDefault() + stopPropagation() pair collapses into
    one consume helper.
  • commitTypedDate is inlined. It had one caller and its boolean return was
    discarded.

2. refactor(web): share the duplicate-copy grouping pass

The holiday dedupe in #4553 added a second copy of the grouping loop in
mergeDuplicateCopies: walk data.ids, resolve the event and its calendar,
build a group key, bucket by it. The two copies had already drifted - only
the holiday pass skipped events an earlier pass dropped, and only the ical
pass guarded a missing event. Grouping now happens once behind a keyFor
callback, so each pass contributes only its own key rule. Both guards hold
for both passes, which is a no-op in practice: nothing is dropped before the
first pass runs, and that pass already required an icalUid that a missing
event could not supply.

Verify

Summary
Selected packages: web
Checks run: type-check, lint, knip, test:a11y
Checks skipped: (none)

Failed: test:web, test:e2e
VERDICT: FAIL

type-check, lint, knip and test:a11y (65 passed) are green. Both
failures reproduce on clean origin/main (5b0e9f8) in this sandbox with the
diff reverted, so neither is this change's:

  • test:web - web shard 3/6 is killed at the runner's 5000 MB RSS rail
    (5198 MB here), stopping in
    apps/calendar-web/src/components/SelectView/SelectView.test.tsx. On
    origin/main the same shard trips the same rail at the same file
    (5015 MB). Shards 1 and 2 pass in full (654 and 760 tests). The memory is
    cumulative across the shard's 86 files, not one test: that file on its own
    passes 33/33 in 5s.
  • test:e2e - 252 passed, 1 failed:
    e2e/calendars/calendar-experience.spec.ts:759 "a read-only event can be
    hidden from the menu, shown with x, and stays hidden after reload", on
    expect(hidden card).toBeVisible(). Re-run alone on origin/main it fails
    on the same locator with the same "element(s) not found".

Targeted runs covering the changed code are green:

  • bun test:web -- apps/calendar-web/src/events - 397 pass, 0 fail
  • bun test:web -- .../EventForm/DateControlsSection - 86 pass, 0 fail

The removed props are compile-time surface, so type-check covers their
removal repo-wide.


Generated by Claude Code

arrowDownOpensCalendar and keyboardOpensCalendar both defaulted to true
and no call site ever passed false, so the branches they guarded were
configuration nobody could reach. Drop both props and keep the behavior
every caller already got.

While in the handler, replace the switch (true) ladder with a plain
switch on event.key: two cases carried a dead "&& !isOpen" term that the
early return above already guaranteed. Pull the repeated
preventDefault/stopPropagation pair into one consume helper and inline
commitTypedDate, a single-use helper whose boolean return was discarded.

Behavior preserving: no call site or assertion changes beyond removing
the prop that is gone.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019hX2HqFjXbknuZmAsNmnx9
The holiday pass added a second copy of the grouping loop: walk data.ids,
resolve the event and its calendar, build a group key, bucket by it. The
two copies had already drifted - only the holiday pass skipped events an
earlier pass dropped, and only the ical pass guarded a missing event.

Group once behind a keyFor callback so each pass contributes only its own
key rule. Both guards now hold for both passes, which is a no-op in
practice: nothing is dropped before the first pass runs, and that pass
already required an icalUid the key could not read from a missing event.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019hX2HqFjXbknuZmAsNmnx9
@tyler-dane tyler-dane added the agent-automerge Agent-loop finished; merge-guard may squash-merge label Oct 18, 2026 — with Claude
@tyler-dane
tyler-dane enabled auto-merge October 18, 2026 10:29

Copy link
Copy Markdown
Contributor Author

Tech-debt sweep, 2026-10-15 to 2026-10-18

Window: the 50 commits merged to main in the last 7 days (99d9fda..5b0e9f8).
Hot spots by churn were the macOS Swift app and the web event form.

Addressed here (2 items, 1 PR):

# Debt Kind Where it came from
1 arrowDownOpensCalendar / keyboardOpensCalendar were permanently true at every call site, with no test on the false side dead configuration, premature generality #4550, #4540
1b switch (true) ladder hiding two && !isOpen terms the early return already guaranteed; duplicated preventDefault/stopPropagation; single-use helper with a discarded return anti-pattern, repetition #4541, #4550
2 Second copy of the copy-grouping loop in mergeDuplicateCopies, already drifted from the first (each had a guard the other lacked) repetition, drift risk #4553

Found and deliberately not acted on:

  • NativeCalendarRootModel is 3,051 lines across 15 +Extension files and
    took 13 of the window's commits. That is the real structural debt in this
    window, but splitting a god object is a design call, and swift test is
    CI-only (no Xcode on a Linux sandbox), so a refactor would ship with no
    local signal. Worth a human-owned issue.
  • TimePickers still carries the paired isStartMenuOpen / isEndMenuOpen
    booleans that refactor: collapse the all-day row-fit pair and banner dismissal state #4535 and refactor: share form jump ids and drop unused palette item fields #4543 collapsed for the date pickers. Collapsing
    them to one open side would make the two menus mutually exclusive, which is
    a behavior change, not a simplification.
  • now-cue.store.test.ts has two tests whose names promise timer behavior
    ("clears after the pulse duration", "extends the active window") but assert
    only what resetForTests() does. The honest fix is to inject the scheduler
    into the store rather than stub globalThis.setTimeout, which is a wider
    change than a debt sweep should make unreviewed.

Pre-existing failures this sweep surfaced (both reproduce on clean
origin/main with the diff reverted, details in the PR body):

  • bun test:web cannot finish in a 5 GB sandbox: shard 3/6 trips the
    runner's 5000 MB RSS rail partway through its 86 files.
  • e2e/calendars/calendar-experience.spec.ts:759 ("a read-only event can be
    hidden from the menu, shown with x, and stays hidden after reload") fails on
    expect(hidden card).toBeVisible().

Labeled agent-automerge with auto-merge enabled; the merge queue and
agent-loop-merge-guard.sh decide. No merge has landed yet.


Generated by Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

Boot bundle: 509.8 KB gzip (+0.0 KB vs main)

@tyler-dane
tyler-dane added this pull request to the merge queue Oct 18, 2026
Merged via the queue into main with commit 063dbad Oct 18, 2026
30 checks passed
@tyler-dane
tyler-dane deleted the claude/kind-dirac-phf4la branch October 18, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-automerge Agent-loop finished; merge-guard may squash-merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants