refactor(cleanup): delete dead codec_keyboard.py duplicate (A-8)#65
Merged
Conversation
Closes A-8 — codec_keyboard.py (398 LOC) was a duplicate of codec.py's inline keyboard handling, dead in production. ## Verify-first evidence (no deletion until proven dead) - No production importer — only tests/test_full_product_audit.py + tests/test_transcript.py referenced it. - No PM2 entry runs it — ecosystem.config.js has no codec_keyboard.py script. The live keyboard path is inline in codec.py (on_press@788, on_release@858, keyboard.Listener@919) in the `codec` process. - clean_transcript is DEFINED in codec_config.py:841; codec_keyboard only re-imported it. ## Chose delete (option b) over migrate (option a) Option (a) — make codec_keyboard the canonical impl — would swap the live, battle-tested core-UX keyboard handler (F13 toggle, F18 voice, wake word, double-tap) for an unused module that's nearly untestable in CI (no real pynput headless). That's a regression risk for an aesthetic gain, against "never break working code." Deleting the dead duplicate achieves the audit's goal (kill the confusing fork) with zero production risk. ## Changes - Deleted codec_keyboard.py (398 LOC). - Redirected test_full_product_audit.py::TestKeyboard to assert codec.py's live handlers + F13 debounce >=1.0s + that the dead module stays gone. - Simplified test_transcript.py to import clean_transcript from codec_config. - AGENTS.md §2 + CONTRIBUTING.md: note keyboard handling lives inline in codec.py now. Note: the overlay_events.jsonl toggle-logging was a codec_keyboard-only feature that was never live (codec.py's handler doesn't write it) — no production behavior lost. ## Verification Full suite 1365 passing, 23 pre-existing failures unchanged (zero new). No skills/ touched -> no manifest regen. Reference: docs/audits/PHASE-1-CODE-QUALITY.md finding A-8. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
Closes A-8 (MEDIUM) —
codec_keyboard.py(398 LOC) was an unused duplicate of codec.py's inline keyboard handling. Verify-first (per the agreed gate for deletions); deleted only after proving it's dead.Verify-first evidence
tests/test_full_product_audit.py+tests/test_transcript.pyreferenced it.ecosystem.config.jshas nocodec_keyboard.pyscript. The live keyboard path is inline incodec.py:on_press@788,on_release@858,keyboard.Listener@919 (thecodecprocess). The line-54 "hotkey" comment refers tocodec-dictate→codec_dictate.py.clean_transcriptis safe — defined incodec_config.py:841; codec_keyboard only re-imported it, andtest_transcript.pyalready fell back to codec_config.Chose delete (option b), not migrate (option a)
The audit floats option (a) — make codec_keyboard the canonical impl — calling it "cleaner." But that swaps the live, battle-tested core-UX keyboard handler (F13 toggle, F18 voice, wake word, double-tap) for an unused module that's nearly untestable in CI (no real pynput headless). Regression risk on core UX for an aesthetic gain → against "never break working code." Deleting the dead duplicate achieves the audit's goal (kill the confusing fork) with zero production risk.
Changes
codec_keyboard.py(398 LOC).test_full_product_audit.py::TestKeyboard→ asserts codec.py's live handlers + F13 debounce ≥1.0s + that the dead module stays gone.test_transcript.pyto importclean_transcriptfromcodec_config.AGENTS.md§2 +CONTRIBUTING.md: note keyboard handling lives inline in codec.py.No behavior lost: the
overlay_events.jsonltoggle-logging was a codec_keyboard-only feature that was never live (codec.py's handler doesn't write it).Verification
Full suite 1365 passing, 23 pre-existing failures unchanged (zero new). No
skills/touched → no manifest regen.Reference: docs/audits/PHASE-1-CODE-QUALITY.md finding A-8.
🤖 Generated with Claude Code