Commit Graph

32 Commits

Author SHA1 Message Date
9ec721b9fc Style chart tooltips to match the dark theme
Recharts' default tooltip is a plain white box, which stood out badly
against the app's dark background. Applied across both the Review Queue's
pace/HR charts and the Progression chart.
2026-07-19 16:13:52 +02:00
02ee9fa76e Show the average line for single-effort-type workouts too; rebrand header to geniusrun
Previously the dashed average pace/HR line only drew for warm-up/cool-down
laps. Workouts with only one kind of effort throughout (no warm-up/cool-down
segmentation at all, e.g. a plain Long Run) had nothing to compare the
actual trace against, so they now get the same dashed line spanning the
whole activity at its overall (duration-weighted) average.

UI-only rename: "smartrun" -> "geniusrun", prefixed with the genie emoji.
2026-07-19 16:05:41 +02:00
a6efcec33b Fix Y-axis label overlap, add phase-boundary lines and warm-up/cool-down average lines, map INTERVAL to Effort
Y-axis ticks now use a fixed small count (3) snapped to round increments
(30s for pace, 5-20bpm for HR depending on range) instead of Recharts'
automatic placement, which was silently dropping most ticks in the
~100px-tall mini chart and occasionally leaving only one label visible.

A light vertical line now marks every point the effort type changes, even
between phases that don't get a background color. Warm-up and cool-down
segments -- which rarely have a target band -- get a dashed line at their
own average pace/HR instead, as a reference point.

"Pertuis - 1500m Hill" showed no phase coloring because its lap uses
Garmin's INTERVAL intensity type, which wasn't mapped -- confirmed via query
that 23 laps across the account use it, alongside the 5 types already
handled. It's the same concept as ACTIVE (a work/effort segment), so it now
shares that color and label.
2026-07-19 15:58:04 +02:00
252c8fa0d1 Filter start-of-run pace artifacts, use a percentile-based Y scale, round pace ticks to 30s
Samples right as recording starts (before the run itself begins) can compute
an implausible pace like 50+ min/km from a near-zero speed reading; these
are now treated as unknown rather than plotted. The pace/HR domain is also
now built from the 2nd-98th percentile of the actual trace instead of true
min/max, so an occasional stray point (a brief pause, GPS noise) can't
single-handedly stretch the scale and squash the rest of a steady effort --
the target band, which is deliberate data rather than noisy telemetry, is
still always fully included. Pace axis ticks always land on a round
30-second mark (7:30, 8:00, 8:30, ...).
2026-07-19 15:42:49 +02:00
7f0373f2f3 Build the Review Queue chart's actual trace from per-second samples, not lap averages
A lap can span many minutes, so plotting one flat value per lap hid real
within-lap variation -- a single-lap hill repeat rendered as a dead-flat
line despite the pace/HR swinging throughout it. The actual pace/HR trace
now comes from activity_samples (per-second telemetry) when available,
looking up each sample's enclosing lap only for the target band/phase
color. Falls back to the previous lap-stepped rendering when an activity
has no samples.
2026-07-19 15:25:48 +02:00
647757dcab Add a raw-data viewer to Review Queue cards, improve chart color palette
A "Raw data" button at the bottom right of each card opens a modal with the
full activity/laps/assignment JSON (embedded RawJSON strings parsed back
into objects for readability), to make it easier to inspect exactly what
data is available when iterating on the charts.

Phase band colors (warm-up/effort/recovery/cool-down) previously reused the
same blue/red as the pace/HR accent colors, making them hard to tell apart.
New palette (amber/pink/teal/violet) avoids both accents entirely.
2026-07-19 15:05:46 +02:00
6c6783ce50 Redesign the Review Queue pace/HR chart: always show actuals, time-based X-axis, area style, phase-colored bands
Previously the chart rendered nothing at all unless a structured Garmin
workout's target was resolved, which meant most activities showed no chart.
Now it always shows actual pace/HR over elapsed time (in minutes) for any
activity with laps, filled as an area rather than a line, with the expected
band layered on top only when available. Each lap's warm-up/effort/recovery/
cool-down phase (from Garmin's per-lap IntensityType) shades the background,
with a small legend for whichever phases are present.
2026-07-19 14:54:10 +02:00
249826afc0 Move backfill horizon from a startup env var into the editable profile
SMARTRUN_BACKFILL_HORIZON_DAYS was a server-startup-only env var with no UI,
defaulting to 3 years -- so editing the unrelated "Rolling window" profile
field (for classification, not sync) had no effect on how far back Sync Now
reached. Backfill horizon is now Profile.BackfillHorizonDays, read fresh on
every Backfill call, with its own field on the Profile page.
2026-07-19 12:57:18 +02:00
93746666b5 Reload the page after Reset all finishes
Other pages (Review Queue, Activities) fetch their own data once on mount
and had no way to know activities were deleted elsewhere, so they kept
showing stale rows until a manual reload.
2026-07-19 12:45:03 +02:00
7f7e4b10f0 Merge backfill into Sync now, replace Full backfill with a destructive Reset all
Sync now now runs Backfill (resumes from the watermark, so a widened history
horizon is picked up automatically) then IncrementalSync then detail-fill, in
one click. "Full backfill" is gone -- in its place, "Reset all" (styled as a
destructive action, gated by a confirm dialog) wipes every synced activity
and its laps/kind assignments and rewinds the backfill watermark, so the next
sync performs a genuinely fresh pull instead of trying to patch up existing
rows with newer schema fields.
2026-07-19 12:41:38 +02:00
af41aa0f7f Show expected vs actual pace/HR per lap in the Review Queue
Activities recorded from a structured Garmin workout carry a workoutId;
when its steps line up 1:1 with the recorded laps, the per-step target
pace/HR zone is resolved (via a Karvonen lookup for named zones) and stored
on each lap. The Review Queue plots it against the actual per-lap pace/HR
so the user can eyeball whether a run matches its plan while sorting it.
2026-07-19 11:55:13 +02:00
0610897541 Replace per-kind reclassify with a single global reclassify that respects manual and Race locks
Manual assignments are the user's definitive word and Race assignments come
from a hard Garmin fact (eventType.typeKey), not a retunable rule -- neither
is ever touched by reclassify again, and Race can no longer be set by hand
via the review queue. Adds an Activities page so this locked/unlocked status
is visible per workout, since Review Queue only ever showed unresolved items.
2026-07-19 11:11:50 +02:00
8ff3d62b2f Add Race workout kind with Garmin eventType auto-detection, sync-time running filter, and pill-based review queue filter
Race is the 8th fixed workout kind, seeded with a real (not placeholder)
rule since Garmin Connect's eventType.typeKey reports "race" for
manually-tagged race activities. Non-running activity types (padel,
cycling, strength training, ...) are now dropped at sync time instead of
being stored. The Review Queue's type filter is now clickable exclusive
pill buttons instead of a dropdown.
2026-07-19 10:52:09 +02:00
dfc883acb6 feat: replace per-workout-type phase-detection settings with one global pair
The 14 phase-related profile columns (warmup/cooldown per workout type,
plus an unused Interval pair) added more granularity than wanted. Migration
0006 drops all 14 and adds a single warmup_minutes/cooldown_minutes pair
applied uniformly to every fixed-duration workout type; Interval still
detects phases from lap data directly and ignores this setting. Restores
a simplified Phase detection section in the Profile UI with just the two
fields.
2026-07-18 08:53:21 +02:00
7f4877df57 feat: review queue polish (pace, sort, type filter), drop unused phase-detection UI
Review Queue: show pace alongside distance/duration/HR, sort by activity
date (most recent first) instead of classification timestamp, and add a
filter by workout kind with a special "Unsorted" option for runs where
the rule engine found zero candidates at all (distinct from ambiguous
multi-candidate runs).

Profile: remove the phase-detection warm-up/cool-down section from the
UI -- not used by anything yet (phase segmentation is future work) and
was adding noise. The underlying fields are untouched so no data is lost
and the settings screen still round-trips them on save.
2026-07-18 08:39:23 +02:00
75d8a8dd0d docs: fix stale env-var docs, document validateProfile's zone-range rationale
Two Minor findings from the final whole-branch review: the smartrun-dev
skill still told developers to set GARMIN_EMAIL/GARMIN_PASSWORD (now
sourced from the profile row instead), and validateProfile's deliberate
choice not to require 0-100% HR zone coverage had no explanation.
2026-07-17 19:36:51 +02:00
91b901ba60 fix: update seedsample for the fixed workout taxonomy and profile-based max HR
Update workout kinds by fixed name (via ListWorkoutKinds/UpdateWorkoutKind)
instead of creating new ones, since the taxonomy migration now seeds
Easy Run/Tempo/Interval by unique name. Set profile.MaxHeartRate so
avg_hr_pct_max is computed during classification, and drop the removed
appsync.Config.MaxHR field.
2026-07-17 19:29:02 +02:00
17ebe3c665 feat: add profile settings page and fixed-taxonomy WorkoutKinds UI with pace/HR-zone editing 2026-07-17 19:22:25 +02:00
9cfa3e138e feat: source Garmin credentials from the profile instead of env vars 2026-07-17 19:18:06 +02:00
c11dd152ba feat: classification reads max HR from the profile instead of static config
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-17 19:13:24 +02:00
078c87c413 feat: fix workout taxonomy to 7 types, add pace/HR-zone fields to the API 2026-07-17 19:09:55 +02:00
9c42931c9e fix: restore standard HR zone defaults, relax zone-boundary validation instead of migration 2026-07-17 19:06:01 +02:00
57be9065cd feat: add profile REST endpoints with HR zone validation
Implements GET /api/profile and PUT /api/profile endpoints with validation
of HR zones (must be contiguous, non-overlapping, 0-100%). Also updates
profile migration to use correct HR zone defaults (0-20, 20-40, etc.)
that match validation requirements.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-17 19:03:29 +02:00
6f62686d29 feat: support updating Garmin credentials at runtime
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-17 18:57:54 +02:00
684b026ff4 feat: add per-workout-type pace range and expected HR zone
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-17 18:53:55 +02:00
6e8bde7854 fix: rename colliding test workout kind name in sync test after taxonomy reseed
The migration 0004_workout_taxonomy.sql now seeds a fixed 'Tempo' kind.
The test was also creating a 'Tempo' kind, causing a UNIQUE constraint violation.
Renamed the test kind to 'Test Classification Tempo' to avoid collision.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-17 18:50:21 +02:00
69cb117eab feat: reseed workout_kinds with the fixed 7-type running taxonomy
- Add migration 0004_workout_taxonomy.sql to reset workout_kinds table
  with exactly 7 fixed named kinds (Easy Run, Long Run, Threshold 30',
  Threshold 60', Tempo, Interval, MAS Test), each with a never-matching
  placeholder rule
- Add test TestWorkoutTaxonomy_SeededWithSevenFixedTypes to verify all
  7 kinds are seeded and active
- Update TestKindAssignment_AppendOnlyHistoryAndCurrentView to use a
  unique kind name to avoid conflict with seeded kinds

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-17 18:48:04 +02:00
cfd315e132 fix: correct stale doc comment on Profile's Interval phase fields 2026-07-17 18:44:36 +02:00
4748917a25 feat: add single-profile settings table and store layer
Add Profile table to store Garmin credentials and engine configuration
parameters. Implements GetProfile() and UpdateProfile() store methods with
comprehensive test coverage. The profile singleton row is automatically
initialized on migration and persists all configuration state.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-17 18:41:37 +02:00
5fbc574d34 docs: merge plan tasks 9-11 into one so every commit typechecks cleanly 2026-07-17 18:38:14 +02:00
ece78526b4 chore: gitignore .superpowers/ scratch dir 2026-07-17 18:34:51 +02:00
f689f74ae0 Initial commit: smartrun MVP
Garmin run classification and progression tracker. Go backend (MCP
client to mcp-garmin, SQLite store, deterministic rule engine, REST
API) and React/TS frontend (Dashboard, Review Queue, Workout Kinds).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-17 18:33:06 +02:00