Skip to content

Daily dead-code sweep 2026-10-10: the gesture teardown nothing calls - #176

Open
EnesYilmazcode wants to merge 2 commits into
mainfrom
deadcode/2026-10-10
Open

EnesYilmazcode wants to merge 2 commits into
mainfrom
deadcode/2026-10-10

Conversation

@EnesYilmazcode

Copy link
Copy Markdown
Owner

Checked against the open sweep PRs first: #175, #169, #148, #147, #146, #144, #143 are all still open. Read every diff before sweeping, and left their claims alone even where I re-encountered the same code (inBounds, bestGap, inScheduledHours, allWeekCodes, directions.matrix/MATRIX_MAX, the generation getter, i-bin/i-tick, TERM_NAMES, #chips) — nothing below duplicates them.

Baseline node --test on main: 938 tests, 934 pass, 4 skipped, 0 fail. Same on this branch. node scripts/check-dead-code.mjs says "no dead code" on both (this finding is a return value nothing ever assigns, which that checker doesn't look for).

Removed

js/map.js:627 / js/map.js:710-719 — the teardown closure attachGestures returns, and the priorTouchAction it exists to restore.

attachGestures(canvas, {...}) ends with return () => { removeEventListener × 6; canvas.style.touchAction = priorTouchAction; pointers.clear(); }. It has exactly two call sites in the whole repo, js/app.js:3972 and dev/index.html:203, and both are bare statements — attachGestures($('map'), {...}); — that discard the return value. priorTouchAction exists only to be restored inside that same closure, so it goes with it.

How I proved it dead:

  • Static: repo-wide grep across js/, scripts/, scripts/test/, dev/, spikes/, docs/ finds no third call site and no test that names attachGestures's return value. It's unchanged since the initial squash commit (8323b68), with no DECISIONS.md entry asking to keep it.
  • Runtime: a throwaway Chrome-DevTools-Protocol coverage harness (reusing scripts/lib/browser.mjs + scripts/lib/pinned-clock.mjs, the way scripts/shoot.mjs does) drove ~207 steps across the question screen, every card gesture, the way screen, the ranked list, room selection and its day calendar with both day-nav arrows, the buildings screen via the evening gate (five different pinned times), the building picker, "What Vacant knows", every refusal state (campus closed, exam week, between terms, term ended, schedule-dark, truncated index), offline reload (both cache-controlled and cold), the boot-failure card, install prompts on three platforms, desktop hover/pointer states, and ?dev=1//dev//dev/warp.html in full. Precise V8 coverage over all of it recorded zero calls for the closure.

What would make this wrong: a consumer outside this repo importing js/map.js directly (none exists — it's a static site with no package boundary), or a planned future caller that was going to start assigning the return value. It's the same shape as #175's generation getter.

Also re-measured and re-stamped, since this changes js/map.js's gzipped size: scripts/test/sw.test.mjs re-derives the header's byte figures from the committed blobs, so leaving them stale would turn the suite red.

  • sw.js: header comment now says Shell 168,778 bytes (was 167,466), SHELL_CACHE restamped via node scripts/stamp-sw.mjs.
  • README.md: "164 KB of shell" → "165 KB", which scripts/test/readme.test.mjs requires to match the rounded shell figure.

Most of that byte drift (168,852 measured vs. 167,466 in the stale header) predates this PR — it's what the other six open sweep PRs are also catching up on. This PR's own deletion is small: js/map.js alone goes from 9,540 to 9,466 gzipped bytes.

I did not run scripts/shoot.mjs --check for this one: the deleted code is an unreachable return value with no behavioral path, so it can't affect a rendered frame. (For what it's worth, --check already reports 3 pre-existing FAILs on an untouched main worktree — unrelated to this change.)

Heads up on merge order: the sw.js header/stamp lines and the README KB line are also touched by the 2026-09-27, 2026-09-29 and 2026-10-04 branches, so whichever of these merges last will need its author (or me, next run) to re-measure and restamp again. Same situation those earlier PRs already have with each other.

Not removed, not proven

A real bug, not dead code — flagging it here since the coverage run surfaced it, but I didn't touch it (behavior change, out of scope for a dead-code sweep): js/app.js:1155 reads a variable filtered that commit b9397a6 ("Remove the room needs filter", 2026-09-23) deleted the declaration of. Whenever the ranked answer is empty (!state.results.length), paintList() throws ReferenceError: filtered is not defined, which aborts before the empty-state screen renders. Reproduced it 20 times while driving dead rooms/truncated-index states in the sweep harness. Worth a look — possibly a one-line fix (drop the dead filtered ? asked() : '' clause, since filtered can't exist).

Everything else flagged by zero coverage and checked off as legitimately kept (accessibility affordances, defensive/error branches, tested-but-rare ladder rungs, the Google-success path which is blocked by design in headless, pinch gestures CDP can't drive, writing-direction and reduced-motion CSS, etc.) — full list and the proof for each is in the sweep notes below, kept out of the diff itself.

Full "not removed, not proven" list
  • app.js: syncPaneTouch/closeMenu initial no-op placeholders (reassigned before use); the empty-card c-list handler (unreachable only because of the filtered bug above); noDoors; locate's fail/error callback; loadShorts/openDev catches; the Google steps render (blocked on purpose); the browse-search/find form preventDefault handlers.
  • engine.js: ladder rungs opens-at, further, anywhere, longest — all in RUNGS and pinned by tests; the array-shaped closed tolerance.
  • state.js: array-shaped closed; the nextDoor tie-break (needs an exact walk-distance tie); createWatch's get id/get open (asserted in follow.test.mjs).
  • directions.js: plainText (Google success path, tested); the maps loader/callback; the consent default parameter.
  • map.js: get pending (map.test.mjs); spread (two-finger pinch — CDP touch events hang the map's animation loop, documented in shoot.mjs).
  • route.js: metresToPoint — called by docs/research/walking-graph-sample.mjs, a runnable script, not a bare doc mention.
  • install.js: the in-memory store used when storage is blocked.
  • pwa.js: reg.update catch; the Refresh button's reload.
  • club-occupancy.mjs: the busy copy for dates with events (tested).
  • CSS: [dir="rtl"] .ico-mirror (writing-direction affordance, unreachable in an LTR run by design); .blk.tight (needs a sufficiently short block, none in the driven data); .steps-list/.steps-m/.steps-src (Google success path); reduced-motion .c-card.snap/.bar (accessibility); @container … .b-row .b-hours (needs closed rows in a narrow container); body.carding .c-admits … (needs a card with admits text); warp's .out.bad (error state).
  • CLOCK_REFUSED's gate is unreachable in this harness because a NaN clock crashes boot before it — left alone, not proven either way.

🤖 Generated with Claude Code

https://claude.ai/code/session_01J1FPsM3kXNTAGmu8tYszr3


Generated by Claude Code

attachGestures returned a closure that removed its listeners and put the
canvas's touch-action back. Both callers, js/app.js and dev/index.html,
call it as a bare statement and throw the return value away, and no test,
spike or script imports attachGestures, so nothing in the repo can ever
reach that closure. priorTouchAction existed only for it.

Runtime coverage agrees: precise V8 coverage unioned across every state
the app has (the question, card, way, list, room and its day nav, the
buildings, picker and browse screens, every refusal, the evening gate,
offline and cold boots, boot failure, ?dev=1 and /dev/, desktop with a
fine pointer) records zero calls of it. Nothing about how the map handles
a finger changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J1FPsM3kXNTAGmu8tYszr3
`git show HEAD:<file> | gzip -9 -c | wc -c` over the shell list: 168,778
bytes, data 116,297. js/map.js went from 9,540 to 9,466. The README's
rounded shell figure moves from 164 to 165 KB with it; most of that drift
was already on main, which measured 168,852 before this branch. Shell
cache restamped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J1FPsM3kXNTAGmu8tYszr3

This branch has not been deployed

No deployments
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