Files
SubMiner/backlog/tasks/task-188 - Refactor-stats-chart-data-pipeline-to-use-backend-aggregated-series.md
sudacode 5feed360ca feat: add app-owned YouTube subtitle flow with absPlayer-style parsing (#31)
* fix: harden preload argv parsing for popup windows

* fix: align youtube playback with shared overlay startup

* fix: unwrap mpv youtube streams for anki media mining

* docs: update docs for youtube subtitle and mining flow

* refactor: unify cli and runtime wiring for startup and youtube flow

* feat: update subtitle sidebar overlay behavior

* chore: add shared log-file source for diagnostics

* fix(ci): add changelog fragment for immersion changes

* fix: address CodeRabbit review feedback

* fix: persist canonical title from youtube metadata

* style: format stats library tab

* fix: address latest review feedback

* style: format stats library files

* test: stub launcher youtube deps in CI

* test: isolate launcher youtube flow deps

* test: stub launcher youtube deps in failing case

* test: force x11 backend in launcher ci harness

* test: address latest review feedback

* fix(launcher): preserve user YouTube ytdl raw options

* docs(backlog): update task tracking notes

* fix(immersion): special-case youtube media paths in runtime and tracking

* feat(stats): improve YouTube media metadata and picker key handling

* fix(ci): format stats media library hook

* fix: address latest CodeRabbit review items

* docs: update youtube release notes and docs

* feat: auto-load youtube subtitles before manual picker

* fix: restore app-owned youtube subtitle flow

* docs: update youtube playback docs and config copy

* refactor: remove legacy youtube launcher mode plumbing

* fix: refine youtube subtitle startup binding

* docs: clarify youtube subtitle startup behavior

* fix: address PR #31 latest review follow-ups

* fix: address PR #31 follow-up review comments

* test: harden youtube picker test harness

* udpate backlog

* fix: add timeout to youtube metadata probe

* docs: refresh youtube and stats docs

* update backlog

* update backlog

* chore: release v0.9.0
2026-03-24 00:01:24 -07:00

3.3 KiB

id, title, status, assignee, created_date, updated_date, labels, milestone, dependencies, references, priority, ordinal
id title status assignee created_date updated_date labels milestone dependencies references priority ordinal
TASK-188 Refactor stats chart data pipeline to use backend-aggregated series Done
codex
2026-03-18 00:29 2026-03-23 03:22
stats
performance
refactor
m-1
src/core/services/immersion-tracker/query.ts
src/core/services/immersion-tracker-service.ts
src/core/services/stats-server.ts
stats/src/hooks/useTrends.ts
stats/src/components/trends/TrendsTab.tsx
stats/src/lib/api-client.ts
stats/src/types/stats.ts
stats/src/lib/dashboard-data.ts
medium 138500

Description

Reduce long-term dashboard performance debt by moving chart aggregation out of the stats UI and into the tracker/stats API layer. The trends dashboard should consume chart-ready series from backend rollups instead of reconstructing multiple datasets from raw session lists in the browser.

Acceptance Criteria

  • #1 Stats API exposes chart-oriented aggregated trend data needed by the trends dashboard without requiring raw session lists for those charts.
  • #2 The trends dashboard consumes the new aggregated API responses and no longer rebuilds its main chart datasets from raw sessions in the render path.
  • #3 Time-range and grouping behavior remain correct for recent and all-time views, with explicit handling that keeps older history performant.
  • #4 Existing overview and anime detail charts continue to behave correctly, or are migrated to the shared aggregation path where it reduces debt.
  • #5 Tests cover backend aggregation/query behavior and frontend consumption of the new response shapes.
  • #6 Internal docs are updated to describe the new stats chart data flow and scaling rationale.

Implementation Plan

  1. Add a chart-oriented trends dashboard API response on the stats server that returns pre-aggregated series by range/grouping instead of requiring raw session lists in the UI.
  2. Implement tracker/query-layer helpers that aggregate trend series on the backend, preferring rollups for scalable time-series data and centralizing chart shaping there.
  3. Update stats client types and useTrends to consume the new response shape and stop fetching raw sessions for main chart construction.
  4. Simplify TrendsTab and related chart components so they render backend-provided series with only lightweight UI-level filtering/state.
  5. Keep overview/anime detail chart behavior intact, and reuse shared aggregation paths where it meaningfully reduces debt without widening scope.
  6. Add/adjust backend and frontend tests plus internal docs to describe the new chart-data flow and performance rationale.

Implementation Notes

Implemented a new /api/stats/trends/dashboard server route backed by tracker/query-layer aggregation, updated the stats client and useTrends to consume the new chart-ready payload, simplified TrendsTab to render backend-provided series, added route/query/api-client tests, and documented the new trends data flow in docs/architecture/stats-trends-data-flow.md.

Did not run validation commands in this pass; acceptance criteria remain unchecked pending requested verification.