refactor: split internal/db/stats.go (1318 lines, 15 query methods) #22
Labels
No labels
backend
bug
chore
duplication
effort:complex
effort:medium
effort:trivial
enhancement
frontend
fullstack
priority:high
ready-for-agent
refactor
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dries/ocman#22
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
internal/db/stats.gois 1318 lines and contains 15 distinct DB query methods covering completely separate concerns:GetStats— top-line countsGetMetricsDashboard+ 5 private aggregators (scanDashboardRows,aggregateSummaryAndBuckets,populateSessionLog,populateProjectLog,lookupSessionMetadata)GetProjectsGetDailyActivityGetModelUsageGetRecentModelsGetHourlyTokensByModelGetHourlyActivityGetNewAssistantMessages/GetMaxMessageTime(LLM metrics loop)This is also the largest community in the GitNexus graph (102 symbols, cohesion 0.98) — a sign that this file has become a catch-all.
Suggested split
db/metrics_dashboard.goGetMetricsDashboard,scanDashboardRows,aggregateSummaryAndBuckets,populateSessionLog,populateProjectLog,lookupSessionMetadata, related typesdb/activity.goGetDailyActivity,GetHourlyActivity,GetHourlyTokensByModel,GetNewAssistantMessages,GetMaxMessageTimedb/projects.goGetProjects,GetModelUsage,GetRecentModelsdb/stats.goGetStats,directoryWhere,extractModelProvider, shared helpersThis is a pure file-level refactor — no behaviour change, no API change.
References
internal/db/stats.go:1