chore(analytics): finish-or-remove decision for dead analytics collector/Query* surface (no-delete: needs human call) #1033
Description
Problem. Per report 06 A1/L1/L2: NewCollector, SaveSnapshot/BulkInsertSnapshots, all Query*, and partition management have zero production callers; only RefreshMaterializedViews is wired, refreshing views over a table nothing writes to. Partitions stop being created after the seeded 3 months (M3); retention never runs. ~300 LOC + 4 mock files + an indexed FK column maintained for an unused API.
Evidence. Report 06 (A1, L1, L2, M3). Repo-wide grep confirms no live caller.
Suggested fix (explicit decision required, no-delete rule). Either (a) finish: wire the collector to an EventBridge schedule + monthly partition-maintenance job + expose Query* via the dashboard (then I-12's guards become mandatory), or (b) remove the unused surface. Do not leave the half-built scaffold.
References. Source: report 06 (A1, L1, L2, M3). Gated by I-12 (guards before wiring).
Filed from automated adversarial code review (see docs/code-review/). Source finding(s): 06-A1, 06-L1, 06-L2.
Activity
feat(analytics): finish & wire historical savings snapshots (closes #…
cristim commentedon Jul 27, 2026
Verification sweep against
main(101f099fb) on 2026-07-27 finds this already resolved.The analytics collector is fully wired as scheduled task TaskCollectAnalytics with partition management.
Evidence: commit 5fc0899 (PR #1049).
Recommending close.
cristim commentedon Sep 2, 2026
Verified resolved at 3c0f8ac: the finish option was implemented. The analytics collector runs as the scheduled task TaskCollectAnalytics with monthly partition provisioning and retention, and the Query* surface is consumed by the dashboard analytics handlers. Evidence: internal/server/analytics_collect.go:110 and internal/server/handler.go:44,193 (#1049, commit 5fc0899); consumers at internal/api/handler_analytics.go:171,217. Residual axes checked: partition management and retention are wired (analytics_collect.go:22-51), QueryHistory/QueryBreakdown have live callers, no remaining dead Query* entry points found. Closing as completed; reopen if the behaviour recurs.