Skip to content

chore(gate): drive the dead-export guard with knip, drop ts-prune - #1427

Merged
TheGreatAxios merged 4 commits into
mainfrom
cl-10655-replace-abandoned-ts-prune-with-knip-in-dead-export
Oct 15, 2026
Merged

TheGreatAxios merged 4 commits into
mainfrom
cl-10655-replace-abandoned-ts-prune-with-knip-in-dead-export

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • Replaces abandoned ts-prune 0.10.3 (+ its ts-morph@13 dependency tree) with maintained knip 6.41.0 in the dead-export gate. The guard now unions two scans: knip's default scan (ts-prune parity scope) and a --production scan over the ten agents/<id> workspaces (knip.agents.json) — --production ignores test-file consumers, which restores enforcement of the director-extract bar's six-name surface that the default scan alone lost (workspace package tests count as consumers there).
  • Coverage equal-or-better, documented: 42 ts-prune-only findings were parser artifacts (satisfies/boolean/Record narrowing junk, unresolvable alias fan-in); knip adds 7 unreachable whole files and 22 named consumer-less exports/types, all allowlisted with per-name owner-reason blocks — deleting them belongs to the cleanup lanes, not this gate swap. Allowlist 70 → 83 (42 superseded, 55 added incl. 29 director-surface names with an explicit test-laundering disclosure).
  • Guard internals: parses knip's pinned-JSON report fail-closed (shape deviation → fail, not pass), no config-carried spawn args (the old tsPruneArgs injection vector is gone), coverage floor kept, live parity tests pin both scans' semantics (38 tests), a real-subprocess negative test proves the fail path.
  • zod 4.5.4 → 4.6.7 floats in via knip's peer range (root only; nested consumers keep 4.5.4; zero first-party imports).

Verification

  • bun run check exit 0: lint/typecheck/build/projects-dir guard green; guarded suite 8945 pass / 0 fail; guard output deterministic across runs: 361 consumer-less exports or unreachable files, 361 allowlisted, 0 violations, 1323 scanned files (floor 1240).
  • Publication gate: the eight dead-export gate tests include an end-to-end failure probe (new dead export → exit 1 with the finding named) and a live-knip parity test (in-module-only usage not reported; director consumed via DIRECTOR_REGISTRY not reported; the production pass resurfaces tools/systemPrompt/config for workspace packages).
  • Test-laundering disclosure landed with the 29 worker-name entries: input via agents/<id>/src/index.ts is consumed only by that package's contract test — the AGENTS.md production-importer bar is surfaced by the gate again.

Fixes CL-10655

ts-prune has been unmaintained since 2022 and pulls ts-morph@13 plus a
hand-rolled output parser that false-positived on satisfies/boolean/
Record narrowing and could not resolve path-alias fan-in. The guard
unions knip's default scan with a production agent-workspace scan
(knip.agents.json; --production ignores test-file consumers so the
director surface stays enforced); parsing is fail-closed and config
carries no spawn args, so the tsPruneArgs race is gone.

Allowlist semantics are unchanged. Entries go 70 to 83: 42 superseded
ts-prune artifacts removed; tax entries added for 22 consumer-less
exports plus 4 unreachable files (owner-reason blocks, pending cleanup
lanes) and the 29 director-surface names consumed only by workspace
package tests. Deleting them belongs to the cleanup lanes.
@linear-code

linear-code Bot commented Oct 14, 2026

Copy link
Copy Markdown

CL-10655

@corbits-triage

corbits-triage Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Superseded by the comment below.

@corbits-triage

corbits-triage Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Superseded by the comment below.

@corbits-triage

corbits-triage Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Triage: Fail

@TheGreatAxios, please address the following:

  • pull request is over the files limit: 27 files (max 25)

@TheGreatAxios
TheGreatAxios changed the base branch from cl-10652-arktype-228-generate-inputschema-via-tojsonschema-delete-ha to main October 15, 2026 20:07
…doned-ts-prune-with-knip-in-dead-export

# Conflicts:
#	bun.lock
The allowlist now names only the agent-package contract. Exports with no production importer are removed, and vendor plus path-loaded eval fixtures stay outside the knip scan.
Discover agent packages from agents/ instead of the allowlist, so a new package whose entry is imported only by its own test fails the dead-export guard.
@TheGreatAxios
TheGreatAxios merged commit 638a826 into main Oct 15, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant