refactor: remove dead code and narrative comments#54
Merged
Conversation
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>
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
Full-repo
/simplifysweep — 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— deletedloadWorkerScript,loadWorkerFromBlob,getWorkerScript; collapsed 1-iterationbuildWorkersloop and dropped vestigial round-robinworker_pointer(there is always exactly one worker)crypto-ops.js— deletedstringToArrayBuffer,leaveItAlone,deselectLastActiveAccount,useBiometricsErrorHandler; collapsedgenDefaultSeedIIFErenderer.js— deletedhtml_newSharestub,animated_list,toggleAnimations,destroyAnimations,clear_clipboardcrypto-storage.js— deletedcompressor,clearDatabase, unusedcbparamswebauthn.js— deleted emptyinit()IIFE, dead nestedhandleBioLogin, duplicatedconcatArrayBuffers(now usescombineArrayBuffersfromcrypto-ops.js), redundantwebAuthnClickwrapperbuffer.js(main + worker) — deleted brokenconvertBufferType(referenced undefined identifier),bufferPush,getBufferTypedArrayConstructorworker/index.js— deleted dead state (active_mp_buff,active_pk_buff,active_ecdh_pub_key) and correspondinggen_seed_pkcasefile-import.js— deleted 6×var qq = 22;breakpoint artifacts, deadremoveDragEvents,handleDropAnimationfile-ops.js— collapseddecodeDataandparseFilekeyFileidentity passthroughsworker/encryption.js— deleted deadhexToArrayBufferinit.js— removed dead top-level declarationscheckForProperty— 4 copies consolidated into the one inlib/utils.jsBug fix
db-handler.js—if (!valid) setPersistentWarning;→setPersistentWarning();— missing parens meant the persistent-storage warning was never actually emitted when IndexedDB init failedDocumentation hygiene
build.js,strip-comments.js,debug.js(main + worker),server/main.go,crypto-ops.js,init.js#36,#37,#45) from test strings and inline commentstest-infra.jsrewritten to hoist shared read, brittle "mentions environment variable" doc assertion removedHelper relocation
sanitizeFilenamefromsrc/js/ui/file-import.jstosrc/js/lib/utils.jsalongside other string utilitiesDeferred
Five higher-risk simplification targets are tracked in #53:
doStuff/undoStuffunification (behavior refactor)lib/buffer.jsbuild-sharing (structural)get_query_stringsrewrite (fragile closure dependency)secureOverwriteBufferuseRandomflag (security-adjacent)Test plan
node scripts/build.js && node --test app/tests/test-*.js— 166/166 passcombineArrayBufferscross-reference fromwebauthn.js🤖 Generated with Claude Code