Repository navigation
Daily dead-code sweep 2026-10-08: unused generation getter on the directions object - #175
Open
EnesYilmazcode wants to merge 1 commit into
Open
EnesYilmazcode wants to merge 1 commit into
EnesYilmazcode wants to merge 1 commit into
Conversation
Runtime coverage across every driven state (normal ranking, both swipe verdicts, the way screen, the deck/list, room detail and day nav, the location and building pickers, every refusal screen, ?dev=1, a blocked- network boot, and an offline reload) never calls the getter, and a repo- wide grep turns up no production reader either -- app.js calls invalidate() but never reads .generation back. invalidate() already returns the new count, so callers never needed the getter in the first place; only a test read it directly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018uATJfgH74g8DjKBWwoN3e
This branch has not been deployed
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.
Daily automated dead-code sweep.
node --testbaseline was green (938 tests, 934 pass, 4 skipped) before and after this change.Checked against open sweep PRs first. Listed open PRs whose head branch starts with
deadcode/and read every diff before starting, so this doesn't re-find or re-delete anything already pending:deadcode/2026-10-04): sprite symbolsi-bin,i-tickdeadcode/2026-09-29):directions.matrix(),MATRIX_MAX,TERM_NAMESdeadcode/2026-09-27): the#chipscompatibility shim (expiry met)deadcode/2026-09-24):campus.inBoundsdeadcode/2026-09-23):engine.bestGap,state.inScheduledHoursdeadcode/2026-09-22):state.allWeekCodesEverything below is new; none of it overlaps those diffs.
Removed
js/directions.js: theget generation()accessor on the objectcreateDirections()returns. (was lines 112–114)invalidate()which bumps that same counter.scripts/lib/browser.mjsandscripts/lib/pinned-clock.mjs, the same patternscripts/shoot.mjsuses) that startsProfiler.startPreciseCoverage({callCount:true, detailed:true})andCSS.startRuleUsageTracking(), then drives the real app at a pinned clock/location through: the question screen, both card swipe verdicts (held and dropped), the way screen, binning the full 35-room deck into the ranked list, selecting a room, the room day-calendar screen with day-nav arrows forward and back, "Sources" → the About/"What Vacant knows" screen, the location picker, the building picker (search + drill into a room + back out), every refusal screen reachable with the shipped data (Saturday 3am, a weekday evening after scheduled hours via the gate button, Thanksgiving Day →CAMPUS_CLOSED, finals week →EXAM_REFUSAL, before-term-start →BETWEEN_TERMS, after-exams →TERM_ENDED),?dev=1,dev/index.html, a fresh profile with/data/*network-blocked (the boot-failure/cold-start card), and an offline reload after the service worker had cached a normal boot. Merged coverage across all of it: the getter's byte range was never once entered. A repo-wide grep confirms it independently —js/app.jscallsstate.directions?.invalidate()but never reads.generationback, and no other file does either.invalidate()already returns the freshly-bumped count, so a caller never needed the separate getter to begin with; only a test read it directly..generationthrough a path grep can't see — dynamic property access (d['generation']) or reflection. I didn't find either in this codebase, and the coverage sweep's own driving would have exercised any such caller too if one existed on a screen I reached.invalidate()and the internal staleness checks that compare against the closed-overgenerationvariable directly are untouched).Updated
scripts/test/directions.test.mjsaccordingly: the one test that readd.generationdirectly now asserts the same increment-and-report behavior throughinvalidate()'s own return value, which is what's left to observe it with.Not removed, not proven
Coverage also flagged plenty of other zero-count functions (map pan/zoom/wheel gesture handlers, the custom map-pin picker, the install-prompt banner, service-worker update UI, the firstrun cold-boot retry button, dev-panel custom date entry, geolocation error callbacks, the Google-consented "Step by step" directions feature). Every one of these has a confirmed real caller via grep — they're wired to native browser events this headless sweep can't easily synthesize (pinch gestures,
beforeinstallprompt, a waiting service worker, native geolocation errors) rather than being unreachable. Left alone per the brief: not reached isn't proven dead.Also confirmed and left alone as explicitly-reachable-later, not dead: the
BETWEEN_TERMS"gap" variant (needscurrent.next, which the shippeddata/current.jsondoesn't carry yet) and theSCHEDULE_DARK/INDEX_REFUSED/CLOCK_REFUSEDrefusal branches, which require conditions (a near-total schedule blackout, a build that under-delivered rooms, or an unreadable device clock) that don't occur anywhere in the shipped Autumn 2026 data — verified by runningresolveStatedirectly over every date the term's calendar actually defines. These are defensive/future-facing branches, not unreachable code.CSS rule-usage tracking (
CSS.startRuleUsageTracking/CSS.takeCoverageDelta) across the same states found no unused rules inindex.html's inline stylesheet, and no sprite symbol beyond the two already claimed by #169 has a zero reference count.node scripts/check-dead-code.mjsalso reports clean.Notes
node scripts/shoot.mjs --checkwas run; three pre-existing failures (list/roomsheet-height assertions) reproduce identically on a cleanmaincheckout with no changes, confirmed by stashing this diff and re-running — unrelated to this PR.🤖 Generated with Claude Code
https://claude.ai/code/session_018uATJfgH74g8DjKBWwoN3e
Generated by Claude Code