Repository navigation
chore: remove dead code and configure knip for every workspace - #1658
Merged
joshunrau merged 16 commits intoOct 6, 2026
Merged
Conversation
Knip only covered apps/api and apps/web, and most of what it reported elsewhere was noise: web's vite config and the playwright config failed to load without .env, storybook's config dir, astro's docs content, the api's worker thread and test suites, the runtime config and the instrument build entries were all invisible to it. - Load .env and NODE_ENV in the knip script so every config loads. - Ignore vendor/ and report unused entry exports of every internal package; published packages keep their public surface. - Register the entry points knip's plugins cannot see, and mark the production ones with `!` so `knip --production` finds code that only tests reach. - Derive runtime/v1's ignored dependencies from runtime.config.js instead of listing them twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove the three routes that neither web, playground, the gateway, odc-cli nor the e2e suite calls: POST /v1/subjects, GET /v1/instrument-repos/:id and GET /v1/sessions/:id, with the service method only one of them used. Also remove service methods only their own tests reached (UsersService.deleteByUsername, InstrumentRecordsService.exists), the subjectId parameter of GatewayService.fetchRemoteAssignments no caller passes, the never-passed groupId query on GET /v1/instruments/list, the optional currentUser on the instrument service methods every caller already passes it to, the unused InstrumentKind and InstrumentInternal Prisma declarations, the unserved public/ directory, and exports used only in their own file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove the not-found middleware nothing registers, the subjectId filter on GET /api/assignments that the API stopped sending, the unused port parameter of BaseServer.listen, the raw-import esbuild plugin in the dev script and an unused ImportMeta augmentation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove the unreferenced 4.1 instrument example and InstrumentProperties component, translation keys and namespaces no page reads, props no caller passes (translationMode, meta author/keywords, the generated Feature id), the unread testimonial format field, and options of the typedoc plugin that its only configuration never sets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove translation keys no component reads, the zustand mock no test loads, the unused analytics config field, props production never passes (className on LanguageSelect and SectionCard, data-testid on TimepointTable, subject on the file record view, hideSubmitButton on UpdateUserForm), the string-key overload of useSearch, the disableRetry request flag nothing sets, environment guards that never fail in the browser, and exports used only in their own file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The experimental vim mode was a 9.6k-line port of CodeMirror's vim bindings whose status bar was never mounted, so its ex commands and search could not be entered. Remove the port, the editor wiring, the setting and its dialog field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove the ContextMenu, Command and Resizable parts that only stories render, an example file its instrument never imports, props and options no caller passes, an always-empty exclusion list, and schemas that were only ever used as types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- instrument-interpreter: drop the kind option no caller passes; validate against $AnyInstrument. - runtime-bundler: drop the verbose flag and array-of-configs form its only config never uses, and package.json checks that cannot fail after require.resolve succeeds. - instrument-bundler: drop the never-set logLevel option and a vitest alias pointing at a directory that does not exist. - runtime/v1: drop tsconfig globs and an eslint ignore that match no file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove schemas and types nothing imports, the default instances only the interpreter's removed kind check used, schemas only their own tests reached, and the unused /runtime/v1 tsconfig path. Schemas still used to compose others keep existing but are no longer exported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove SeriesInstrumentContent and ErrorFallback, which only tests and stories rendered, along with props, variants and branches production never uses (FileInstrumentContent onSuccess, ErrorBox's message form, Branding's sm and dark variants, optional ContentPlaceholder message and null summary items) and a duplicate barrel export. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DNP_STROOP_TASK was built but loaded by no instance, and could never complete because the task never called done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove the never-read source field of instrument stubs, the unused verbose field of serve-instrument's single-mode handler, a duplicate style build and a stale CLI banner shim from the build scripts, the number variant of encodeScopedSubjectId and the nullable data default of extractFieldLabel that only tests used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove the subject data table page object no spec reaches, page-object members no spec calls, pageModels entries no spec navigates to, and two unused route-param types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove the commented-out stories block and the /runtime/v1 tsconfig path nothing in storybook imports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing reads PROJECT_ROOT, and odc-cli's JwtPayload type was never used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove dependencies no workspace imports, catalog entries nothing references, scripts that cannot run (storybook in web and react-core, test:chrome, preview:core) or that nothing runs (inject and its turbo task), the Bun-only trustedDependencies, build permissions for packages no longer installed, and react-core's optional router peer and package.json export. Declare happy-dom in the three packages whose tests use it, which they had been resolving through hoisting. Co-Authored-By: Claude Opus 5.5 <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.
What changed
knip now covers the whole repo (
e6bfff708). Before,knip.tsconfigured two workspaces, and most of its output was noise: configs failed to load without.env, and the entry points of storybook, the outreach docs, the api's worker thread and test suites, the runtime and the instrument builds were all missing.pnpm knipnow loads.env, ignoresvendor/, reports unused exports of every internal package (published packages keep their public surface), and marks production entries with!soknip --productionfinds code only tests reach. On this branchpnpm knipreports nothing.Dead code removed, one commit per area (−14.4k lines, about 9.6k of them vim):
POST /v1/subjects,GET /v1/instrument-repos/:idandGET /v1/sessions/:id, the only routes no first-party client calls (web, playground, gateway, odc-cli and e2e all count as clients). Also service methods only their own tests reached, never-passed params, unused Prisma declarations (no data-bearing fields) and the unservedpublic/directory.DNP_STROOP_TASK. No instance loads it, and it never calleddone.PROJECT_ROOTvariable, and unused dependencies, catalog entries, scripts and build permissions.Kept on purpose:
now{ ability }param conventiononBackBack buttons, which are never wired; left for a follow-upvendor/and instrument-bundler's vendoredparse.tsWorth a look
enableVimModekey in IndexedDB. Nothing reads it.COPY public(the directory is gone) and the unreadGATEWAY_DATABASE_URL. CI only builds images on release.Found, not fixed
Open Data Capture - Open Data Capture.blog.titlewas meant for that slot, so I kept it.apps/playgroundimportsprettier,runtime-bundlerimportstypescriptandruntime-internal's tests usehappy-dom, none of them declared. playground-url importszodat runtime but only has it as a devDependency.knip --productionstill lists the kept test seams and a fewdependenciesthat belong indevDependencies.Verification
pnpm lintpasses.pnpm test:coverage: 381 files, 4309 tests, 100% on all four metrics.pnpm test:e2e: 277 passed.pnpm knip: exits 0 with nothing reported.This branch only removes code, so it adds no new unit or e2e tests. Tests that covered only the removed code were deleted with it.
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com