refactor: retire core leftovers the plugins replaced #26

Closed
gabrielvidal wants to merge 0 commits from retire-dead-leftovers into main
pull from: retire-dead-leftovers
Owner

Summary

This removes core code that the plugins have replaced and that nothing calls any more. It covers the "a" items and the approved route and provider-copy items from the retire-legacy audit (form retire-legacy-built-in-tools-decisions_wmmg1t, 2026-11-27). I checked every deletion with git grep in this repo and in ai-agent-plugins. Anything still imported stays.

Key changes

Dead frontend

  • Deleted business/dashboards/components/DashboardFilters.tsx, ConversationsDashboard.tsx and lib/costAnalysis.ts. Also deleted the tests of costAnalysis in lib/pricing.test.ts and lib/localEnergy.test.ts.
  • lib/analytics.ts keeps only what has callers: billingMonths and subscriptionPaid (Plan & cost), convTime, modelFamily, MODEL_COLORS and MODEL_COLOR_FALLBACK. Removed: date ranges, activity buckets, histogram, stats helpers and fmtDuration.
  • lib/footprint.ts: removed conversationFootprint. FootprintUsage is no longer exported. guestStats.test.ts now builds its expected value from estimateFootprint + localFootprint.
  • lib/pricing.ts: removed costByType, hasOwnTokenRow and UsageLike. Only costAnalysis used them.
  • api.ts: removed the orphan doc comment.
  • Mocks:
    • mock/perf.ts now serves only /api/perf/conversation/<sid> and /calls, which PerfCard reads. The live, history, conversations, commands, settings, kill, keep and series handlers are gone.
    • mock/perfStorage.ts now serves only /conversation/<sid>/storage, which StorageCard reads.
    • mock/telemetry.ts keeps only the beacon. Hub and usage are gone.
    • The handlers for /api/usage/daily, /api/usage/history and /api/usage/calibration are gone, and so are usageHistory and usageCalibration in mock/usage.ts.
  • i18n/fr: removed the 22 strings that only the deleted code used. The i18n test requires this.

Dead backend

  • conversations/look.py parse_action and its test. The conversation-labels plugin has its own.
  • users/store.py UsersStore.emails(). It had no caller.

Unused routes

  • Removed GET /api/usage/daily, GET /api/usage/history, GET /api/usage/calibration, GET /api/telemetry/usage, GET /api/goals and POST /api/goal-work.
  • The plugin bridges still call the underlying functions: daily_usage, calibrate.history, telemetry.views.usage, goals_list, goal_work and GoalWorkBody.
  • goals/routes.py no longer has a router, so it is no longer included in main.py.
  • Updated authz/routes.py and authz/matrix.golden.txt (6 rows dropped).
  • Kept POST /api/usage/plans, GET /api/usage/plans, /api/usage/import and /api/usage/calibrate.
  • Re-dumped frontend/openapi.json and ran npm run gen:api. This removes the generated models for those routes.

Provider copy

  • FALLBACK_ACCOUNTS (lib/accounts.tsx) no longer carries the stale hard-coded copy of the five profiles. It is now one neutral default seat: id personal, label "Claude", orange. That is what a guest sees (a guest never fetches /api/accounts) and what the owner sees until /api/accounts answers.
  • The full list moved to mock/accounts.ts (MOCK_ACCOUNTS) for the mock backend and UsageRings.test.tsx.
  • cli/notify.py: removed PRICES and the local price estimate. The push line is now Claude Code · 78k tokens · 8m 38s.
  • The hub's usage/calibrate.restate_cost inserts the run's exact list price into that line (_CLI_TOKENS_RE). It still restates the $x line from an older CLI. If the hub has no totals for the session, the line stays without a price. The repo's .claude/skills/notify/SKILL.md was updated to match.

Stale docs and docstrings

  • CLAUDE.md:
    • Removed the scheduled/ and templates/catalog.py module entries.
    • Pointed the claude_usage.py, opencode_usage.py and agy_usage.py references at the plugin readers.
    • The Clarifier section now describes the clarifier plugin's agents[] and its ui.prefs.
    • Updated the goals, usage/daily and telemetry/usage references.
  • Docstrings: runs/extras.py, sidecar/routes_chrome.py (now "the host half of the lab-chrome plugin"), and the backend comments that still mentioned costAnalysis.ts or sidecar/*_usage.py.
  • docs/plugins.md, docs/usage-calibration.md and docs/local-energy.md were updated the same way.

Key decisions

  • Kept on purpose:
    • Guest Stats (GuestStatsView footprint, activityViz), PerfCard and StorageCard, and the perf and storage mock routes they read.
    • The Pydantic schemas of the removed routes (GoalsResponse, TelemetryUsage, UsageHistory, CalibrationHistory, DailyUsageResponse). They still describe what the bridges return, and removing them cascades into schemas/__init__.
    • The backend /api/perf/* and /api/telemetry/hub routes. They are not in this audit's scope.
  • Not touched, because sibling PRs own them: backend/toolproxy, cli/skills, users tools/PaidTools, Meta, new-project policy and runner/.
  • Cost line: the CLI no longer estimates a price at all. The hub always had the final say, so now there is only one price, the hub's.

Changelog

  • Removed: the dead Conversations dashboard code (costAnalysis, DashboardFilters, ConversationsDashboard), unused analytics, footprint and pricing helpers, and the dead mocks.
  • Removed: the unused routes GET /api/usage/daily|history|calibration, GET /api/telemetry/usage, GET /api/goals and POST /api/goal-work. The plugins use their bridges.
  • Changed: the notify CLI's cost line has no local price. The hub fills in the exact list price.
  • Changed: the fallback account list is now one neutral Claude seat.
  • Docs: CLAUDE.md is aligned with the plugin moves (clarifier, sidecar usage readers, scheduled, templates).

Test notes

  • npx tsc --noEmit: clean.
  • vitest: 1077 passed, 3 failed. The 3 failures are useShareTarget ×2 and FreshContext CacheExpiredNotice. They also fail on main.
  • Backend: each backend/test_*.py module was run on its own under bwrap with a throwaway /data, on this branch and on main (161 modules: identical to main except the deleted parse_action test and the new one; test_typed_plugins has 1 failure on main too). New test: a price-less CLI line gets the hub's price (test_usage_measuring). The route-removal tests check the OpenAPI paths and the authz table.
  • cli/test_*.py (conv, ai_agent, mcp_tools): pass.
  • Re-dumping openapi.json reproduces main's file byte for byte on main, so the diff comes only from this branch.
  • Not deployed from the EVOX2. Deploy from the Homelab after review. Merge after PR #13 (retire-tool-proxy), and rebase if needed.
  • Not in this PR: Gabriel removes the leftover legacy authHeader from the Seerr webhook in Seerr.

🤖 Generated with Claude Code

## Summary This removes core code that the plugins have replaced and that nothing calls any more. It covers the "a" items and the approved route and provider-copy items from the retire-legacy audit (form `retire-legacy-built-in-tools-decisions_wmmg1t`, 2026-11-27). I checked every deletion with `git grep` in this repo and in `ai-agent-plugins`. Anything still imported stays. ## Key changes **Dead frontend** - Deleted `business/dashboards/components/DashboardFilters.tsx`, `ConversationsDashboard.tsx` and `lib/costAnalysis.ts`. Also deleted the tests of `costAnalysis` in `lib/pricing.test.ts` and `lib/localEnergy.test.ts`. - `lib/analytics.ts` keeps only what has callers: `billingMonths` and `subscriptionPaid` (Plan & cost), `convTime`, `modelFamily`, `MODEL_COLORS` and `MODEL_COLOR_FALLBACK`. Removed: date ranges, activity buckets, histogram, stats helpers and `fmtDuration`. - `lib/footprint.ts`: removed `conversationFootprint`. `FootprintUsage` is no longer exported. `guestStats.test.ts` now builds its expected value from `estimateFootprint` + `localFootprint`. - `lib/pricing.ts`: removed `costByType`, `hasOwnTokenRow` and `UsageLike`. Only `costAnalysis` used them. - `api.ts`: removed the orphan doc comment. - Mocks: - `mock/perf.ts` now serves only `/api/perf/conversation/<sid>` and `/calls`, which PerfCard reads. The live, history, conversations, commands, settings, kill, keep and series handlers are gone. - `mock/perfStorage.ts` now serves only `/conversation/<sid>/storage`, which StorageCard reads. - `mock/telemetry.ts` keeps only the beacon. Hub and usage are gone. - The handlers for `/api/usage/daily`, `/api/usage/history` and `/api/usage/calibration` are gone, and so are `usageHistory` and `usageCalibration` in `mock/usage.ts`. - `i18n/fr`: removed the 22 strings that only the deleted code used. The i18n test requires this. **Dead backend** - `conversations/look.py parse_action` and its test. The conversation-labels plugin has its own. - `users/store.py UsersStore.emails()`. It had no caller. **Unused routes** - Removed `GET /api/usage/daily`, `GET /api/usage/history`, `GET /api/usage/calibration`, `GET /api/telemetry/usage`, `GET /api/goals` and `POST /api/goal-work`. - The plugin bridges still call the underlying functions: `daily_usage`, `calibrate.history`, `telemetry.views.usage`, `goals_list`, `goal_work` and `GoalWorkBody`. - `goals/routes.py` no longer has a router, so it is no longer included in `main.py`. - Updated `authz/routes.py` and `authz/matrix.golden.txt` (6 rows dropped). - Kept `POST /api/usage/plans`, `GET /api/usage/plans`, `/api/usage/import` and `/api/usage/calibrate`. - Re-dumped `frontend/openapi.json` and ran `npm run gen:api`. This removes the generated models for those routes. **Provider copy** - `FALLBACK_ACCOUNTS` (`lib/accounts.tsx`) no longer carries the stale hard-coded copy of the five profiles. It is now one neutral default seat: id `personal`, label "Claude", orange. That is what a guest sees (a guest never fetches `/api/accounts`) and what the owner sees until `/api/accounts` answers. - The full list moved to `mock/accounts.ts` (`MOCK_ACCOUNTS`) for the mock backend and `UsageRings.test.tsx`. - `cli/notify.py`: removed `PRICES` and the local price estimate. The push line is now `Claude Code · 78k tokens · 8m 38s`. - The hub's `usage/calibrate.restate_cost` inserts the run's exact list price into that line (`_CLI_TOKENS_RE`). It still restates the `$x` line from an older CLI. If the hub has no totals for the session, the line stays without a price. The repo's `.claude/skills/notify/SKILL.md` was updated to match. **Stale docs and docstrings** - `CLAUDE.md`: - Removed the `scheduled/` and `templates/catalog.py` module entries. - Pointed the `claude_usage.py`, `opencode_usage.py` and `agy_usage.py` references at the plugin readers. - The Clarifier section now describes the clarifier plugin's `agents[]` and its `ui.prefs`. - Updated the goals, `usage/daily` and `telemetry/usage` references. - Docstrings: `runs/extras.py`, `sidecar/routes_chrome.py` (now "the host half of the lab-chrome plugin"), and the backend comments that still mentioned `costAnalysis.ts` or `sidecar/*_usage.py`. - `docs/plugins.md`, `docs/usage-calibration.md` and `docs/local-energy.md` were updated the same way. ## Key decisions - **Kept on purpose:** - Guest Stats (GuestStatsView footprint, activityViz), PerfCard and StorageCard, and the perf and storage mock routes they read. - The Pydantic schemas of the removed routes (`GoalsResponse`, `TelemetryUsage`, `UsageHistory`, `CalibrationHistory`, `DailyUsageResponse`). They still describe what the bridges return, and removing them cascades into `schemas/__init__`. - The backend `/api/perf/*` and `/api/telemetry/hub` routes. They are not in this audit's scope. - **Not touched**, because sibling PRs own them: `backend/toolproxy`, `cli/skills`, users tools/PaidTools, Meta, new-project policy and `runner/`. - **Cost line:** the CLI no longer estimates a price at all. The hub always had the final say, so now there is only one price, the hub's. ## Changelog - Removed: the dead Conversations dashboard code (`costAnalysis`, `DashboardFilters`, `ConversationsDashboard`), unused analytics, footprint and pricing helpers, and the dead mocks. - Removed: the unused routes `GET /api/usage/daily|history|calibration`, `GET /api/telemetry/usage`, `GET /api/goals` and `POST /api/goal-work`. The plugins use their bridges. - Changed: the notify CLI's cost line has no local price. The hub fills in the exact list price. - Changed: the fallback account list is now one neutral Claude seat. - Docs: `CLAUDE.md` is aligned with the plugin moves (clarifier, sidecar usage readers, scheduled, templates). ## Test notes - `npx tsc --noEmit`: clean. - `vitest`: 1077 passed, 3 failed. The 3 failures are `useShareTarget` ×2 and FreshContext `CacheExpiredNotice`. They also fail on main. - Backend: each `backend/test_*.py` module was run on its own under bwrap with a throwaway `/data`, on this branch and on main (161 modules: identical to main except the deleted `parse_action` test and the new one; `test_typed_plugins` has 1 failure on main too). New test: a price-less CLI line gets the hub's price (`test_usage_measuring`). The route-removal tests check the OpenAPI paths and the authz table. - `cli/test_*.py` (conv, ai_agent, mcp_tools): pass. - Re-dumping `openapi.json` reproduces main's file byte for byte on main, so the diff comes only from this branch. - Not deployed from the EVOX2. Deploy from the Homelab after review. **Merge after PR #13** (retire-tool-proxy), and rebase if needed. - Not in this PR: Gabriel removes the leftover legacy `authHeader` from the Seerr webhook in Seerr. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
gabrielvidal self-assigned this 2026-11-27 11:53:22 +01:00
gabrielvidal added 1 commit 2026-11-27 11:53:22 +01:00
- frontend: drop the dead Conversations dashboard code (costAnalysis,
  DashboardFilters, ConversationsDashboard), the unused analytics /
  footprint / pricing helpers, the orphan api.ts comment and the dead
  mocks (perf dashboard, storage dashboard, telemetry hub/usage,
  usage daily/history/calibration); their French strings
- backend: drop look.parse_action (the conversation-labels plugin has its
  own) and UsersStore.emails() (no caller)
- routes: drop GET /api/usage/daily|history|calibration,
  GET /api/telemetry/usage, GET /api/goals, POST /api/goal-work — the
  plugin bridges call daily_usage, calibrate.history, views.usage,
  goals_list and goal_work directly; authz table + golden matrix updated;
  openapi.json re-dumped, src/generated regenerated
- FALLBACK_ACCOUNTS: one neutral Claude seat instead of a stale copy of
  the providers' profiles (the full list moves to mock/accounts.ts)
- notify CLI: no local PRICES estimate — the line is
  "Claude Code · 78k tokens · 8m" and the hub's restate_cost puts the
  run's exact list price in (an older CLI's $ line is still restated)
- CLAUDE.md / docs / docstrings: scheduled/, templates/, sidecar
  *_usage.py, the clarifier (now the plugin's agents[] + prefs),
  runs/extras.py, sidecar/routes_chrome.py

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner
Merged into `main` as 78c8dd26 by the auto-ship batch https://ai-agent.lab.gabvdl.xyz/conversation/12d75a3b-25dc-487a-ac3b-17782cba4214.
gabrielvidal closed this pull request 2026-11-27 12:19:32 +01:00

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gabrielvidal/ai-agent#26