Allow same exercise in a routine - #53
Merged
Merged
Conversation
Adds test_import_csv_replaces_workout_exercises_growth_case to lock in the symmetric replace-not-merge contract for WorkoutExercise rows. The existing replace test only covers the shrink case (3 -> 2 exercises). A future 'partial-merge optimization' that only deletes WorkoutExercise rows whose exercise_name is absent from the new layout would silently break the grow case (1 + 3 should yield 3, not 4 leftover + 3 new). This test asserts the symmetric contract: re-import produces exactly the new layout, regardless of size delta. Passes on first run because Task 5's purge is already symmetric (deletes ALL existing WorkoutExercise rows for the workout, then re-inserts). Value is in regression-locking, not in surfacing a current bug.
The variable was initialized to 0, never read, never referenced in the response dict, and only suppressed by a 'noqa: F841 — kept for response- dict backward compat' comment that was a small lie to the reader. The response dict only references workout_exercises_created.
…raint - README.md: Add 'cp .env.example .env' as step 1 of Local Development Database. Update WORKOUT_EXERCISE schema description to note the (workout_id, exercise_id, exercise_index) unique key allows the same exercise at multiple positions. - AGENTS.md: Update 'State of the Codebase' to reflect the new constraint, occurrence-aware parser, three-column-key upsert, and replace-on-reimport behavior (was still describing pre-allow-same-exercise state). Add the .env copy step to Local Development. Update Architecture section's DB Schema note with the new constraint details.
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.
No description provided.