ci(deadcode): replace broken export report lanes with enforced knip exports ratchet#105595
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f85715bf1d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pnpm deadcode:dependencies | ||
| pnpm deadcode:unused-files | ||
| pnpm deadcode:report:ci:ts-unused | ||
| pnpm deadcode:exports |
There was a problem hiding this comment.
Gate the export check on the new script
For workflow_dispatch compatibility runs that validate an older target_ref, this job checks out the target SHA but executes the current workflow body. Older release tags before this change already have deadcode:dependencies, so the condition on line 1600 takes this branch, but they do not have the newly added deadcode:exports script (the parent package had deadcode:dependencies/deadcode:unused-files but no deadcode:exports). That makes historical or release-candidate validation fail in check-dependencies with a missing script; guard this command on deadcode:exports being present or skip it when HISTORICAL_TARGET is true.
Useful? React with 👍 / 👎.
f85715b to
5849285
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 12, 2026, 2:33 PM ET / 18:33 UTC. Summary PR surface: Tests +101, Docs 0, Config -12, Other +6276. Total +6365 across 9 files. Reproducibility: yes. The exact workflow path can check out an older target, recognize its existing dependency script, and then call the absent new export script. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Keep the shared Knip ratchet, but gate the export command on the checked-out target defining it or on non-historical mode, add focused workflow-guard coverage, and regenerate the baseline against the final merge base. Do we have a high-confidence way to reproduce the issue? Yes. The exact workflow path can check out an older target, recognize its existing dependency script, and then call the absent new export script. Is this the best way to solve the issue? No in the current head. Reusing pinned Knip and the existing ratchet pattern is the best architecture, but the workflow integration must preserve historical-target compatibility and final-base consistency. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 26c418729714. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Tests +101, Docs 0, Config -12, Other +6276. Total +6365 across 9 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Merged via squash.
|
What Problem This Solves
OpenClaw currently has zero working symbol-level dead-code detection. The CI
check-dependenciesshard's advisory unused-exports lane (pnpm deadcode:ts-unused) has been silently crashing:pnpm dlx ts-unused-exportsresolves the incompatible[email protected]peer and dies on startup, and the|| truepiping means thedeadcode-reportsartifact is just a stack trace.deadcode:ts-prunerelies on the archivedts-prune. Meanwhile a knip production scan with--include exports,types,enumMembersfinds ~1,506 unused exports and ~1,053 unused exported types onmain.Fixes #105575.
Why This Change Was Made
Knip is already the repo's pinned, configured dead-code scanner and already enforces unused files (allowlist ratchet in
scripts/check-deadcode-unused-files.mjs) and unused dependencies. Extending that same enforced-ratchet pattern to unused exports replaces two dead third-party tools with the tool the repo already trusts, and stops new dead exports from landing while the existing backlog is burned down.User Impact
None at runtime — CI/tooling only. For contributors: PRs that add new unused exports (or leave stale baseline entries behind after deleting code) now fail the
check-dependenciesshard with an actionable message;pnpm deadcode:exports:updateregenerates the baseline after legitimate deletions.Evidence
deadcode-reportsartifact from main CI run 29202053366: ts-unused-exports startup crash, no report.e8f8738aae7:Unused exports (1506),Unused exported types (1053).test/scripts/check-deadcode-exports.test.ts,test/scripts/check-deadcode-unused-files.test.ts(output in PR checks / validation section below).Validation on this head:
node scripts/run-vitest.mjs test/scripts/check-deadcode-exports.test.ts test/scripts/check-deadcode-unused-files.test.ts— 2 shards, 22 tests passed.pnpm deadcode:exports—[deadcode] Knip unused-export baseline matched 6031 entries.(exit 0)pnpm deadcode:unused-files— allowlist matched, exit 0.node scripts/run-oxlint.mjs+ oxfmt format check on changed scripts — clean;actionlint .github/workflows/ci.yml— clean.--update) fixed + regression-tested; remaining rerun finding was a bundle artifact (baseline committed separately for the 180k bundle cap) and is disproven by the live check above.