Split routes/activity.ts into feature-owned modules#792
Merged
Conversation
The 779-line activity.ts held 14 handlers spanning three distinct features. Move them into routes/activity/ mirroring the existing routes/agents/ layout: metrics-routes.ts (heatmap, stats, daily status, active hours, agents created, working time), token-routes.ts (token stats/daily/by-project/by-model, harvest), history-routes.ts (projects, agent list, agent detail), with shared.ts holding the deps type and index.ts composing registration. Handler bodies are moved verbatim; no behavior change. Co-Authored-By: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Splits the 779-line
apps/server/src/routes/activity.tsinto feature-owned modules underapps/server/src/routes/activity/, mirroring the existingroutes/agents/layout:shared.ts— theActivityRouteDepstypemetrics-routes.ts— heatmap, stats, daily-status, active-hours, agents-created, working-time-by-projecttoken-routes.ts— token-stats, token-daily, token-by-project, token-by-model, harvest-tokenshistory-routes.ts— history projects, agent list, agent detailindex.ts— thin composition (registerActivityRoutes)Handler bodies are moved verbatim — no behavior change. The only edit outside the new directory is the import path in
server.ts.Why it's tech debt
activity.tsbundled three unrelated features (activity metrics, token reporting, agent history) in one file. PR #773 extracted the handlers into named functions; this completes the follow-up queued in the tech-debt backlog by giving each feature its own module.Validation
pnpm run check— cleanpnpm run test— 2,562 passingpnpm run test:e2e— 168 passed, 13 skipped (pre-existing terminal-live skips)Queued next
Reduce
agents-view.tsx(1006 lines) oruse-terminal.ts(916 lines) — coordinating with the componentizer job which owns large-component extraction.🤖 Generated with Claude Code