Repository navigation
chore(deadcode): delete unused exports and model live Knip entrypoints - #204043
Conversation
- Drop or delete exports with no consumer outside their file. - Model the release-update scenario and manual release-approval suite as Knip entries. Co-authored-by: obviyus <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: needs changes before merge. What this changesThis PR removes unused exports and helpers and declares dynamically invoked files as Knip entrypoints. Example: Audit the release-update Docker scenario with pnpm deadcode:report.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 10 items remain Keep this PR open: the cleanup is useful, but six export removals break existing production types or tests. Priority: P2 Before merge
Findings
Provenance
Agent review detailsHow this fits togetherKnip audits the repository import graph; its configuration must represent executable entrypoints while preserving exports consumed by production code and tests. flowchart LR
A[Shell and documented commands] --> B[Knip entrypoints]
C[Production imports] --> D[Export consumers]
E[Test imports] --> D
B --> F[Knip reports]
D --> F
Technical reviewBest possible solution: Keep the exact Knip entrypoints and genuine deletions while preserving live exports or migrating all their consumers together. Do we have a high-confidence way to reproduce the issue? Existing consumers establish the missing-export paths, and exact-head CI confirms the CronProviderRunSlot, cookie-authorizer, and cron-reset failures; no target code was executed locally. Is this the best way to solve the issue? Exact entrypoint modeling and genuine dead-code removal are appropriate, but passing Knip cannot justify deleting exports that existing consumers still require. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0174cf4d0083. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource -9, Tests -132, Other +8. Total -133 across 30 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 23, 2026, 6:18 AM ET / 11:18 UTC. |
- Restore exports that focused tests or import() type queries consume; list them in Knip ignoreIssues. - Drop declarations for exports removed from .mjs modules. Co-authored-by: obviyus <[email protected]>
- docker-e2e-watchdog.test.ts imports parseTimeoutMs by file URL; declare that seam in Knip. Co-authored-by: obviyus <[email protected]>
|
Maintainer override: the remaining reds on head 8b38391 are not caused by this PR.
|
openclaw#204043) The `check-dependencies` Knip reports pass again: unused exports are removed and five live files get their real entrypoints. Part of openclaw#204008. Refs openclaw#198611. ## Problem `check-dependencies` fails in every scheduled `main` run (latest: 45147591436). The three Knip reports listed: - **Unused files (5):** `scripts/e2e/lib/upgrade-survivor/{registry-tls,release-fixture,release-update}.mjs` (added by openclaw#203966 today) and `test/manual-release-approval.{checks,config}.ts` (added by openclaw#201080). These are live: `upgrade-survivor-docker.sh` runs `release-update.mjs` by path, which imports the other two, and `docs/reference/fast-track-release-approval.md` runs the manual-only Vitest config by path. Knip could not see either entrypoint. - **Unused exports (~45):** exports whose last consumer moved or that never had one outside their own file. ## Solution - Knip config: add `release-update.mjs` and the two manual approval files as entries; the manual checks suite is also a consumer in the scripts-export pass. Add `openssl` to `ignoreBinaries` (the release-update scenario mints its registry certificate with it). - Exports used only in their own file: drop `export` (and the matching `.d.mts` declarations). - Exports consumed only by focused tests (`resetCronProviderBackoff`, `authorizeControlUiPluginCookieRequest`, the lean post-ready bounds, `TRIAL_BUDGET_MS`) stay exported and are listed in the production config's existing test-only `ignoreIssues` block. `CronProviderRunSlot` is used through `import(...)` type queries that Knip does not follow; both configs ignore its type export. - Exports and test-support helpers with no use at all: delete them (`spawnGatewayInstance`, `buildManagedServiceHandoffUnavailableMessage`, `mockGitInstallSurface`, `managedGateway`, `shape`, `recorded`/`settled`, `devTargetRefusalCases`, `expectUpdateFailureReport`, `expectDelegatedPluginDoctorInput`, `ValidatedFastTrackReference`, `panelTabStripCss`) and the imports and re-exports that only they used. - Two tests that imported a removed export now go through the real path: the `openclaw id unlink` warning test checks the warning that `runUnlink` prints, and the tab-strip browser test loads `panel-tab-strip.css?inline` directly. No runtime behavior changes. ## Evidence - `pnpm deadcode:report` on `main` bc8f08f: fails (script, production and full-tree reports; same list as CI). - Same command on this branch: script, production and full-tree reports pass. - `src/cli/id-cli-unlink.test.ts`: 5/5 pass. `tsgo:core`, `tsgo:scripts`, `tsgo:ui`, `tsgo:core:test`, `tsgo:test:root`, `tsgo:test:ui` pass. oxlint and oxfmt clean on changed files. Co-authored-by: Ayaan Zaidi <[email protected]>
…ate acts on it (#201668) * fix(update): verify recorded data-at-risk marks before repair acts on them * fix(update): verify any unverified data-at-risk mark and honor receipts in handoff recovery * fix(update): recognize a Git release-mode service as its checkout's own * fix(update): check a recorded data-at-risk mark before the next update, including already-current runs * fix(update): lead data-at-risk refusals with triage and record them on the refused run * fix(update): keep data-at-risk refusals within the recorded warning limit * test(e2e): finish the seeded data-at-risk run with a terminal phase * fix(update): name the agent route in killed-update recovery refusals * fix(update): drop an unused import * test(update): expect the agent route in killed-update refusals * fix(update): verify the newest mark before restoration without comparing run ids * fix(update): address review: keep the Gateway down on any inconsistent mark, resolve all marks, harden release ownership * fix(update): break the admission-root import cycle and type the e2e schema read * fix(update): address rating findings: agent rollback leftovers, helper restart, blocking findings first, shared Git metadata * test(e2e): prove the next plain update resolves a mark with the Gateway running * fix(update): address rating round 2: refuse marks before Doctor, registry-based rollback check, handoff fallback, async history read * test(update): pick the repair run, not a settlement row, in the data-at-risk cell * fix(update): resolve live-writer marks after Doctor holds the state * fix(doctor): say a skipped stale-Gateway stop left the PID running * fix(update): address rating round 3: leftovers before deferrals, retained rollback files, refusal after Doctor fails finalization * docs(update): note retained rollback files and refusals after Doctor * fix(doctor): say a stale Gateway stop could not be confirmed when nothing shows it running * fix(update): address landing review: revert release-mode ownership, check leftovers first, handoff entry guard, durable rollback evidence * test(update): follow main's Git release link layout in the launcher refusal test * fix(update): treat uninspectable leftovers and unreadable databases as unchecked; true wording after Doctor Release adaptation: Retain the stable installed-recovery harness. Do not add main's installed Docker service cell, later retired by #203808, or Git release-launcher wording/test because stable uses the in-place Git updater. Keep the state-verification, next-update, repair and interrupted-handoff paths and their compatible regressions. Companion audit: #203486 is present-equivalent at 3081077 (preserved). #201978 is selected next in this lane. #203808 and #203966 involve the inapplicable installed service-cell layout; #203497 and #203194 change main's package/Git activation layout and are not applicable; #204017 depends on that release-install layout. #204077, #204043, #203555 and #203520 are independent authority, cleanup, helper-fixture and config-validation changes. #204151, #203917, #203849 and #203406 are separate guidance, cleanup or status changes, not required by the data-risk verifier. #203569 fixes a separate cron receipt fixture in the same Doctor suite; the touched stale-stop cases do not depend on it. (cherry picked from commit a28f211) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit f8d4bc138ed2512c413cf96f66fe0eefb3b28d65)
The
check-dependenciesKnip reports pass again: unused exports are removed and five live files get their real entrypoints.Part of #204008. Refs #198611.
Problem
check-dependenciesfails in every scheduledmainrun (latest: 45147591436). The three Knip reports listed:scripts/e2e/lib/upgrade-survivor/{registry-tls,release-fixture,release-update}.mjs(added by test(e2e): run a T to T+1 upgrade-survivor scenario through update.run #203966 today) andtest/manual-release-approval.{checks,config}.ts(added by feat(release): release fast-track system #201080). These are live:upgrade-survivor-docker.shrunsrelease-update.mjsby path, which imports the other two, anddocs/reference/fast-track-release-approval.mdruns the manual-only Vitest config by path. Knip could not see either entrypoint.Solution
release-update.mjsand the two manual approval files as entries; the manual checks suite is also a consumer in the scripts-export pass. AddopenssltoignoreBinaries(the release-update scenario mints its registry certificate with it).export(and the matching.d.mtsdeclarations).resetCronProviderBackoff,authorizeControlUiPluginCookieRequest, the lean post-ready bounds,TRIAL_BUDGET_MS) stay exported and are listed in the production config's existing test-onlyignoreIssuesblock.CronProviderRunSlotis used throughimport(...)type queries that Knip does not follow; both configs ignore its type export.spawnGatewayInstance,buildManagedServiceHandoffUnavailableMessage,mockGitInstallSurface,managedGateway,shape,recorded/settled,devTargetRefusalCases,expectUpdateFailureReport,expectDelegatedPluginDoctorInput,ValidatedFastTrackReference,panelTabStripCss) and the imports and re-exports that only they used.openclaw id unlinkwarning test checks the warning thatrunUnlinkprints, and the tab-strip browser test loadspanel-tab-strip.css?inlinedirectly.No runtime behavior changes.
Evidence
pnpm deadcode:reportonmain6963e4f: fails (script, production and full-tree reports; same list as CI).src/cli/id-cli-unlink.test.ts: 5/5 pass.tsgo:core,tsgo:scripts,tsgo:ui,tsgo:core:test,tsgo:test:root,tsgo:test:uipass. oxlint and oxfmt clean on changed files.