Skip to content

Run history trends: sparklines, streaks, averages #12

Description

@CKGrafico

Problem

Run history is a flat table of runs with timestamps, durations, and exit codes. No trends, no insights, no visual summary of how a loop is performing over time.

Solution

Add visual trend indicators to the run history panel.

Features

  1. Sparkline of durations

    • Unicode block characters: low blocks for fast, tall for slow
    • Shows last N runs (up to 20, fits in panel width)
    • Color: green if under average, red if over average
    • Example: fast loop -> slow loop -> back to fast
      ▁▂▁▂▃█▆▄▂▁
  2. Success/failure streak

    • "Streak: 5 successes" or "Streak: 3 failures"
    • Color-coded: green for success streak, red for failure streak
    • Helps spot degrading loops
  3. Average duration

    • "Avg: 1.2s" next to the sparkline
    • Computed from last N runs (same window as sparkline)
  4. Last failure timestamp

    • "Last failure: 2h ago" if any recent failure exists
    • Helps answer "when did this last break?"
  5. Trend arrow

    • Up arrow if getting slower (recent avg > overall avg)
    • Down arrow if getting faster
    • Dash if stable

Layout

+----------------------------------------------+
| Run History |
| |
| Durations: ▁▂▁▂▃█▆▄▂▁ Avg: 1.2s Trend: ▲ |
| Streak: 5 successes Last failure: 2h ago |
| |
| 14:32:10 ✓ 1.2s 145B |
| 14:30:10 ✓ 1.1s 33B |
| 14:28:10 ✗ 0.1s 0B |
| ... |
+----------------------------------------------+

Implementation

  • Pure computation from existing runHistory data (no new storage)
  • Sparkline rendered with Unicode block characters (no external dependency)
  • Recent N = Math.min(runHistory.length, panelWidth / 2)
  • Colors from theme.ts

Acceptance criteria

  • Sparkline of last N run durations
  • Color: green under avg, red over avg
  • Success/failure streak counter
  • Average duration display
  • Last failure timestamp (relative: "2h ago")
  • Trend arrow (up = slower, down = faster, dash = stable)
  • All computed from existing runHistory (no new storage)

Part of v2.0.0 epic #4

Metadata

Metadata

Assignees

No one assigned

    Labels

    v2.0.0v2.0.0 rebuild

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions