refactor(lib): delete seven orphaned modules (852 dead lines) - #554
Conversation
A knip pass followed by hand verification (zero importers across lib/, scripts/, test/, index.ts; no facade re-exports; no package.json subpath or bin references; no dynamic imports) found six fully dead modules: - lib/codex-manager/forecast-report-commands.ts (625 lines) — orphaned by the command-registry extraction; forecast-report-shared.ts and the registry replaced it - lib/storage/restore.ts (71) — superseded by storage/backup-restore.ts - lib/runtime/oauth-browser-flow.ts (55) - lib/runtime/account-health-check.ts (43) - lib/codex-manager/statusline-order.ts (19) - lib/recovery/index.ts (12) — unused barrel; not a package subpath (unlike auth/, request/, codex-cli/ whose index files back exports) Deliberately kept: lib/ui/index.ts (the barrel added on purpose by the ui-cohesion refactor as intended surface) and scripts/install-codex-auth.js (dev tooling with its own test suite). Verified: typecheck clean; storage + rotation-proxy + manager-cli suites show failure lists identical to unmodified main (the 25 known environment-baseline failures only, byte-identical test names). https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Warning Review limit reached
More reviews will be available in 14 minutes and 50 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Found by the knip config follow-up: lib/runtime/session-affinity.ts (26 lines, ensureRuntimeSessionAffinity) has zero importers — superseded by runtime/session-affinity-entry.ts. It is distinct from the very-alive lib/session-affinity.ts, which the first sweep's basename grep conflated it with. Typecheck clean; both session-affinity suites pass (17/17). https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
|
Both review findings dispositioned:
Generated by Claude Code |
Summary
Deletes seven fully orphaned modules — 852 dead lines — found by a
knippass and then verified by hand, since raw knip output here has known false positives (it flagslib/index.tsitself because the repo has no knip config for the package entry/subpath exports). Each deletion was confirmed to have zero importers acrosslib/,scripts/,test/, andindex.ts, no facade re-exports, nopackage.jsonsubpath/bin references, and no dynamic imports. Also drops the now-staleruntime/session-affinity.tsrow from thelib/AGENTS.mdstructure tree.This PR absorbed #559-wave duplicate #578 (closed): that PR had independently re-verified five of these files and contributed the
lib/AGENTS.mdfix.Deleted
lib/codex-manager/forecast-report-commands.tsforecast-report-shared.ts+ the registry replaced itlib/storage/restore.tsstorage/backup-restore.ts(restoreAccountsFromBackupPathis whatlib/storage.tsactually uses)lib/runtime/oauth-browser-flow.tsbrowser-oauth-flow.ts/manual-oauth-flow.tslib/runtime/account-health-check.tsindex.tswiresclampActiveIndicesfrom elsewhere, never this copylib/runtime/session-affinity.tsensureRuntimeSessionAffinityhas no callers; rotation constructsSessionAffinityStoredirectlylib/codex-manager/statusline-order.tsreorderStatuslineFieldinsettings-panels.ts(the live, tested copy)lib/recovery/index.tsauth/,request/,codex-cli/, recovery has no package subpath export backed by an index fileDeliberately kept
lib/recovery/{constants,types,storage}.ts— not orphaned despite the barrel deletion: the root facadelib/recovery.ts(used bylib/runtime/session-recovery.ts) importsrecovery/storage.jsandrecovery/types.jsdirectly, andrecovery/constants.tshas a dedicated suite (test/recovery-constants.test.ts). Only the barrel was dead.lib/ui/index.ts— knip flags it, but it's the barrel added on purpose by the merged ui-cohesion refactor as intended surface.scripts/install-codex-auth.js— dev tooling with its own dedicated test suite (test/install-codex-auth.test.ts).Validation
npm run typecheckclean (the strongest guarantee for pure deletions — any remaining static reference would fail), re-run after each of the three commitsstorage,runtime-rotation-proxy,codex-manager-cli): failure lists byte-identical to unmodifiedmain(the known environment-baseline failures — sandbox EACCES + IPv6::1— same test names both sides; 201/201 on the CLI suite)Risk / Rollback
Pure deletions of unreferenced files plus one doc line; revert the commits restores them.
https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB