Skip to content

Canonical equipment identity and equipment-independent exercises (#22) - #79

Merged
NeoLorenzo merged 2 commits into
mainfrom
claude/fix-22-canonical-equipment-4daadb
Oct 17, 2026
Merged

NeoLorenzo merged 2 commits into
mainfrom
claude/fix-22-canonical-equipment-4daadb

Conversation

@NeoLorenzo

Copy link
Copy Markdown
Owner

Closes #22.

What changes

  • Canonical equipment. public.equipment is owner-scoped with one row per real piece of equipment. Dumbbell, Barbell, EZ Bar and Bodyweight are generic and usable at every gym. Machines are specific models. Placeholders such as Machine (unknown model) — <gym> cover entries whose model was never recorded. public.equipment_gym_availability says where a machine is available; it is not part of identity. session_exercises.canonical_equipment_id records the equipment per occurrence.
  • Exercise identity without equipment. 139 catalogue rows become 116 canonical exercises, for example Lateral Raise (Seated) and Chest Press (Incline 30). Merged rows are retired (is_active = false) under their original names. New published scientific versions use documented scoring sources, and the machine incline chest presses are aligned with the bench presses. Decision record: docs/scientific/issue-22-canonical-exercise-identity.json.
  • History. Historical rows are repointed and logged. Entries with no equipment get the equipment their old name stated. Cable exercises logged with a free-weight implement (the EZ-bar attachment) move to the cable station placeholder. Weights, reps, RIR, dates and gyms are untouched. Legacy gym_equipment, gym_equipment_id and equipment_id are left in place.
  • App. Live workout, Session History (equipment dropdown instead of free text), My Data (one series per exercise × canonical equipment across gyms), previous performance (matches across gyms) and per-dumbbell units (taken from the recorded equipment) all use the new model. The public showcase uses the canonical names via EXERCISE_TO_MUSCLE_HYPERTROPHIC_RELEVANCE_CANONICAL.csv.

Reversibility

  • Two migrations: 20261017130000 (equipment) and 20261017130100 (exercises). Every change is logged in the private heracles_private schema.
  • heracles_private.issue22_undo_exercise_identity() reverts step 2. heracles_private.issue22_undo_canonical_equipment() then reverts step 1 and restores the replaced RPC definitions. Both are exercised by supabase/tests/canonical_equipment_identity.test.sql.

Validation

npm run agent:check passes locally with the clean bootstrap database (syntax, 199 node tests, all pgTAP suites). A read-only preview against production data matches the reviewed plan: 97 → 74 equipment entries, 620 entries backfilled, 37 cable pushdowns corrected.

Before merging / deploying

Equipment is now one owner-scoped record per real piece of equipment
(public.equipment); gyms only record where machines are available
(public.equipment_gym_availability). Exercise names no longer encode
equipment: 139 catalogue rows become 116 canonical exercises, with merged
rows retired and new scientific versions published from documented scoring
sources (docs/scientific/issue-22-canonical-exercise-identity.json).

Two separately reversible migrations log every change; tested undo
functions live in heracles_private. Live workout, Session History, My Data
and previous-performance lookups use canonical equipment, and per-dumbbell
units follow the recorded equipment. The public showcase reads a canonical
projection of the relevance source.
…#22)

The EZ-bar cable attachment was logged as the free-weight EZ Bar. Cable
exercises whose recorded equipment is a generic implement now point at the
cable station: the per-gym 'Cable (unknown model)' placeholder when none was
recorded. Corrections are logged, the snapshot is kept, and the undo restores
the original equipment.
@NeoLorenzo
NeoLorenzo merged commit dd3d00b into main Oct 17, 2026
1 check 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.

Normalize canonical equipment identity across gyms and separate equipment from exercise identity

1 participant