refactor: prune the unused exported types knip recorded#557
Conversation
Completes the export backlog: all 58 type-level warnings resolved across 26 files. - 41 types/interfaces un-exported (used inside their module only): the settings-panel action unions, CLI option shapes, forecast and runtime-current-account unions, recovery's Stored*Part interfaces, first-run outcome types, ui theme shapes, and more. - Re-export shims trimmed: recovery.ts now re-exports only RecoveryErrorType (MessageInfo/MessageData/ResumeConfig stay as in-file imports), quota-headers.ts drops the unused CodexQuotaWindow passthrough, and rotation.ts loses its routing-mutex type re-export block — nothing imports those names from rotation anymore. - Dead type declarations deleted: ErrorCodeType, recovery's ThinkingPartType/MetaPartType/ContentPartType aliases and the ToolUsePart interface, and nine z.infer one-liner *FromSchema aliases in schemas.ts whose consumers all use the storage/public-types definitions instead. - The nine AuditAction enum members stay: they are the forward-looking audit-event taxonomy, not dead code; knip's enumMembers rule is already warn-level. Verified: typecheck clean (the gate for type-only changes), eslint --max-warnings=0 on all changed files, knip type warnings 58 -> 0, and the rotation/recovery/forecast/schemas/errors suites all pass (321/321) covering every trimmed runtime re-export. 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 33 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 (28)
✨ 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 exported types knip recorded
Summary
Completes the knip backlog: after #556 cleared the value-level export warnings, this clears all 58 type-level warnings across 26 files (−48 net lines). The only remaining knip warnings on the whole tree are the one documented keeper from #556 and the nine
AuditActionenum members kept on purpose here.What was done
UninstallCliOptions,DoctorCliOptions, …), forecast and runtime-current-account unions, recovery'sStored*Partinterfaces, first-run outcome types, ui theme shapes, and more. Perlib/AGENTS.md, none are reachable from any entry, so they were never public API.recovery.tsnow re-exports onlyRecoveryErrorType(MessageInfo/MessageData/ResumeConfigremain as in-file imports — the first classification pass missed their deeper usages, which typecheck caught and corrected),quota-headers.tsdrops the unusedCodexQuotaWindowpassthrough, androtation.tsloses its routing-mutex type re-export block entirely — every consumer imports those types fromrouting-mutex.jsdirectly.ErrorCodeType, recovery'sThinkingPartType/MetaPartType/ContentPartTypealiases plus theToolUsePartinterface, and ninez.inferone-liner*FromSchemaaliases inschemas.tswhose consumers all use thestorage/public-typesdefinitions instead.AuditActionenum members — they're the forward-looking audit-event taxonomy (the vocabulary of events the audit log is designed to carry), not dead code. knip'senumMembersrule is warn-level, so they stay visible without blocking.Validation
npm run typecheckclean — the primary gate for type-only changesnpx eslint <all changed files> --max-warnings=0npx knip: type warnings 58 → 0Risk / Rollback
Type-only visibility changes plus deletions of unreferenced declarations; zero emitted-code impact. 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
clears the remaining 58 type-level knip warnings across 26 files by un-exporting module-internal types, deleting dead type aliases, and trimming re-export shims — zero emitted-code impact and typecheck is clean throughout.
rotation.tsdrops its routing-mutex re-export block entirely since every consumer already imports directly fromrouting-mutex.js.z.infer*FromSchemaone-liners inschemas.ts,ErrorCodeTypeinerrors.ts, and theThinkingPartType/MetaPartType/ContentPartType/ToolUsePartaliases inrecovery/types.ts— all confirmed unreferenced by typecheck.OcChatgptAccountRef(now private) is referenced in five fields of the exportedOcChatgptMergePreviewandOcChatgptPreviewPayload, andDashboardLayoutMode/DashboardFocusStyle(now private) appear in the exportedDashboardDisplaySettingsinterface — consumers lose the ability to name these types explicitly.Confidence Score: 4/5
safe to merge — all changes are type-visibility only with zero emitted-code impact, typecheck is clean, and the 321-test suite covers the touched runtime paths.
two files — oc-chatgpt-import-adapter.ts and dashboard-settings.ts — now export shapes whose member types can no longer be named by consumers; this quietly narrows the public api surface in a way knip won't catch going forward, but it doesn't break any existing consumer since typecheck passed.
lib/oc-chatgpt-import-adapter.ts and lib/dashboard-settings.ts — both expose unexported types through their exported shapes, which may trip up future consumers of the import/merge api or settings serialization layer.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD subgraph public["Public Exports (still exported)"] MPP["OcChatgptPreviewPayload"] MMP["OcChatgptMergePreview"] DDS["DashboardDisplaySettings"] TDR["OcChatgptTargetDetectionResult"] end subgraph pruned["Now Module-Private"] AR["OcChatgptAccountRef ⚠️"] LM["DashboardLayoutMode ⚠️"] FS["DashboardFocusStyle ⚠️"] TF["OcChatgptTargetFound"] STP["StoredToolPart / StoredReasoningPart"] CLI["CliOptions shapes"] end subgraph deleted["Deleted Entirely"] ECT["ErrorCodeType"] TPT["ThinkingPartType / MetaPartType"] FSC["9x FromSchema aliases"] end MPP -->|"accounts field"| AR MMP -->|"toAdd / toUpdate / toSkip"| AR DDS -->|"menuLayoutMode"| LM DDS -->|"menuFocusStyle"| FS TDR -->|"union member"| TFComments Outside Diff (1)
lib/oc-chatgpt-import-adapter.ts, line 1 (link)the pr's validation matrix lists rotation/recovery/forecast/schemas/errors suites (321/321), but
oc-chatgpt-import-adapter.tsandoc-chatgpt-target-detection.tsaren't mentioned. both files had exports visibility-changed and the import-adapter hosts the merge/dedup logic that touches rawrefreshTokenvalues — worth confirming a vitest suite coversbuildOcChatgptImportPayloadandpreviewOcChatgptImportMergeso regressions in token-handling paths don't go undetected.Prompt To Fix With AI
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "refactor: prune the unused exported type..." | Re-trigger Greptile