Files
SubMiner/backlog/tasks/task-182.2 - Improve-session-detail-known-word-chart-scaling.md
sudacode f2d6c70019 Fix stats command flow and tracking metrics regressions
- Route default `subminer stats` through attached `--stats`; keep daemon path for `--background`/`--stop`
- Update overview metrics: lookup rate uses lifetime Yomitan lookups per 100 tokens; new words dedupe by headword
- Suppress repeated macOS `Overlay loading...` OSD during fullscreen tracker flaps and improve session-detail chart scaling
- Add/adjust launcher, tracker query, stats server, IPC, overlay, and stats UI regression tests; add changelog fragments
2026-03-19 15:46:52 -07:00

4.6 KiB
Raw Permalink Blame History

id, title, status, assignee, created_date, updated_date, labels, dependencies, references, parent_task_id
id title status assignee created_date updated_date labels dependencies references parent_task_id
TASK-182.2 Improve session detail known-word chart scaling Done
codex
2026-03-19 20:31 2026-03-19 20:52
bug
stats
ui
/Users/sudacode/projects/japanese/SubMiner/stats/src/components/sessions/SessionDetail.tsx
/Users/sudacode/projects/japanese/SubMiner/stats/src/lib/session-detail.test.tsx
TASK-182

Description

Adjust the expanded session-detail known-word percentage chart so the vertical range reflects the session's actual percent range instead of always spanning 0-100. Keep the chart easier to read while preserving the percent-based tooltip/legend behavior already used in the stats UI.

Acceptance Criteria

  • #1 Expanded session detail scales the known/unknown percent chart to the session's observed percent range instead of hard-coding a 0-100 top bound
  • #2 The chart keeps a small headroom above the highest observed known-word percent so the line remains visually readable near the top edge
  • #3 Automated frontend coverage locks the new percent-domain behavior and preserves existing session-detail rendering

Implementation Plan

  1. Add a focused frontend regression test for the session-detail ratio chart domain calculation, covering a session whose known-word percentage stays in a narrow band below 100% and expecting a dynamic top bound with headroom.
  2. Update stats/src/components/sessions/SessionDetail.tsx to compute a dynamic percent-axis domain and matching ticks for the ratio chart, keeping the lower bound at 0%, adding modest padding above the highest known percentage, rounding to clean tick steps, and capping at 100%.
  3. Apply the computed percent-axis bounds consistently to the right-side Y axis and the session chart pause overlays so the visual framing stays aligned.
  4. Run targeted frontend tests and the SubMiner verification helper on the touched files, then record results and any blockers in the task.

Implementation Notes

Implemented dynamic known-percentage axis scaling in stats/src/components/sessions/SessionDetail.tsx: the ratio chart now keeps a 0% floor, uses the highest observed known percentage plus 5 points of headroom for the top bound, rounds that bound up to clean 10-point ticks, caps at 100%, and enables allowDataOverflow so the stacked area chart actually honors the tighter domain.

Added frontend regression coverage in stats/src/lib/session-detail.test.tsx for the axis-max helper, covering both a narrow-band session and near-100% cap behavior.

Added user-visible changelog fragment changes/2026-03-19-session-detail-chart-scaling.md.

Verification: bun test stats/src/lib/session-detail.test.tsx passed; bun run typecheck passed; bun run changelog:lint passed; bash .agents/skills/subminer-change-verification/scripts/verify_subminer_change.sh --lane core stats/src/components/sessions/SessionDetail.tsx stats/src/lib/session-detail.test.tsx ran and passed typecheck but failed bun run test:fast on a pre-existing unrelated issue in scripts/update-aur-package.test.ts / scripts/update-aur-package.sh (mapfile: command not found). Artifacts: .tmp/skill-verification/subminer-verify-20260319-134440-JRHAUJ.

Docs decision: no internal docs update required; the behavior change is localized UI presentation with no API/workflow change. Changelog decision: yes, required and completed because the fix is user-visible.

Final Summary

Improved expanded session-detail chart readability by replacing the fixed 0-100 known-word percentage axis with a dynamic top bound based on the sessions highest observed known percentage plus modest headroom, rounded to clean ticks and capped at 100%. The ratio chart now also enables allowDataOverflow so Recharts preserves the tighter percent domain even though the stacked known/unknown areas sum to 100%.

Added frontend regression coverage for the new axis-max behavior and a changelog fragment for the user-visible stats fix.

Verification: bun test stats/src/lib/session-detail.test.tsx, bun run typecheck, and bun run changelog:lint passed. The SubMiner verification helpers core lane also passed typecheck, but bun run test:fast remains red on a pre-existing unrelated bash-compat failure in scripts/update-aur-package.test.ts / scripts/update-aur-package.sh (mapfile: command not found).