chore(ci): run the knip dead-code gate for the repository root and every workspace - #4942
Draft
orangeCatDeveloper wants to merge 1 commit into
Draft
chore(ci): run the knip dead-code gate for the repository root and every workspace#4942orangeCatDeveloper wants to merge 1 commit into
orangeCatDeveloper wants to merge 1 commit into
Conversation
6 tasks
orangeCatDeveloper
force-pushed
the
chore/knip-dead-code-gate
branch
5 times, most recently
from
September 8, 2026 19:36
60c9ec2 to
9580275
Compare
…pository root Extend knip.json to all nine previously-ungated workspaces (runtime, runtime-host, storage, core, mcp, computer-use, eval, cli, website) plus the repository root, and replace the eleven per-workspace Knip CI steps with a single plain 'npx knip' run - a strict superset that also covers the repository root and respects every workspace's project patterns. Workspace globs are deliberately avoided: -W 'packages/*' silently skips per-workspace project patterns (probe-verified). The step fails when a package.json workspace is missing from knip.json, and when a knip.json key no longer resolves to a declared workspace. Dynamic reachability is registered explicitly - spawn-loaded test fixtures, the filesystem worker bundle entry, the PowerShell-driven Windows IPC trust fixture, eval's Python-spawned harness entry, the dynamically dispatched computer-use command modules, and the two modules that actions/github-script loads from its with: script block (knip's github-actions plugin only reads run: steps) - so the scan doesn't guess. The website's entry surface is scoped to the Astro routes, the config and the executed scripts; components, layouts and copy modules stay in the project set and are judged by the real import graph (probe-verified). The root project glob excludes ambient declarations, which TS resolution consumes without an import statement. Remove what the scan surfaced and repo-wide greps confirmed unreachable: unused exports, types and helpers across runtime, runtime-host, storage, cli, core and the root scripts; the storage readHead registration plumbing that only fed the deleted readWorkspaceHeadInternal; and export aliases whose second name had no consumers. Kept deliberately: the decode/encode and PAGE/RANGE codec alias pairs whose both names have live consumers. Their aliases become distinct declarations (thin wrapper functions, an independently declared range bound asserted against the page bound in the protocol test) so the duplicates check resolves without exemption tags. The website keeps its exact cookie@2.0.1 pin as a declared exception: astro's prerenderer resolves it through the website root. Hoisted build/test tooling that root scripts import (electron, electron-builder, electron-updater, app-builder-lib, builder-util, @playwright/test, @babel/parser, ws) is declared in the root package.json instead of blanket-silenced, and the CI step asserts the two electron-builder internal-package pins track electron-builder's own requirement. The coverage and pin-parity guards live in scripts/check-knip-workspace-coverage.mjs with node --test coverage (single-level glob semantics on both sides, the stale-key regression case, pin parity including the absent-pin case) rather than as untested inline scripts. Known coverage boundary, surfaced by review: files listed in a package.json exports map are entry files, so their unused exports sit outside the default report (core exposes 147 of 266 source files this way, runtime 110 of 506, storage 55 of 249); --include-entry-exports surfaces ~250 public-API findings that need their own sweep with explicit keep decisions. No behaviour change. The knip duplicates finding on the three intentional protocol alias files (the encode/decode result-codec pairs and the PAGE/RANGE bound pair, kept as plain aliases by the cleanup PR) is accepted with a file-scoped ignoreIssues entry in the runtime-host workspace. The duplicates check stays meaningful elsewhere: probe-verified that an injected unused export in artifact.ts is still reported, and the full npx knip run is clean. Generated-by: Claude Code
orangeCatDeveloper
force-pushed
the
chore/knip-dead-code-gate
branch
from
September 8, 2026 20:07
9580275 to
3716a8b
Compare
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
The dead-code gate ran on two workspaces, so the other nine plus the repository root could accumulate unused files and exports unnoticed. A single plain
npx knipnow covers all eleven workspaces and the root in about two seconds — a strict superset of the two per-workspace steps it replaces.Making that run clean needed the dynamic reachability the scan cannot infer declared explicitly, rather than silenced: spawn-loaded test fixtures, the filesystem worker bundle entry, the PowerShell-driven Windows IPC trust fixture, the gated-recovery candidate
host-kernel.test.tsforks by argv path, eval's Python-spawned harness, the dynamically dispatched computer-use command modules, and the two modulesactions/github-scriptloads fromwith:blocks.packages/ui/scriptsjoins the project set, where a benchmark script had been sitting in the gate's blind zone.Two exceptions are declared rather than fixed.
runtime-hostaccepts theduplicatesfinding on three protocol alias files — probe-verified that an injected unused export inartifact.tsis still reported, so onlyduplicatesis silenced and only there.websitekeeps itscookiepin because astro's prerenderer resolves the bare specifier through the website root.A new gate fails the step when a workspace exists in
package.jsonbut not inknip.json, so a newly added workspace cannot enter the repo ungated, and a staleknip.jsonkey cannot sit there guarding nothing.Known boundary: files behind a package.json exports map are entry files, so their unused exports stay outside the default report (core exposes 147 of 266 source files this way, runtime 110 of 506).
--include-entry-exportssurfaces ~250 public-API findings that need their own sweep.Verification
AI use
Tool(s) and scope: Claude Code — the knip workspace configuration, the coverage gate, CI wiring, and this description.
Checklist
Generated-by: Claude CodeDoes this PR entail a change in behavior?