Skip to content

refactor: remove dead code and narrative comments#54

Merged
jacaudi merged 1 commit into
mainfrom
cleanup/simplify-findings
Apr 11, 2026
Merged

refactor: remove dead code and narrative comments#54
jacaudi merged 1 commit into
mainfrom
cleanup/simplify-findings

Conversation

@jacaudi
Copy link
Copy Markdown
Owner

@jacaudi jacaudi commented Apr 11, 2026

Summary

Full-repo /simplify sweep — removes dead code, duplicate helpers, debug artifacts, and narrative comments across 23 files. Fixes one latent bug.

-444 lines net. All 166 Node.js tests + 7 Go tests pass.

Changes by area

Dead code removal

  • workers.js — deleted loadWorkerScript, loadWorkerFromBlob, getWorkerScript; collapsed 1-iteration buildWorkers loop and dropped vestigial round-robin worker_pointer (there is always exactly one worker)
  • crypto-ops.js — deleted stringToArrayBuffer, leaveItAlone, deselectLastActiveAccount, useBiometricsErrorHandler; collapsed genDefaultSeed IIFE
  • renderer.js — deleted html_newShare stub, animated_list, toggleAnimations, destroyAnimations, clear_clipboard
  • crypto-storage.js — deleted compressor, clearDatabase, unused cb params
  • webauthn.js — deleted empty init() IIFE, dead nested handleBioLogin, duplicated concatArrayBuffers (now uses combineArrayBuffers from crypto-ops.js), redundant webAuthnClick wrapper
  • buffer.js (main + worker) — deleted broken convertBufferType (referenced undefined identifier), bufferPush, getBufferTypedArrayConstructor
  • worker/index.js — deleted dead state (active_mp_buff, active_pk_buff, active_ecdh_pub_key) and corresponding gen_seed_pk case
  • file-import.js — deleted 6× var qq = 22; breakpoint artifacts, dead removeDragEvents, handleDropAnimation
  • file-ops.js — collapsed decodeData and parseFilekeyFile identity passthroughs
  • worker/encryption.js — deleted dead hexToArrayBuffer
  • init.js — removed dead top-level declarations
  • Duplicated checkForProperty — 4 copies consolidated into the one in lib/utils.js

Bug fix

  • db-handler.jsif (!valid) setPersistentWarning;setPersistentWarning(); — missing parens meant the persistent-storage warning was never actually emitted when IndexedDB init failed

Documentation hygiene

  • Stripped narrative comments from build.js, strip-comments.js, debug.js (main + worker), server/main.go, crypto-ops.js, init.js
  • Removed issue-number references (#36, #37, #45) from test strings and inline comments
  • Test cleanup: test-infra.js rewritten to hoist shared read, brittle "mentions environment variable" doc assertion removed

Helper relocation

  • Moved sanitizeFilename from src/js/ui/file-import.js to src/js/lib/utils.js alongside other string utilities

Deferred

Five higher-risk simplification targets are tracked in #53:

  1. ECDH P-521 arithmetic hot paths (needs benchmarks)
  2. doStuff / undoStuff unification (behavior refactor)
  3. lib/buffer.js build-sharing (structural)
  4. get_query_strings rewrite (fragile closure dependency)
  5. secureOverwriteBuffer useRandom flag (security-adjacent)

Test plan

  • node scripts/build.js && node --test app/tests/test-*.js — 166/166 pass
  • Go test suite runs clean in CI
  • Grep-verified every delete against the codebase before removing
  • Verified load-order for combineArrayBuffers cross-reference from webauthn.js

🤖 Generated with Claude Code

Sweep the repo for unused functions, duplicated helpers, narrative
comments, and debug artifacts. Fixes a latent bug in db-handler.js
where setPersistentWarning was referenced without invocation.

-444 lines across 23 files. All 166 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jacaudi jacaudi merged commit 3cd23a2 into main Apr 11, 2026
13 checks passed
@jacaudi jacaudi deleted the cleanup/simplify-findings branch April 11, 2026 09:21
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.

1 participant