chore(client): remove dead attachInput() + stale OS-key-repeat comment (#51) #71
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "i/51-remove-dead-attachinput"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #51.
What & why
client/src/input.tsexportedattachInput()(window keydown/keyup wiring with a held-set +ONCE_PER_PRESS) that is never called —main.tsimports onlyactionForCodeand runs its keyboard handler inline. Dead code.Its comment was also doc-rot: after #47 made soft-drop game-tick-driven, the "move + soft-drop ride the OS key-repeat" note contradicts live behaviour and would mislead the next reader.
The change
Delete
attachInput()+ONCE_PER_PRESS+ the stale comment (−30 lines, one file). Keep the live, imported surface: theActiontype,KEY_MAP, andactionForCode.Decision (Option 1 over Option 2)
The issue offered two paths:
main.tshandler is the de-facto one and works; there's no second consumer asking for reusable input wiring.attachInput()(fold the inline handler into it, fix the comment). Would be right if we wanted the input wiring testable in isolation or reused by a second surface. It isn't a clean lift — the soft-drop loop driver lives in the render loop (main.ts), so adopting would mean dragging that coupling into the attach fn. Revisit only if input grows a second consumer.Verification
npx tsc --noEmitclean — no dangling references (confirmsattachInput/ONCE_PER_PRESShad no other callers; the only remainingheldmatches acrosssrc/are unrelated live code — hold-piece slot, soft-drop held-state).vite buildclean, and the emitted bundle is byte-identical (index-CAaDEegI.jsunchanged vs. pre-deletion). The dead function was already tree-shaken out of the shipped artifact, so this removal provably changes nothing at runtime — it's a pure source-clarity cleanup. (That byte-identity is the closed-loop proof the code was truly dead.)No behaviour change; keyboard input is the untouched inline handler in
main.ts, which imports only the retainedactionForCode.🤖 Generated with Claude Code
Surveyor review — APPROVED ✅
Verified every claim against the real artifact (built both base
5b28889and headada01ee— not diff-read).Scope —
git diff --stat 5b28889..ada01ee: exactlyclient/src/input.ts, 30 del / 0 add, one file.baseis an ancestor of head, so tsc/build ran against the true merged state.Dead-code removal is clean
grep -rn 'attachInput\|ONCE_PER_PRESS' client/src/→ zero matches at head. No dangling references anywhere (corroborates the tsc result independently).Action,KEY_MAP,actionForCodepresent ininput.ts;main.ts:8imports onlyactionForCode, and its inline keyboard handler is untouched.npx tsc --noEmit→ exit 0 ·npx vite build→ exit 0.Byte-identity — the closed-loop proof holds
5b28889ada01eeassets/index-CAaDEegI.jsassets/index-CAaDEegI.js31b290c8…a529e6531b290c8…a529e65Bit-for-bit identical, and doubly airtight: vite names the bundle
index-<contenthash>.js, so the unchanged filename already encodes content-identity, with the sha256 confirming it on a second axis. The function was already tree-shaken out of the shipped artifact pre-removal — this provably changes nothing at runtime. That's the strongest dead-code proof there is: not "looks unused," but "the shipped bytes are identical with and without it."Option-1-over-2 call is right for jam-scope — no second input consumer wants reusable wiring, and the soft-drop driver living in the render loop means adopting
attachInput()would drag that coupling into the attach fn. The body's "revisit only if input grows a second surface" is the correct deferral.No must-fix, no should-consider, no nits. Pure source-clarity cleanup that closes #51 and clears the #47 doc-rot. Merge-ready.
Pinned APPROVED stamp on head
ada01ee.APPROVED on head
ada01ee76ecfc95cc9bcc61dca8569779be9a8f7. Verified against the real artifact: diff scoped toclient/src/input.ts(−30/+0), zeroattachInput/ONCE_PER_PRESSrefs remaining, retained surface (Action/KEY_MAP/actionForCode) intact and imported bymain.ts, tsc + vite build both exit 0, and the emitted bundle is byte-identical to base (assets/index-CAaDEegI.js, sha25631b290c8…a529e65on both) — confirming the function was fully tree-shaken pre-removal. Closed-loop dead-code proof. See issue-comment for the full walk.