chore(ci): run the knip dead-code gate for the repository root and every workspace - #4942
Draft
orangeCatDeveloper wants to merge 2 commits into
Draft
chore(ci): run the knip dead-code gate for the repository root and every workspace#4942orangeCatDeveloper wants to merge 2 commits into
orangeCatDeveloper wants to merge 2 commits into
Conversation
6 tasks
orangeCatDeveloper
force-pushed
the
chore/knip-dead-code-gate
branch
2 times, most recently
from
September 7, 2026 02:13
a2a3e77 to
d7dc56a
Compare
Remove the dead code that the knip sweep across every workspace and the repository root surfaced, with each symbol verified consumer-free by a repo-wide grep spanning .ts, .tsx, .mjs, .ps1, .py and workflow files: - unused exported functions, types and helpers in runtime (context-budget-helpers, model-history's text-only projection subtree, agent-run-inspect, stream-graph-supervisor-tools, runtime-event-backfill, model-adapter, workspace-executor, compaction-boundary, memory-extraction-proposal, filesystem-authority, plugin-runtime's alias), runtime-host (agent-graph-coordinator, host-kernel, client-capability-coordinator's type re-export, peer-mesh), storage (workspace-version-authority-internal, a fixture's unused helper), cli (workspace-root's type re-exports, an unused wrapper, an unused union) and core (the computer-use action-type alias); - the storage readHead registration plumbing that only fed the deleted readWorkspaceHeadInternal (the live store method and its tests stay); - two dead root-script exports and two ambient .d.mts declarations that no module resolution reaches; - two project-catalog path-limit constants unexported, declared as a compatible extension at the current epoch (123, rebased onto main). Kept deliberately: the decode/encode and PAGE/RANGE codec alias pairs whose both names have live consumers stay as plain aliases so the page and range bounds and the wire contract remain true by construction. Their knip duplicates finding is handled by a scoped ignoreIssues exception for the three alias files in the follow-up gate PR instead of restructuring the declarations. The website keeps its exact cookie@2.0.1 pin: astro's prerenderer resolves it through the website root. The scan configuration that surfaced these (knip.json workspaces) and the CI wiring live in the follow-up gate PR; this PR is deletions only. No behaviour change. Generated-by: Claude Code
…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 7, 2026 11:05
d7dc56a to
c505149
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
Stacked on #4938 (the dead-code deletions); this draft carries the gate configuration and CI wiring. Until #4938 merges, the diff below shows both PRs combined; after it merges, this PR's delta is exactly
knip.json+ci.yml.knip.jsongains per-workspace configs forruntime,runtime-host,storage,core,mcp,computer-use,eval,cliandwebsite, plus the repository root (workspaces["."]). 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 fromwith:blocks (knip's github-actions plugin only readsrun:steps) — so the scan doesn't guess.so the scan doesn't guess. The
runtime-hostworkspace also carries a file-scopedignoreIssuesentry accepting the knipduplicatesfinding for the three intentional protocol alias files kept by chore(cleanup): drop verified dead exports and unused types #4938 (theencode/decoderesult-codec pairs and thePAGE/RANGEbound pair): probe-verified that with the exception an injected unused export inartifact.tsis still reported, so onlyduplicatesis silenced and only in those three files.ci.ymlreplaces the two existing per-workspace Knip steps with a single plainnpx knip: a strict superset that covers the root plus all 11 workspaces in ~2s and respects every workspace's project patterns. The step fails when a package.json workspace is missing from knip.json, so a newly added workspace cannot silently enter the repo ungated.websitekeeps its exactcookie@2.0.1pin declared as an ignored dependency: astro's prerenderer imports{ parseCookie } from 'cookie'and vite resolves the bare specifier through the website root, so the workspace pin decides which copy loads.electron,electron-builder,electron-updater,app-builder-lib,builder-util,@playwright/test,@babel/parser,ws) is declared in the root package.json with the versions the tree resolves — instead of blanket-silenced, so a hoisting change that would breakcheck:tui-copyor the packaging scripts surfaces as a knip finding.patch-packagestays the one silenced exception: apply-dependency-patches resolves it throughcreateRequireby design, so the gate cannot see that use.packages/ui/scriptsjoins the project set (a benchmark script sat in the gate's blind zone), and the two intentional exceptions are documented in the CI step itself so the reasons persist in-repo.--include-entry-exportssurfaces ~250 public-API findings that need their own sweep with explicit keep decisions.Verification
AI use
Tool(s) and scope: Claude Code — knip.json workspace configuration, the scan/verification loop (probe-tested coverage), CI wiring, and this description.
Checklist
Generated-by: Claude CodeDoes this PR entail a change in behavior?