refactor: prune the unused-export backlog knip recorded#556
Conversation
93 of the 94 export-level warnings resolved across 28 files: - 77 symbols un-exported: used inside their module only (settings-write -queue's retry internals, config-toml's TOML helpers, quota-headers' parsers, device-auth constants, repair-commands' usage/arg helpers, zod sub-schemas, fs-retry tuning constants, bench-format helpers, ...) — per lib/AGENTS.md, public API flows through lib/index.ts or the documented subpaths, and none of these are reachable from any entry. - Two stale compatibility re-exports trimmed (forecast-report-shared's isRetryableStorageWriteError, file-paths' getAccountsBackupPathAtIndex) plus the rotation.ts routing-mutex value re-export block whose three names every consumer now imports from routing-mutex directly. - Dead code deleted: createRuntimeEventHandler (an unused generic factory superseded by handleRuntimeEvent), the never-read DASHBOARD_DISPLAY_SETTINGS_VERSION, CODEX_HOST_BRIDGE_META and its interface (benchmark notes-as-code), the unused resetRuntimeObservabilitySnapshotForTests, and 11 unused fast-check arbitraries in test/property/helpers.ts. - PersistedSwitchReasonSchema stays exported on purpose: the const only feeds z.infer, and un-exporting it trips no-unused-vars (value used only as a type); the single remaining knip warning documents it. Verified: typecheck clean, eslint --max-warnings=0 on all 28 changed files, full vitest run 4531 passed / 58 failed — identical totals to the documented environment-only baseline on unmodified main. 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 19 minutes and 21 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 (29)
✨ 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 |
refactor: prune the unused-export backlog knip recorded
Summary
Clears the unused-export backlog that #555's knip config recorded as warnings: 93 of 94 resolved across 28 files (−165 net lines), with the one remaining warning kept deliberately and documented.
What was done, by category
settings-write-queue's retry internals (onlywithQueuedRetryis consumed externally),config-toml's six TOML helpers,quota-headers' parsers/formatters, the device-auth constants,repair-commands' usage/arg-parse helpers, nine zod sub-schemas,fs-retrytuning constants, the settings-hub option tables, bench-format helpers, and three property-test arbitraries. Perlib/AGENTS.md, public API flows throughlib/index.tsor the documented subpaths — none of these are reachable from any entry.forecast-report-shared'sisRetryableStorageWriteError(its "historical import surface" has no remaining importers; the trim then revealed the underlyingsave-retry.tsexport was also externally unused — un-exported too),file-paths'getAccountsBackupPathAtIndex, androtation.ts's routing-mutex value re-export block (every consumer importsrouting-mutex.jsdirectly; the type re-exports stay).createRuntimeEventHandler(an unused generic factory —index.tsand the test use onlyhandleRuntimeEvent), the never-readDASHBOARD_DISPLAY_SETTINGS_VERSION,CODEX_HOST_BRIDGE_META+ its interface (benchmark notes encoded as an unused constant), the unusedresetRuntimeObservabilitySnapshotForTests, and 11 unused fast-check arbitraries intest/property/helpers.ts.PersistedSwitchReasonSchemastays exported — the const exists solely to feedz.infer, and un-exporting it tripsno-unused-vars(value used only in a type position). The single remaining knip warning documents it.Validation
npm run typecheckcleannpx eslint <all 28 changed files> --max-warnings=0npx knip: export warnings 94 → 1 (the documented keeper); zero error-level findingsnpx vitest run: 4,531 passed / 58 failed / 6 skipped — identical totals to the documented environment-only baseline on unmodifiedmain(sandbox EACCES, IPv6::1, Windows-path sims)Risk / Rollback
No behavior changes — visibility reductions and deletions of unreferenced code only; the full-suite baseline parity is the gate. Revert the single commit.
https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
Generated by Claude Code
note: greptile review for oc-chatgpt-multi-auth. cite files like
lib/foo.ts:123. confirm regression tests + windows concurrency/token redaction coverage.Greptile Summary
visibility-only refactor clearing 93 of 94 knip unused-export warnings across 28 files: 77 symbols un-exported (now module-private), stale compatibility re-exports trimmed, and ~120 lines of dead code deleted. no behavioral changes — all public api still flows through
lib/index.tsor documented subpaths, and full-suite vitest parity with unmodifiedmainis confirmed.settings-write-queue,config-toml,quota-headers,device-auth,repair-commands,schemas,fs-retry, and bench-format helpers — none reachable from any package entry.createRuntimeEventHandlergeneric factory (~55 lines),DASHBOARD_DISPLAY_SETTINGS_VERSION,CODEX_HOST_BRIDGE_META+interface (benchmark notes as an unused constant),resetRuntimeObservabilitySnapshotForTests, and 11 fast-check arbitraries.isRetryableStorageWriteErrorfromforecast-report-shared,getAccountsBackupPathAtIndexfromfile-paths, and routing-mutex value re-exports fromrotation.ts— all confirmed import-less before removal.Confidence Score: 4/5
safe to merge — pure visibility reductions and dead-code deletions with no behavioral changes; the one rough edge is cosmetic.
every removed export was verified to have no remaining callers: routing-mutex consumers already import from routing-mutex.js directly, schema sub-schemas are only used as building blocks within schemas.ts, and the deleted functions (createRuntimeEventHandler, resetRuntimeObservabilitySnapshotForTests) have zero test or library references. the only loose end is test/property/helpers.ts, where arbTimestamp, arbMessageContent, and arbInputItem were un-exported but not deleted after their sole consumers were removed — they're inert dead declarations rather than a runtime risk.
test/property/helpers.ts — three dead private declarations (arbTimestamp, arbMessageContent, arbInputItem) should be deleted rather than left as unexported module-level noise.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[knip scan #555] -->|94 warnings| B{prune decision} B -->|77 symbols| C[un-export: make module-private] B -->|stale re-exports| D[trim compatibility surface] B -->|truly dead| E[delete dead code] B -->|1 keeper| F[PersistedSwitchReasonSchema\ndocumented knip exception] C --> C1[settings-write-queue internals] C --> C2[config-toml helpers] C --> C3[quota-headers parsers] C --> C4[device-auth constants] C --> C5[9 Zod sub-schemas] C --> C6[fs-retry tuning constants] C --> C7[bench-format helpers] D --> D1[isRetryableStorageWriteError\nforecast-report-shared → save-retry] D --> D2[getAccountsBackupPathAtIndex\nfile-paths → backup-paths direct] D --> D3[routing-mutex values\nrotation.ts → routing-mutex.js direct] E --> E1[createRuntimeEventHandler ~55 lines] E --> E2[DASHBOARD_DISPLAY_SETTINGS_VERSION] E --> E3[CODEX_HOST_BRIDGE_META + interface] E --> E4[resetRuntimeObservabilitySnapshotForTests] E --> E5[11 fast-check arbitraries]Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "refactor: prune the unused-export backlo..." | Re-trigger Greptile