Skip to content

Daily dead-code sweep 2026-09-27: the #chips compatibility shim, expiry met - #147

Open
EnesYilmazcode wants to merge 4 commits into
mainfrom
deadcode/2026-09-27
Open

EnesYilmazcode wants to merge 4 commits into
mainfrom
deadcode/2026-09-27

Conversation

@EnesYilmazcode

Copy link
Copy Markdown
Owner

Automated daily dead-code sweep. node --test baseline was green (932 tests, 928 pass, 4 skipped) before any change.

Open sweep PRs checked against first: #143 (deadcode/2026-09-22, removes allWeekCodes), #144 (deadcode/2026-09-23, removes bestGap and inScheduledHours), and #146 (deadcode/2026-09-24, removes inBounds). I read all three diffs in full. Nothing in this PR overlaps what they remove, and those four symbols were excluded from consideration here as already claimed.

Method

node scripts/check-dead-code.mjs came back clean (110 files, no dead code). I also ran a corrected variant of its own algorithm looking specifically for exports referenced only from test files (the shape all three open PRs above found) — that surfaced 15 candidates, but every single one turned out to be a false positive once cross-checked against dev/*.html and spikes/*.html: the static checker never walks .html files at all, so anything imported only from dev/index.html, spikes/walk.html, spikes/launch.html etc. looks test-only to it when it isn't (e.g. toLonLat is used live by dev/index.html). Two more (resetRequests/setRequests in scripts/lib/fetch.mjs) are explicitly documented test-only hooks ("Tests only, so the cap can be exercised without making 3000 stub calls"), and five more (fieldShape/distanceLearningMode/onlineStillExists/buildingJoin/harvestAxis in scripts/live-rot-checks.mjs) are called by scripts/test/live-rot.live.test.mjs, the live-network canary the file's own header says is their only intended caller. None of those are dead.

I also statically cross-checked every CSS class/id selector in index.html's stylesheet, every <symbol id> in the SVG sprite, and every data-* attribute name against js/*.js, index.html, and dev/*.html: all of them have both a writer and a reader somewhere. Nothing there.

That left one more category from the brief: "code a comment marks for removal whose condition is now met." A grep for removal-note language turned up exactly one hit, and I verified its condition rather than trusting the label — see below.

I did not build the full CDP runtime-coverage harness this run (Profiler.startPreciseCoverage / CSS.startRuleUsageTracking driving pinned-clock states, the way #146 did). The finding below doesn't need it — it's proven by grep and git history, not by what the browser executes — but that also means I'm not claiming the coverage sweep's kind of exhaustiveness this time. Anything only a runtime sweep would catch is left for tomorrow.

Removed: the #chips compatibility shim, index.html:1106-1123 (most certain)

<!-- REMOVE AFTER ONE RELEASE. #85 deleted the duration chips, and this empty
     node is the only thing standing between that deletion and a frozen app
     for everyone who already has the site installed.
     ...
     Once a release has shipped with it, no cached
     app.js reaches for #chips any more and this can go. -->
<div id="chips" hidden></div>

What it was: #85 (commit 867c4d4, 2026-09-02) deleted the duration-chip radiogroup and its attachChips()/paintChips wiring from js/app.js. Because sw.js serves navigations network-first but everything else cache-first, the very next deploy after that PR risked pairing a fresh index.html with a stale, cached js/app.js that still called attachChips() as the second statement of its DOMContentLoaded listener — a TypeError on a missing #chips node, before $('back').onclick, popstate, attachSheet() or boot() ever get wired, i.e. a frozen "finding campus..." screen with no way out for anyone who had the old app.js sitting in their service-worker cache. The empty, hidden <div id="chips"> was scaffolding to keep that one querySelectorAll from throwing.

The condition, and how I verified it: the comment states its own expiry plainly — "Once a release has shipped with it, no cached app.js reaches for #chips any more and this can go." That shim (comment included) has been present, unchanged, in every commit since 867c4d4. git log 867c4d4..HEAD shows 64 commits and 25 days elapsed (2026-09-02 → 2026-09-27), across dozens of merged, deployed PRs — this static site has no build step, so every merge to main is itself a deploy. The shim only ever needed to survive the single transition immediately after 867c4d4; every deploy since has shipped a same-generation app.js that no longer calls attachChips() at all, so any client that has loaded the app even once since 2026-09-02 (a service worker checks for updates on activation, and js/pwa.js reloads once when untouched) is long past the risk window. grep -rn "attachChips\|#chips\|\.chip\b" across js/, index.html (outside the shim's own comment), dev/, scripts/ (non-test) and spikes/ finds nothing else — the only production code that ever referenced it was the code #85 already deleted.

What would make me wrong: a real installed client somewhere that hasn't opened the app since before 2026-09-02 and whose service worker never independently updated in the 25 days since. I can't rule that out with certainty for every phone on the planet, but the comment's own bar was "one release," not "every possible installed client forever," and that bar has been cleared by a wide margin.

What I did: removed the comment and the <div id="chips" hidden> from index.html. Removed the test in scripts/test/screens.test.mjs ("the #chips node left behind for the old shell is empty, and dated") that asserted the shim's presence and wording — it existed only to guard this exact scaffold. Left the sibling test ("the duration chips are gone from the page, not merely hidden on it") untouched; its assertions about .chip/attachChips/paintChips being absent from the live app are still true and still worth keeping.

Deleting ~700 bytes of markup moved sw.js's measured shell gzip figure from 164,286 to 163,666 bytes (well inside the test's 1% tolerance, but I re-measured with the same git show HEAD:<file> | gzip -9 -c | wc -c method the header names and updated it for accuracy) and re-ran node scripts/stamp-sw.mjs.

node --test (931 tests now — one fewer, the deleted shim test — 927 pass, 4 skipped, still green), node scripts/check-dead-code.mjs (clean), and node scripts/shoot.mjs --check (all five frames pass, no problems) after the change.

Not removed, not proven

  • No full runtime coverage sweep this run — see Method above. I didn't drive refusal states, the building picker, the room calendar, ?dev=1, offline reload, etc. this time, so anything only reachable-but-actually-dead code hiding behind those states is unexamined today, not ruled out.
  • Everything the static passes above touched (CSS selectors, sprite symbols, data-* hooks, test-only-looking exports) checked out as live once cross-referenced against dev/*.html and spikes/*.html, which is exactly why nothing else is in this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RUtU2jqDkfDxwyLjYkHHNK


Generated by Claude Code

…expiry met

#85 (commit 867c4d4, 2026-09-02) deleted the duration-chip radiogroup and left
an empty `<div id="chips" hidden>` in index.html so that any client still
running the pre-#85 app.js (cached by the service worker, which serves
navigations network-first but everything else cache-first) would not hit a
TypeError on its first `attachChips()` call after the deploy. The comment
that introduced it says plainly when it can go: "Once a release has shipped
with it, no cached app.js reaches for #chips any more and this can go."

25 days and 64 commits (dozens of merged, deployed PRs) have shipped since
that commit, so the shim has done its one job many times over. Removed the
div and its comment, and the scripts/test/screens.test.mjs test that pinned
its presence and wording. The sibling test asserting no #chips CSS rule or
JS reference exists is untouched and still passes.

index.html shrank by ~620 gzipped bytes; re-measured and updated sw.js's
header comment and re-ran scripts/stamp-sw.mjs accordingly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RUtU2jqDkfDxwyLjYkHHNK
Resolves the sw.js conflict in the stamped shell-size comment and
SHELL_CACHE line: both branches had independently restamped it since
this PR's base. Keeps the merge, re-stamps SHELL_CACHE for the new
merge commit via scripts/stamp-sw.mjs, and recomputes the gzip Shell/
data byte figures in the header comment (and the README's rounded KB
figure) for the actual merged tree per scripts/test/sw.test.mjs's own
measurement method.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RUtU2jqDkfDxwyLjYkHHNK
Resolves a second sw.js conflict on the SHELL_CACHE line: main
re-stamped it again (PR #168) since the last merge. Keeps the merge,
re-stamps SHELL_CACHE for the new merge commit via
scripts/stamp-sw.mjs, and recomputes the gzip Shell/data byte figures
(and README's rounded shell KB figure) since #168 also touched
js/app.js, js/map.js and js/sheet.js, all shell assets.

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

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