Repository navigation
Daily dead-code sweep 2026-10-12: createWatch's unused id/open getters - #178
Open
EnesYilmazcode wants to merge 1 commit into
Open
EnesYilmazcode wants to merge 1 commit into
EnesYilmazcode wants to merge 1 commit into
Conversation
Full runtime coverage across every geolocation state (locate, watch start/stop, follow, every onFix/onError path, offline, dev mode) never reads watch.id or watch.open; js/app.js only ever calls .start()/.stop(). Both getters are exercised solely by scripts/test/follow.test.mjs, which is rewritten here to verify the same behavior through start()/stop() return values instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bb1exFqRPbNmgJubUTp74U
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.
Automated run of the daily dead-code sweep routine.
Checked against open sweep PRs first
8 earlier sweep PRs are open and unmerged, all branched from
mainbefore this one: #176, #175, #169, #148, #147, #146, #144, #143. I fetched and read every diff before sweeping, so nothing below duplicates them:attachGestures's dead teardown closure injs/map.jsgenerationgetter on the directions object #175 —directions.js'sget generationi-bin,i-tickdirections.matrix/MATRIX_MAX,state.js'sTERM_NAMES#chipscompatibility shimcampus.js'sinBoundsengine.js'sbestGap,state.js'sinScheduledHoursstate.js'sallWeekCodesMy own runtime coverage run independently re-derived most of these same functions as uncovered (
inBounds,bestGap,inScheduledHours,allWeekCodes,get generation,matrix, and theattachGesturesteardown closure all showed zero call count), which is a second, independent confirmation of those PRs' claims. None of that is repeated here.What this PR removes
js/state.js,createWatch'sget id()/get open()(2 getters, ~3 lines).Proof:
node --testbaseline was green (938 tests, 934 pass, 4 skipped, 0 fail). I then drove the real app with a Chrome-over-DevTools-Protocol harness (reusingscripts/lib/browser.mjsandscripts/lib/pinned-clock.mjs, the same wayscripts/shoot.mjsdoes) withProfiler.startPreciseCoverage({callCount:true, detailed:true})running continuously, and drove every geolocation-touching path I could reach in one continuous session plus several cold reloads:2026-12-11–2026-12-17, fromdata/rooms-1268.json), the gap between teaching-end and exams, winter break, and a far-future date with no term data at all?dev=1,/dev/, and/dev/warp.htmlfirstrun"cold" card (no cache, blocked fetch) andbootFailed's own gate card (warm shell cache, this reload's data fetch blocked) — these are two different code paths and I confirmed both independently0 page errors across the whole run.
watch.id/watch.opennever fired in any of it.js/app.jsonly ever callswatch.start(...)andwatch.stop()on the objectcreateWatchreturns — greppingjs/,scripts/,index.html,dev/,spikes/,docs/forwatch.id/watch.open/w.id/w.open/bare.open/thrower.openturns up nothing outsidescripts/test/follow.test.mjs, which is the module's only caller of either getter.scripts/test/follow.test.mjsis rewritten, not weakened: every assertion that used to read.id/.opendirectly now proves the identical fact throughstart()/stop()'s own return values, which the file's 26-mutation review already relies on elsewhere in the same suite:w.id === 7was fully redundant with the very next line (geo.calls.cleardeep-equals[7], which already requires the real handle to have flowed through); just dropped.w.open === falsewas redundant with the followingw.start(gps) === 'open'(a stuck handle would return'already-open'); dropped.w.start(gps) === 'open'right after the failedstop(), which only passes if the throw still cleared the handle.bare.open === falsereplaced withbare.stop() === 'closed'(whichstop()only returns when the handle is alreadynull);thrower.open === falsewas redundant with the test's own closingthrower.stop() === 'closed', so it's dropped and its documentation message moved onto that line.node --testis green after the edit (938 tests, 934 pass, 4 skipped, 0 fail — identical to baseline),node scripts/check-dead-code.mjsreports clean before and after, and the sw.js gzip-figure test still passes (the ~3 line removal fromjs/state.js, part of the shell cache, moved the actual gzipped shell size by far less than the test's 1% tolerance, so nostamp-sw.mjsre-run was needed). Nothing here touchesindex.htmlor anythingscripts/shoot.mjsphotographs, so I didn't need to re-run it.Not removed, not proven
Everything below showed up as "never called" in the same coverage run, but I could not drive the state that would call it, so I'm leaving it alone rather than guessing:
directions.js'splainText,loadMaps,withTimeout,ready,steps;app.js'saskStepsand its consent checkbox) — needs a real Google Maps API key andstate.googleConsent === true, which this sandbox has neither the credentials nor the network policy to provide.js/install.js) — needs a realbeforeinstallpromptevent, which headless Chrome doesn't fire.map.js'spanBy,zoomBy,drawPin,wheel, the pinchspreadhelper) — I never panned, pinched, or wheel-zoomed the map; only tapped it.engine.js'sany-type,opens-at,further,anywhere,longestrungs andstate.js'srungPhrase, the sentence that explains a relaxed answer) — my one pinned scenario (a 2-hour ask, Wednesday 10:20am) always had hundreds of rooms satisfying the top rung, so the ladder never had to relax, and the explanatory sentence for a relaxed answer never had anything to describe.app.js'semptyAnswer) — same reason; I never asked a question with zero rooms free.drawContained) and the picker's own embedded map (pickMapPoint,commitPickedOrigin,clearPickedOrigin, the pick-screen'sonPan/onZoom/onTap) — I used a directpick-rowtap rather than the picker's map or a room with a working photo.pwa.js'sshowRefresh,reloadOnce, thevacant:data-updatedmessage handler) — needs a real new-SW-version postMessage.firstrun.js's "Check again" retry button — I reached the fully-cold card but never pressed it.SCHEDULE_DARK— I drove every date between the committed calendar's teaching start and well past its exam window, including the exact gap between teaching-end and exams; every one of them resolved toBETWEEN_TERMS/TERM_ENDED, neverSCHEDULE_DARK. This matchesscripts/test/screens.test.mjs's own comment that no date on the shipped calendar can reach it any more — consistent, not a new finding.CSS.startRuleUsageTracking()as planned, butindex.html,js/dev.js,js/firstrun.js,js/pwa.js, andjs/install.jseach inject their own<style>block, and my dedup keyed purely on byte offset collided across those different stylesheets. I'm not confident in the result, so I'm not claiming any CSS selector as dead this run.Clock run
node --test: 938 tests, 934 pass, 4 skipped, 0 fail (unchanged by this PR).🤖 Generated with Claude Code
https://claude.ai/code/session_01Bb1exFqRPbNmgJubUTp74U
Generated by Claude Code