chore(usage): remove unused fetchUsage()#327
Conversation
fetchUsage() did a pre-flight GET /usage against cryptify but was never called anywhere — a tree-wide search finds only the definition. The live usage path from #110 was never wired into the UI; the app relies on the server 413 backstop (parseLimitExceededBody) plus the browser-local estimate in localUsage.ts. Removing it leaves FILEHOST_URL unused in usage.ts, so drop it from the import (ROLLING_LIMIT stays). classifyUsage, UsageResponse and UsageStatus stay — still reachable via parseLimitExceededBody. Also refresh the stale CLAUDE.md note that described the never-built UsageWarning/fetchUsage path. Closes #323 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
VERDICT: approve
Rules + review sign-off, cycle 1. No blocking findings.
Checked against main: fetchUsage has no callers (only its definition), and FILEHOST_URL stays in use elsewhere through its own imports, so dropping it from the usage.ts import line is safe. classifyUsage, UsageResponse and UsageStatus remain reachable through parseLimitExceededBody. The CLAUDE.md note now matches the tree. CI is green across the board, the title passes the Conventional Commit check, a reviewer is assigned, and Closes #323 is registered as a closing reference.
One rule-check candidate (PR body length vs the no-justification-paragraphs rule) was dismissed: issue #323 explicitly asked for a product call between removing and wiring up the function, so the body documenting why removal is safe is warranted here.
Removes
fetchUsage()fromsrc/lib/usage.ts. It performed a pre-flightGET /usage?email=...against the cryptify backend but was never called — a tree-wide search finds only its definition. The live usage query was added in #110 (2026-04-23) and never wired into the UI; sender quotas are enforced by the server 413 backstop (parseLimitExceededBody) plus the browser-local estimate insrc/lib/localUsage.ts.fetchUsage().FILEHOST_URLfrom theusage.tsimport (ROLLING_LIMITstays).classifyUsage,UsageResponseandUsageStatusare untouched — still reachable throughparseLimitExceededBody.CLAUDE.mdnote that described the never-builtUsageWarning/fetchUsagepath so the doc matches the tree.No behavioural test applies: this only removes unreferenced code, and
svelte-checkwould fail if anything still referenced the symbol. Verified locally withnpm run check,npm run lint,npm run test:unit, andnpm run build— all pass. Same pattern as the recently merged #326 (removing unusedGetBrowserInfo()).Closes #323