Skip to content

Phase 6: Strength logging and health data - #11

Merged
coderback merged 5 commits into
mainfrom
phase-6
Nov 5, 2026
Merged

coderback merged 5 commits into
mainfrom
phase-6

Conversation

@coderback

@coderback coderback commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

Phase 6 from docs/PLAN_PHASES_5_TO_9.md: set-by-set strength logging, progression rules, and a wider health import.

Strength logging (6.1)

  • WorkoutSession / WorkoutSet. A finished workout is sent whole and saved once per clientId. It creates the ActivityLog, so the feed, challenges, calories and streaks work unchanged.
  • Workout screen:
    • sets start at today's target, and one tap repeats last time's numbers;
    • rest timers by set type, supersets, plate and warm-up calculators;
    • add, swap and reorder exercises;
    • PRs marked as they happen.
  • Say it: "bench 80 for 8, 8, 7" is read by rules without a model call. Other phrasings go to the AI and share Smart log's daily limit.
  • Offline: the workout lives in a persisted store. Finished workouts upload through a persisted React Query mutation that waits for a connection and survives restarts.
  • Plans run by session order (WorkoutPlan.nextSession), so a missed day doesn't skip a session.
  • History per exercise: estimated 1RM (Epley) or top weight over time.
  • Feed: set and PR counts only, never weights.

Progression rules (6.2)

  • Double progression: one equipment step, capped at 5%.
  • A 10% deload after a stall or two missed weeks.
  • Holds for a deficit over 500 kcal a day, protein under 1.6 g/kg, or sleep under 6 h.
  • Every change comes with an explanation, shown in the app and passed to the coach.

Health data (6.3)

  • HealthMetric: HRV (SDNN or RMSSD, stored apart), resting heart rate, breathing rate, sleeping temperature, VO2max and menstrual flow.
  • Workouts carry average heart rate and distance. Calories use the device's figure, then Keytel et al. (2005), then METs; calorieMethod records which.
  • Repeat syncs change nothing.
  • Cycle data needs its own consent (consentCycleData), is deleted when that's withdrawn, and never reaches the feed, challenges, the coach or coach memory.
  • Optional write-back of logged meals to Apple Health / Health Connect.

Migration

20261108120000_phase6_strength_health. Additive, with RLS on the new tables; already applied to Supabase.

Testing

  • Backend: 157 unit and 68 database tests. Lint and typecheck are clean.
  • Mobile: 30 tests. Typecheck is clean, and lint shows only the warnings already on main.
  • Browser (web build):
    • strength 29/29, including finishing offline, restarting, and syncing on reconnect;
    • health settings 11/11;
    • the Phase 4 and 5 suites all pass.
  • Live: Say it's AI path ran against Azure with the strict schema.
  • Not yet tested: the native health parts need a development build on real phones.

- WorkoutSession and WorkoutSet: a finished workout is saved whole from
  the phone, idempotent by clientId, and creates the ActivityLog so the
  feed, challenges and calories work unchanged
- PRs (weight, estimated one-rep max, bodyweight reps) marked against
  earlier sessions; per-exercise history with Epley estimates
- Plans run by session order: WorkoutPlan.nextSession advances on finish
- Progression rules: double progression, steps capped at one equipment
  step or 5%, deloads after stalls or missed weeks, and holds for a big
  deficit, low protein or short sleep, each with an explanation the
  coach can repeat
- Say it: common phrasings read by rules without a model call; the rest
  by the model, sharing Smart log's daily limit
- Feed shows set and PR counts, never weights
- HealthMetric: HRV (SDNN or RMSSD, kept apart), resting heart rate,
  breathing rate, sleeping temperature, VO2max and menstrual flow
- Imported workouts carry average heart rate and distance; calories use
  the device's figure, then Keytel et al. (2005), then METs, and record
  which in calorieMethod
- A second sync with the same data changes nothing
- Cycle data needs its own consent, is deleted when it's withdrawn, and
  never reaches the coach, the feed or coach memory
- The coach sees recent recovery metrics against their 30-day average
- Workout screen: sets start at today's target with last time beside
  each, so a repeated set is one tap; rest timers by set type; supersets;
  plate and warm-up calculators; add, swap and reorder exercises; PRs as
  they happen; Say it
- The workout in progress is kept on the phone; a finished one waits there
  and is sent with a persisted React Query mutation, so it survives being
  offline and a restart, and is only sent for the account it belongs to
- Home and the plan show the next session by order, with Start workout,
  or Log as done for a run or class
- Saved workouts open from the Activity tab with their sets; exercise
  history shows estimated 1RM or top weight over time
- The feed shows set and PR counts
- Backend: exercise search by movement, workout titles checked like
  names, and Say it's name lookup ignores spaces and hyphens
- Reads HRV (SDNN or RMSSD), resting heart rate, breathing rate, sleeping
  temperature (Apple's as a deviation from earlier nights), VO2max, and
  each workout's average heart rate and distance
- Cycle data only after its own consent in GRIT; turning it off deletes it
- Optionally writes logged meals' calories, macros and caffeine to Apple
  Health or Health Connect, updating and removing them with the log
- The settings screen explains why each kind of data is read; the first
  sync imports two months; people who connected before are asked once
  for the new kinds
- New Health Connect permissions and Apple's write description
@vercel

vercel Bot commented Nov 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
grit-demo Ready Ready Preview Nov 5, 2026 9:43pm UTC

@coderback
coderback merged commit 5f5ea7f into main Nov 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant