Implement TASK-015 metadata-driven exercise logging

This commit is contained in:
rob
2026-11-04 22:22:26 +00:00
parent 669bfc3910
commit 9c0e82037f
31 changed files with 1537 additions and 416 deletions
+33 -29
View File
@@ -11,16 +11,16 @@
**Primary devices:** Debian laptop/desktop browser; responsive mobile browser
**Maintainer workflow:** Codex CLI + `roborto-project-context`, Git, isolated per-task branches/worktrees
## TASK-015 planning overlay — 2026-11-04
## TASK-015 accepted implementation — 2026-11-04
TASK-015 is scoped in `docs/TASKS.md`; implementation awaits Captain approval. The current app and the earlier sections below describe the timer-free, aggregate-EMOM baseline. This overlay records the latest requested changes without claiming they are implemented.
TASK-015 implements metadata-driven equipment/measurement entry and was accepted by Captain on 2026-11-04 after the count-input and completion-checkbox refinements. Its UI brief is `docs/TASK-015_UI.md`. Legacy aggregate EMOM, repetition sets and weight-only sets remain preserved separately; new logging uses detailed versioned records. The app stays timer-free.
- Exercise definitions describe supported equipment and applicable measurements, independent of prescription targets and performed values. Use the complete assignment matrix in `WORKOUT_ROUTINE.md` section 8. No fixed vest weight belongs in definitions. Dumbbells used as push-up handles do not contribute lifted resistance.
- Reusable UI derives controls from repetitions, repetitions per side, duration, duration per side, distance when applicable, EMOM reps per minute and equipment-specific loads. Bodyweight-only work has no external-weight fields; supported external resistance accepts explicit zero. Dumbbells are entered per dumbbell; bars include the bar's weight.
- Log each set/minute with independent load components, explicit completion and partial state. New EMOM records support per-minute reps/load and derived totals; old aggregate records must never be split into invented minutes. Keep previous-session suggestions distinct from actuals and preserve next-set weight defaults.
- Log each set/minute with independent load components and partial state. Explicit Save marks fully filled valid rows complete; no completion checkboxes are shown. New EMOM records support per-minute reps/load and derived totals; old aggregate records must never be split into invented minutes. Keep previous-session suggestions distinct from actuals and preserve next-set weight defaults.
- Show compact name/target/equipment/rest information and applicable logging, with expandable available instructions, muscles, technique and local media/placeholders. Reduce repeated visible labels while retaining accessible names; stack at mobile width without horizontal scrolling. Preserve date navigation, Morning/Afternoon switching and the wall clock.
- Afternoon holds may record actual seconds (per side where applicable) without repetitions, weights or prescribed hold times. Daily hang is bodyweight-only with an editable initial two-minute **continuous** target, optional attempts and independent longest/cumulative totals. Do not treat cumulative duration as continuous success.
- Preserve historical records and local edits independently of metadata changes. Version new record schemas and JSON serialization; review IndexedDB v2 for an additive migration only where needed. Test old total-only/component records, existing goal overrides and old/new JSON round trips. TASK-009 still owns backup UI and import conflict policy; none exists in the current app.
- Preserve historical records and local edits independently of metadata changes. IndexedDB v3 adds performanceEntries and its matching-session index without rewriting the two older stores. New records use schemaVersion 1; JSON adapter backups use version 2 with a legacy version 1 envelope reader. Test old total-only/component records, existing goal overrides and old/new JSON round trips. TASK-009 still owns backup UI and user-facing import policy; the current adapter supports non-overwriting imports or explicit transactional replacement, with no Settings interface.
- Dog-walk classification is bodyweight-only; restoring walks to the UI/seed/logs is outside this task. No straight-bar exercise is added merely to support the equipment vocabulary.
- Captain resolved the timer question on 2026-11-04: keep the app timer-free. Preserve the local wall clock and prescribed rest/EMOM guidance; no timers or audio are added (ADR-018).
@@ -34,7 +34,7 @@ A successful first version enables the user to:
1. See the complete seven-day plan and today's prescribed sessions using a weekday strip and exclusive Morning/Afternoon switch.
2. Open each exercise's instructions, muscles involved, equipment, and image(s), with offline availability.
3. Complete and log morning strength sessions and afternoon isometric holds. Monday and Friday mornings are labeled Full body stretch routine; specific stretches will be provided later.
4. Record one total repetition count and actual exercise-specific load for each EMOM exercise, and reps and exercise-specific load for each regular set.
4. Record each EMOM minute independently and derive totals; log reps, per-side values, duration and equipment-specific loads per set as applicable.
5. Edit routine parameters through the UI; retain dated performance history and progress views, including total external-load volume without a time-based rate.
6. Back up and restore their own data without cloud accounts, analytics or external services.
@@ -166,7 +166,7 @@ Target intensity (RPE): Monday **5–6**; Tuesday–Thursday **3–4**; Friday *
- Hang from the pull-up bar **every day**, during the afternoon isometric session.
- Goal starts at **120 seconds** and can be changed in the app; it is a target, not an assumed current ability or default completed duration.
- Current successful continuous duration, number of attempts, and whether the initial two-minute goal is presently cumulative **are not specified**; do not invent these. Vest use may be added later but is not shown in the current daily-hang UI.
- Current successful duration and number of attempts are not specified. The goal is explicitly continuous; daily hangs are bodyweight-only. Never default performed duration to the goal.
- Allow logging multiple attempts separately, in seconds, with **longest continuous hang** and **total cumulative hang time** computed independently. A 120-second cumulative total is not equivalent to one continuous 120-second hang.
- Keep Saturday finger hangs as distinct morning exercises, independent of the daily afternoon hang.
- Watch for accumulated grip, finger, elbow and shoulder fatigue; exercise logging must not force completion.
@@ -174,7 +174,7 @@ Target intensity (RPE): Monday **5–6**; Tuesday–Thursday **3–4**; Friday *
### 4.9 Global strength-training rules
- Usually **2 min** rest between sets, **2–3 min** for demanding compounds, **~3 min** between different exercises.
- EMOM remains a prescribed ten-minute protocol with a new start each minute. Record total performed reps and actual external weight for the exercise.
- EMOM remains a prescribed ten-minute protocol with a new start each minute. Record actual reps and load independently each minute; derive totals from recorded completed minutes.
- Increase load or exercise difficulty after consistently reaching the top of a rep range with clean technique.
- Allow recording actual load, reps and time even when they differ from the plan.
- Morning resistance training takes priority over optional higher-effort afternoon sessions.
@@ -195,25 +195,25 @@ Each exercise has a stable `exerciseId` and human-readable name, category, equip
1. Default to **Today**, selecting its actual date and the last-used Morning/Afternoon period; show only that period.
2. Allow navigating to any date/day, not just a repeating abstract weekday; records are tied to actual local dates.
3. Tap an exercise to open details. For EMOM exercises, enter the **total** actual reps and relevant load. For regular strength exercises, enter actual reps and relevant load separately for each set. Show vest, dumbbell, and EZ-bar fields only where the exercise calls for them; mixed vest/dumbbell work needs both. Adding a set copies the previous set's entered weights but not its reps. Never mark prescribed values as performed automatically.
3. Expand Exercise details for available notes and honest content/image placeholders. Enter each EMOM minute or regular set with only metadata-selected measurements and load fields. Per-side exercises have independent left/right values. Adding a set copies loads/count but leaves measurements blank. Save performance marks fully filled valid rows complete; incomplete rows remain saved drafts. Never mark targets or suggestions as performed automatically.
4. End the session with a compact summary (recorded sets, deviations and free-text notes) when session summaries are implemented.
5. Partial records remain saved, and future plan edits do not rewrite previously logged performance.
6. Check off isometric exercises without requiring times; log daily hang attempts in seconds and surface personal best and progress toward the current editable hang goal when extended recording is implemented.
6. Save isometric duration drafts without requiring completion; completed holds have actual seconds (per side where applicable). Daily hang attempts in seconds produce separate longest-continuous and cumulative totals and continuous-goal status. Long-term personal best history remains TASK-008.
7. Show previous performance and basic progress views without confusing prescribed and achieved values; retain previous records after routine edits.
### Suitcase-carry load recording — TASK-014 correction
### Suitcase-carry recording
Suitcase carries retain their prescribed duration per side and accept actual dumbbell kilograms per set, without requiring repetitions or inventing performed duration. Record one dumbbell's weight, with independent set values and next-set load copying. Save dated weight-only rows as `kind: load-sets`; no repetitions or rep-load volume are implied. Broader duration/per-side performance remains TASK-015.
Suitcase carries retain their prescribed duration per side and accept actual left/right seconds plus dumbbell kilograms per dumbbell and count per set, without requiring repetitions. Existing TASK-014 weight-only rows (`load-sets`) remain separately available; no achieved duration is inferred from them. Timed work contributes no rep-load volume.
### Plank vest recording — TASK-014 correction
### Plank recording
Front planks and side-plank hip raises accept vest kilograms per set with no dumbbell/bar inputs or assumed vest weight. Front planks use the existing weight-only set shape without repetition entry; side-plank hip raises retain reps-per-side guidance and reps/load set recording. Different sets may use different loads or zero. Existing bodyweight-only records stay readable as prior totals; changing them to component weights requires an explicit action. Broader actual-duration logging remains separate work.
Front planks accept actual seconds and vest kilograms per set without repetitions. Side-plank hip raises accept independent left/right reps and vest kilograms. Neither has dumbbell/bar fields or assumed load. Different sets may use zero or different loads. Older bodyweight-only or weight-only records stay in their original representation and are never converted automatically.
### Clock and recording behavior
- Show the current local time in the persistent app header across all views. It is a time-of-day display and does not record workout duration.
- Do not show workout, exercise, rest, or EMOM timers or audio cues.
- Keep EMOM duration and rest guidance as prescriptions only. One saved EMOM entry has total actual reps and the applicable load components; regular strength work has one saved rep/load row per performed set. A paired-dumbbell field means kilograms per dumbbell. Preserve older single-total entries without interpreting them as components.
- Keep EMOM duration and rest guidance as prescriptions only. A detailed EMOM entry has ten minute rows of actual reps and load; regular entries have applicable measurements, load/count and completion per set. Dumbbell fields mean kilograms per dumbbell. No exercise shows a dumbbell-count input; its defined count supplies new rows and remains stored for load calculations. Existing recorded counts are preserved. Preserve older single-total entries without interpreting them as components.
- Browsing dates does not create workout records. Saving a strength entry writes the selected date and exercise only.
## 7. Local data architecture
@@ -228,31 +228,34 @@ IndexedDB is **per browser profile and origin**, not a server database; a laptop
| Entity | Essential fields |
|---|---|
| `ExerciseDefinition` | `id`, `name`, `category`, `equipment`, `muscles`, `instructions`, `cues`, `warnings`, `imageAssets`, `version` |
| `ExerciseDefinition` | `id`, `name`, `category`, `version`, `equipment`, `measurement`, optional `dumbbellCount`, `protocols`, support-role notes; future `muscles`, `instructions`, `cues`, `warnings`, `imageAssets` |
| `Routine` | `id`, `name`, `version`, `effectiveDate`, `weeklySchedule` |
| `RoutineExercise` | `exerciseId`, `day`, `sessionType`, `order`, `sets`, `repMin`, `repMax`, `targetDurationSec`, `perSide`, `restSec`, `loadKg`, `optional`, `notes` |
| `RoutineOverride` | `dailyHangGoalSec` stored separately from the bundled seed |
| `StrengthEntry` | `date`, `exerciseId`, `kind` (`emom` or `sets`), EMOM `totalReps` and applicable `load` or regular `sets` with each set's `reps` and `load`; new records also retain derived `externalKg`, while older records may have only `externalKg` |
| `CompletedSet` | `exerciseId`, `sequence`, `reps`, `side`, `notes`, and load components (`vestKg`, `dumbbellKgEach` / `dumbbellKg`, `ezBarTotalKg`, `bodyweightOnly` when relevant); later work may support variable dumbbell counts |
| `LegacyStrengthEntry` | Original aggregate `emom`, repetition `sets` or weight-only `load-sets`, including component or unclassified `externalKg` values |
| `PerformanceEntry` | `schemaVersion`, `date`, `period`, `exerciseId`, `format`, saved `definition`, saved `prescription`, and actual `rows` |
| `LegacyCompletedSet` | `exerciseId`, `sequence`, `reps`, `side`, `notes`, and load components (`vestKg`, `dumbbellKgEach` / `dumbbellKg`, `ezBarTotalKg`, `bodyweightOnly` when relevant); later work may support variable dumbbell counts |
| `HangAttempt` | `date`, `sessionId`, `exerciseId`, `attemptNumber`, `durationSec`, `completedAt`, `notes` (daily hangs distinct from Saturday finger hangs) |
| `BodyWeightLog` | `date`, `weightKg`, `notes` (optional entry) |
| `Settings` | `preferredUnit`, `dataSchemaVersion` |
The implementation may normalize or refine this model. **Do not treat the suggested shape as frozen API contracts.** TASK-014 now stores actual load components for the seeded strength exercises and derives total external kilograms; existing entries with only a total remain valid and unclassified. `dumbbellKgEach` represents each of two dumbbells; `dumbbellKg` represents one. TASK-005 may later support variable counts and additional recording. The 6 kg and 10 kg programme values are prescriptions, not assumed actuals.
New detailed entries live in `performanceEntries`, keyed by local date, period and exercise. The compound exercise/period/format index supports compatible previous-session queries. Each record has `schemaVersion: 1`, identity, format, a definition snapshot, a prescription snapshot and rows `{values, load, completed}`. Measurement keys are reps/leftReps/rightReps/seconds/leftSeconds/rightSeconds/metres as applicable; load keys are vestKg/dumbbellKgEach/dumbbellCount/ezBarTotalKg/straightBarTotalKg. Missing draft values are null, never assumed zero. Completion is derived only on explicit successful Save: fully filled valid rows are complete and incomplete rows remain drafts. Only valid completed rows contribute achieved totals. Historical snapshots are independent of current metadata.
The earlier `strengthEntries` store is kept verbatim, including aggregate EMOM, component sets, total-only sets and weight-only rows. It is exposed in an original-record disclosure with the existing explicit editor; new detailed entries do not overwrite or double-count it. There were no shipping backup files before TASK-015: adapter JSON v1 represents the two legacy stores and v2 all three. Import validates the complete file before opening one transaction, rejects unsupported versions/duplicate keys, and rolls back failed imports. Replacement is an explicit adapter option; TASK-009 owns confirmation and UI. The backup includes bundled reference data and saved snapshots; it does not overwrite the running seed or create a routine editor.
### 7.1 Tracking requirements (v1, agreed)
1. Save regular strength sets independently with actual reps and external weight, including 0 kg for bodyweight-only work. Preserve partial records and separate them from prescription values.
2. For EMOM pull-ups and chin-ups, save **total actual repetitions and vest weight** for the exercise. Keep the ten-minute, one-minute-round prescription visible without timing or per-round logging. Support conventional-set sessions when the user switches training format.
3. For weighted push-ups, track vest load (initial prescription 10 kg); for applicable leg exercises record actual vest and dumbbell load separately. Dumbbell flys record kilograms per dumbbell, without a vest field. No made-up actual weights.
1. Save regular strength sets independently with actual reps and external weight, without external-weight controls for bodyweight-only work. Explicit zero is valid where external resistance is supported. Preserve partial records and separate them from prescription values.
2. For EMOM pull-ups and chin-ups, save actual reps and vest weight per minute, with derived completed-rep totals. Keep the ten-minute protocol visible without running a timer. Support conventional-set sessions when the user switches training format.
3. For weighted push-ups, track vest load (initial prescription 10 kg); for applicable leg exercises record actual vest and dumbbell load separately. Dumbbell floor flys record kilograms per dumbbell with a fixed count of two, without vest or count fields. No made-up actual weights.
4. For daily hangs, track each timed attempt, longest single attempt, accumulated time across attempts, and progression toward the current editable goal (initially two minutes). Record Saturday finger-hang work separately.
5. For other timed workout activities (planks and carries), log **actual** duration rather than treating the prescribed value as achieved. Isometric holds do not require times. Per-side timing should remain distinguishable where relevant.
6. Later, suggest starting weights/reps from the previous matching exercise/session, but require user action before recording completion.
5. For other timed workout activities (planks and carries), log **actual** duration rather than treating the prescribed value as achieved. Incomplete hold drafts may omit times; completion requires actual durations. Record sides independently where relevant.
6. Offer Use previous session for compatible earlier detailed records. Fill only an empty current draft, reset completion, and never save automatically or reinterpret legacy totals.
7. Show dated exercise history, previous vs current performance and straightforward progress charts/personal bests (particularly vest load, reps, hang duration, optional body weight). Do not fabricate missing data or equate different loading modes in comparisons.
8. Never rewrite completed history following routine edits, reseeding, changes to exercise definitions or app upgrades. Future routine edits only change future prescriptions.
9. Export all workouts, hang attempts, plan edits, and optional body-weight records to a **versioned JSON backup**; validate on import and ask before overwriting/merging existing records.
10. Avoid external analytics and automatic calorie estimates; training data remains local and private.
11. For a workout's **total external-load volume** (kg·reps), sum `actual reps × actual external kilograms moved` across recorded regular sets and EMOM totals. External load includes recorded vest mass, actual dumbbell mass times count, and EZ-bar total as applicable; it excludes body weight. Do not invent missing load components. Show the formula and raw total, and mark partial or incomplete data. Timed holds and hangs do not contribute rep-load volume. Do not calculate volume per minute.
11. For a workout's **total external-load volume** (kg·reps), sum `actual reps × actual external kilograms moved` across completed detailed regular sets and each EMOM minute. Retain original aggregate calculations separately when displaying legacy history; do not count both representations together. External load includes recorded vest mass, actual dumbbell mass times count, and EZ/straight-bar total as applicable; it excludes body weight. Do not invent missing load components. Show the formula and raw total, and mark partial or incomplete data. Timed holds and hangs do not contribute rep-load volume. Do not calculate volume per minute.
### Data integrity and update rules
@@ -267,7 +270,7 @@ The implementation may normalize or refine this model. **Do not treat the sugges
- Calm, minimal, readable, keyboard-usable layout; neutral/dark styling with clear completion emphasis. Respect light/dark preference if feasible without a large theme system.
- The weekday strip and **Morning/Afternoon toggle** should be immediately visible. Display **only one selected session period** on screen, never both together.
- Exercise cards show: name, prescription, prescribed rest, load/vest preset, rep/weight entry for applicable strength work, and an expandable description/image view when details are implemented.
- Exercise cards show: name, prescription, relevant equipment, prescribed rest, only applicable actual logging controls, and an expandable detail view with available notes and missing-content/media placeholders.
- The persistent local time clock remains legible at phone and desktop widths.
- Avoid busy gamification, badges/streaks and unnecessary dashboards.
- Responsive at mobile widths; no horizontal scrolling for primary interaction.
@@ -285,7 +288,8 @@ Use separate Codex tasks and isolated branches/worktrees in the repository conte
| T004 | Exercise-detail screen and local media placeholders; accessibility | T002–T003 |
| T005 | Extend TASK-014 records with hangs, holds, other performance details and history-safe migrations | T014 |
| T006 | Superseded timer task; the local time clock and hang-goal editor remain | T003 |
| T014 | Remove timers; save EMOM total reps/weight and regular per-set reps/weight by date | T002–T003 |
| T014 | Completed timer-free original-format recording baseline | T002–T003 |
| T015 | Metadata-driven detailed sets/minutes/attempts; compatible storage and JSON adapter | T014 |
| T007 | Routine editor: reorder, adjust prescription, optional exercises, persistence | T005 |
| T008 | History and progress views (hang PB, loads, reps, total external-load volume), responsive/accessibility polish, offline/PWA build, test pass and documentation | T004–T007, T014 |
| T009 (content) | Produce and review licensed/local exercise illustrations for the actual variants | T004; may run separately |
@@ -297,16 +301,16 @@ Do not implement all tasks as a single unreviewed change. Define task boundaries
- [ ] Today defaults to current local calendar date; seven-day strip works across weeks; exclusive Morning/Afternoon toggle remembers its state and does not show both periods at once.
- [ ] Monday and Friday mornings show “Full body stretch routine” with no invented exercise entries; afternoon holds and hangs remain.
- [ ] The local time clock remains prominent and readable at phone and desktop widths while navigating the app.
- [ ] Tuesday pull-ups and Saturday chin-ups retain the **10 × 60-second EMOM** prescription and 6 kg vest presets, while actual total reps and external weight are recorded once for each exercise.
- [ ] Tuesday pull-ups and Saturday chin-ups retain the **10 × 60-second EMOM** prescription and 6 kg vest presets, while actual reps and vest weight are recorded independently each minute.
- [ ] Wednesday flys have **no floor-press drop set**; push-up plus precedes feet-elevated push-ups.
- [ ] Thursday includes single-leg RDLs and front planks, **not weighted floor crunches**.
- [ ] Saturday includes hanging knee raises, 2–3 finger-hang sets, preacher curls and hammer curls; **no EZ curls or wrist curls**.
- [ ] Sunday includes optional single-arm triceps extensions and side-plank hip raises.
- [ ] Afternoon isometric holds show no time targets; day-specific effort guidance remains.
- [ ] Daily afternoon hangs appear all seven days with an initially **2:00 goal** that can be changed and survives reload, but no invented achieved value or vest detail; multiple attempts produce longest-continuous and cumulative totals independently. Saturday finger hangs remain separate.
- [ ] Weight presets on pull-ups/chin-ups (6 kg) and weighted push-ups/vested leg work (10 kg) display correctly; dumbbell loads are **not invented**.
- [ ] Equipment capabilities contain no fixed weight. Historical 6/10 kg values remain prescription context only and do not determine inputs or prefill actuals.
- [ ] Users can enter vest and dumbbell loads separately, total EZ-bar load, per-side values, recorded reps, hold/carry durations, and optional body-weight entries.
- [ ] EMOM total reps and actual external weight, plus separate regular-set reps and weights, survive reload by date and exercise; prescribed values are never saved as performed automatically.
- [ ] EMOM minute reps/load and regular-set measurements/weights survive reload by date, period and exercise; prescribed values are never saved as performed automatically.
- [ ] Exercise-specific load components, hang attempts and untimed hold checkoffs can be extended without replacing existing strength records; old total-only entries remain available.
- [ ] Exercise history and simple progress charts display actual saved values; editing a future prescription leaves existing entries unchanged.
- [ ] Total external-load volume uses recorded reps and actual external weight without a time denominator; the display shows raw totals and flags partial or missing data.