Repository navigation
Canonical equipment identity and equipment-independent exercises (#22) - #79
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #22.
What changes
public.equipmentis 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 asMachine (unknown model) — <gym>cover entries whose model was never recorded.public.equipment_gym_availabilitysays where a machine is available; it is not part of identity.session_exercises.canonical_equipment_idrecords the equipment per occurrence.Lateral Raise (Seated)andChest 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.gym_equipment,gym_equipment_idandequipment_idare left in place.EXERCISE_TO_MUSCLE_HYPERTROPHIC_RELEVANCE_CANONICAL.csv.Reversibility
20261017130000(equipment) and20261017130100(exercises). Every change is logged in the privateheracles_privateschema.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 bysupabase/tests/canonical_equipment_identity.test.sql.Validation
npm run agent:checkpasses 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
start_or_resume_workout_session, dropping the 2-arg version for a 4-arg one. Whichever lands second must carry the canonical-equipment default into the 4-arg function and adjust the captured signature in20261017130000.add_session_exercise,update_session_history_exercise,create_or_get_equipment), so apply the migrations and deploy the frontend together, after a backup. Not applied to the live project yet.