chore: rip out the stats feature (rebuild later) #556

Closed
opened 2026-04-29 22:54:11 +00:00 by claude-desktop · 1 comment
Collaborator

As an operator, I want the entire current stats surface removed from the codebase so that we can rebuild a clean version later without dragging the existing 2.2K LOC of debt forward.

The current stats stack is a mix of merged-in panels (stats + quota), client-side aggregation, and orphan tables. Rather than refactor it incrementally, we are deleting it wholesale and starting fresh in a follow-up milestone.

Acceptance criteria

Server

  • Delete apps/server/src/main.ts GET /stats route registration and handleStats() handler (~lines 1465–1473, 1880).
  • Delete apps/server/src/domain/analytics/task-analytics.ts (581 LOC).
  • Delete apps/server/src/domain/analytics/task-analytics.test.ts (653 LOC).
  • Delete apps/server/src/infrastructure/storage.ts::getStorageStats() if no other caller.
  • Leave task_history cost / token columns in the schema (no migration); they're re-usable when the rebuild lands.

Web

  • Delete apps/web/src/routes/stats.tsx and apps/web/src/routes/stats.test.tsx.
  • Delete apps/web/src/routes/usage.tsx (stats + quota merged into the same surface — both go).
  • Delete apps/web/src/components/stats/quota-panel.tsx and the components/stats/ folder if empty.
  • Delete apps/web/src/components/storage-strip.tsx and remove its callers.
  • Drop fetchStats, StatsResponse, StatsWindow from apps/web/src/lib/api.ts.
  • Drop the { to: "/stats", label: "Stats", testId: "nav-stats" } entry from apps/web/src/components/app-shell.tsx.
  • Regenerate the TanStack Router route tree.
  • Delete apps/web/e2e/stats-usage.spec.ts.

Docs

  • Strip /stats and /usage references from docs/api.md and docs/modules.md.
  • Add a one-line note in the changelog or PR body that stats is intentionally absent and will be rebuilt.

Verification

  • just qa passes (typecheck + lint + tests).
  • Service starts cleanly with no /stats 404 in logs from internal callers.
  • Hitting /stats in the web app surfaces a clean 404, not a stale layout.

Out of scope

  • The rebuild itself — separate milestone.
  • Schema cleanup (cost_usd, token columns on task_history) — keep, the rebuild will reuse them.
  • Stats retention / backfill jobs (none exist today; mentioned for completeness).

References

  • Survey scope: ~14 files, ~2.2K LOC.
  • Related feature folders: apps/server/src/domain/analytics/, apps/web/src/components/stats/, apps/web/src/routes/stats*, apps/web/src/routes/usage*.
As an operator, I want the entire current stats surface removed from the codebase so that we can rebuild a clean version later without dragging the existing 2.2K LOC of debt forward. The current stats stack is a mix of merged-in panels (stats + quota), client-side aggregation, and orphan tables. Rather than refactor it incrementally, we are deleting it wholesale and starting fresh in a follow-up milestone. ## Acceptance criteria ### Server - [ ] Delete `apps/server/src/main.ts` `GET /stats` route registration and `handleStats()` handler (~lines 1465–1473, 1880). - [ ] Delete `apps/server/src/domain/analytics/task-analytics.ts` (581 LOC). - [ ] Delete `apps/server/src/domain/analytics/task-analytics.test.ts` (653 LOC). - [ ] Delete `apps/server/src/infrastructure/storage.ts::getStorageStats()` if no other caller. - [ ] Leave `task_history` cost / token columns in the schema (no migration); they're re-usable when the rebuild lands. ### Web - [ ] Delete `apps/web/src/routes/stats.tsx` and `apps/web/src/routes/stats.test.tsx`. - [ ] Delete `apps/web/src/routes/usage.tsx` (stats + quota merged into the same surface — both go). - [ ] Delete `apps/web/src/components/stats/quota-panel.tsx` and the `components/stats/` folder if empty. - [ ] Delete `apps/web/src/components/storage-strip.tsx` and remove its callers. - [ ] Drop `fetchStats`, `StatsResponse`, `StatsWindow` from `apps/web/src/lib/api.ts`. - [ ] Drop the `{ to: "/stats", label: "Stats", testId: "nav-stats" }` entry from `apps/web/src/components/app-shell.tsx`. - [ ] Regenerate the TanStack Router route tree. - [ ] Delete `apps/web/e2e/stats-usage.spec.ts`. ### Docs - [ ] Strip `/stats` and `/usage` references from `docs/api.md` and `docs/modules.md`. - [ ] Add a one-line note in the changelog or PR body that stats is intentionally absent and will be rebuilt. ### Verification - [ ] `just qa` passes (typecheck + lint + tests). - [ ] Service starts cleanly with no `/stats` 404 in logs from internal callers. - [ ] Hitting `/stats` in the web app surfaces a clean 404, not a stale layout. ## Out of scope - The rebuild itself — separate milestone. - Schema cleanup (`cost_usd`, token columns on `task_history`) — keep, the rebuild will reuse them. - Stats retention / backfill jobs (none exist today; mentioned for completeness). ## References - Survey scope: ~14 files, ~2.2K LOC. - Related feature folders: `apps/server/src/domain/analytics/`, `apps/web/src/components/stats/`, `apps/web/src/routes/stats*`, `apps/web/src/routes/usage*`.
Author
Collaborator

Dispatch coordination

Parallel with #558. No blockers either way — minimal overlap (only apps/web/src/components/app-shell.tsx nav entries; trivial merge).

Routing: dev (deletion sweep, no architectural judgment calls).

Conflict points to watch:

  • apps/web/src/components/app-shell.tsx — drop the /stats nav entry. #557 will later rename Specs + PlannerWorkspace; #558 will add a mobile hamburger drawer. Different lines, mergeable.
  • apps/web/src/routeTree.gen.ts — auto-regenerated; expected to conflict on rebase, just regenerate.
  • apps/web/src/lib/api.tsfetchStats / StatsResponse / StatsWindow removal section is far from anything #557 will touch.

Independent of: #557 (specs/planner unification — different feature folders).

## Dispatch coordination **Parallel with #558.** No blockers either way — minimal overlap (only `apps/web/src/components/app-shell.tsx` nav entries; trivial merge). **Routing:** dev (deletion sweep, no architectural judgment calls). **Conflict points to watch:** - `apps/web/src/components/app-shell.tsx` — drop the `/stats` nav entry. #557 will later rename `Specs` + `Planner` → `Workspace`; #558 will add a mobile hamburger drawer. Different lines, mergeable. - `apps/web/src/routeTree.gen.ts` — auto-regenerated; expected to conflict on rebase, just regenerate. - `apps/web/src/lib/api.ts` — `fetchStats` / `StatsResponse` / `StatsWindow` removal section is far from anything #557 will touch. **Independent of:** #557 (specs/planner unification — different feature folders).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#556
No description provided.