Repository navigation
Drop unreferenced APIs and add a test coverage report - #4
Merged
Merged
Conversation
Delete exported functions, types and constants that nothing in the codebase calls, plus the imports and private helpers left orphaned by those removals. Functions that only tests still reached are removed together with their tests; test seams and fixture builders stay. Dependencies and files were also checked: every package and every file under src is still in use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GjuD2e7tgdWWdpmUMkcZcS
Compiles the tests with source maps and runs them under Node's built-in coverage, so the report points at the original src files. Test and node_modules files are excluded from the report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GjuD2e7tgdWWdpmUMkcZcS
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.
This PR does two things:
npm run test:coverage, which shows how much ofsrcthe tests actually run.No user-facing behavior changes.
1. Removing APIs nothing calls
I checked every export in
src/for references insrc,testandscripts. Every dependency inpackage.jsonand every file undersrc/is still in use, so none were removed.Called from nowhere:
useKeybinding,useRegisterKeybindingContext,useOptionalKeybindingContext,RestoreContinuitySnapshotEnvelopeArgs,envelopeChallengeFor,readSkill,readSkillFile(and the privateloadSkillBody),PRIVATE_SNAPSHOT_PATHS,sourcesFromFileMap,buildSeedConfigFromStep,buildSeedConfigForIdentity,readValidationFromState,EnsIssueValidation,runPublicProfilePreflight,walletPageFresh,deleteConfig,updateIdentityBackup.Only their own tests called them (removed along with those tests):
encodeApproveandencodeApprovalRevoke.test/identity/ens/resolverDelegation.test.tsonly tested these, so it is deleted.identitySummaryRows,tokenCandidateHint,chainSummaryRow,networkLabel,joinWithMore,awaitOptionalReceipt,booleanField,clearIdentity,serializeSkillFile. Where a test also covered live code, it was trimmed instead of deleted. For example, theawaitConfirmedReceiptandnetworkSubtitlechecks are kept.Some functions are used only by tests but exist to support them, so they stay. Examples:
generatePrivateKey,writeDaemonPid, the backup-envelope creators that build restore fixtures, thereset*ForTesthelpers,getConfiguredVaultAddressand the Pinata JWT cache helpers.Imports left unused by these removals are deleted as well.
tsc --noEmit --noUnusedLocalspasses cleanly.2.
npm run test:coveragetest/run-tests.mjsnow takes a--coverageflag. With it, the tests are compiled with source maps and run under Node's built-in coverage, so the report points at the originalsrcfiles. Plainnpm testworks the same as before. The new command needs Node 22.5 or later, because older versions don't support the exclude flags it uses.Coverage today:
src/, about 6,200 lines not counting type-only files. Node leaves these out of its report entirely. Counting them, real line coverage is about 59%.src/identity/wallet/page/) is compiled separately and isn't counted at all.Where the gaps are: mostly the interactive Ink flows and the effects that send transactions. The CLI entry point and router (
main.tsx,IdentityManager.tsx,Routes.tsx) are never loaded. The ENS edit flows, custody and transfer effects, agent reconciliation and restore apply/recovery sit at roughly 12–30%. These paths are live code that tests don't reach, not dead code, so nothing was removed because of the report. Logic like envelopes, sync, config and the network layer is mostly 80–100% covered.Verification
npm run typecheck: passes.npm test: 710 pass and 9 fail. Onmasterin the same container it is 723 pass and the same 9 fail. The 13 fewer passes are the 13 tests removed in this PR. The 9 failures are all color-styling tests inwrapSafetyand they fail identically onmaster.npm run test:coverage: gives the same results and prints the report.🤖 Generated with Claude Code
https://claude.ai/code/session_01GjuD2e7tgdWWdpmUMkcZcS