Skip to content

Daily dead-code sweep 2026-10-16: the orphaned js/preferences.js - #183

Open
EnesYilmazcode wants to merge 1 commit into
mainfrom
deadcode/2026-10-16
Open

EnesYilmazcode wants to merge 1 commit into
mainfrom
deadcode/2026-10-16

Conversation

@EnesYilmazcode

Copy link
Copy Markdown
Owner

Daily automated dead-code sweep. node --test baseline was green before starting (942 tests, 938 pass, 4 skipped, 0 fail).

Open sweep PRs checked against first

Nine daily-sweep PRs are already open and unmerged: #178, #176, #175, #169, #148, #147, #146, #144, #143. I read every diff before looking for anything new. Between them they already claim: createWatch's id/open getters (state.js), attachGestures's priorTouchAction + teardown return (map.js), generation getter (directions.js), the i-bin/i-tick sprite symbols (index.html), MATRIX_MAX/matrix() (directions.js), TERM_NAMES (state.js), the #chips compatibility shim (index.html, expiry met), inBounds (campus.js), bestGap/inScheduledHours (engine.js/state.js), and allWeekCodes (state.js). None of that is touched here.

Finding: js/preferences.js is a whole module nothing in production reaches

Most certain — this is a full module, not just an export, and the proof is exhaustive rather than coverage-sampled.

  • js/preferences.js (18 lines: the ROOM_FEATURES table and roomFeatureLabels()) is referenced exactly once anywhere in the repository outside itself: scripts/test/preferences.test.mjs's import. A case-insensitive grep for preferences across the whole tree turns up nothing else — no <script> tag, no static import, no dynamic import().
  • The module graph from index.html's two script tags (js/pwa.js, js/app.js) was traced by hand: js/app.js has one dynamic import() in the whole codebase, and it targets js/dev.js, not this file. There is no computed/templated import path (import(\./${x}.js`)`-style) anywhere that could reach it at runtime.
  • It is not in sw.js's SHELL_ASSETS precache list, so the service worker never fetches it either.
  • git log on the file shows the real story: commit b9397a6 ("Remove the room needs filter", 2026-09-23, Enes's own commit) deleted the feature that called roomFeatureLabels() from index.html and js/app.js, but only trimmed js/preferences.js down to its current 18 lines instead of deleting it, and left its test alongside it.
  • scripts/test/screens.test.mjs:826 already independently asserts the room screen's rendered markup does not reference roomFeatureLabels — a test written to pin down exactly the fact that makes this module dead.

Because this module is never loaded by any browser-reachable path (not merely "uncovered in the states I drove"), no runtime coverage run could add anything a complete module-graph trace hasn't already shown — there's no execution state in which Chrome would ever request the file. I did not spin up a coverage capture for this reason; the evidence here is a full trace of every static and dynamic import edge in the app, not a sample.

What would make me wrong: a reference to js/preferences.js or preferences that the grep missed (e.g. hidden in a binary/data file, which I did not scan), or some other way for a browser to fetch an un-imported .js file under /Vacant/ that I haven't considered.

Follow-on fix

privacy.html states the exact count of JavaScript files under js/, and scripts/test/follow.test.mjs checks that count against readdirSync. Removing the file drops the count from 15 to 14; privacy.html is updated to match (14 is written as a numeral, same as the test expects for counts above twelve).

sw.js's gzip figures are untouched — js/preferences.js was never part of SHELL_ASSETS, so nothing to re-stamp.

Not removed, not proven

Nothing else from this run. I ran the existing static checker (scripts/check-dead-code.mjs) for candidates and cross-referenced its "export used nowhere" logic (which is blind to test-only-reachable exports, same gap the prior sweep PRs exploited) against all nine open PRs' diffs; the one new survivor was the module above.

Verification

  • node --test: 941 tests, 937 pass, 0 fail, 4 skipped (942→941 total from the one removed test; 938→937 pass).
  • node scripts/check-dead-code.mjs: no dead code.
  • No screenshots touch js/preferences.js or anything in its dead path, so scripts/shoot.mjs --check was not run for this change.

🤖 Generated with Claude Code

https://claude.ai/code/session_016RTHekdsXHLYUvG6qYHA4J


Generated by Claude Code

The room-needs filter was removed in b9397a6 (2026-09-23, "Remove the room
needs filter"), which trimmed index.html and js/app.js but left
js/preferences.js's ROOM_FEATURES table and roomFeatureLabels() behind along
with their test. Nothing imports the module any more: it is not in sw.js's
SHELL_ASSETS, not in index.html's two <script> tags, not statically imported
by any js/*.js file, and the app's only dynamic import() targets js/dev.js.
scripts/test/screens.test.mjs already asserts the room screen's markup does
not reference roomFeatureLabels.

privacy.html's JS-file count drops from 15 to 14 to match.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016RTHekdsXHLYUvG6qYHA4J

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