Skip to content

fix: count each body region once per workout - #44

Merged
johnnyhuy merged 1 commit into
mainfrom
agent/issue-43-recovery-regions
Nov 12, 2026
Merged

johnnyhuy merged 1 commit into
mainfrom
agent/issue-43-recovery-regions

Conversation

@johnnyhuy

@johnnyhuy johnnyhuy commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

A recorded workout now applies one fatigue transition per distinct body region. Compound exercises and multiple exercises targeting the same region no longer mark it sore during the first session; separate sessions still increase fatigue.

Completes the per-workout region counting slice. Part of #5. Closes #43.

Verified locally with the repository gates, all exiting 0 after the fix.

  • mise run lint passed with 0 serious violations and 491 existing warnings.
  • mise run build passed.
  • mise run test passed with 151 XCTest tests and 22 Swift Testing tests, including the parameterised regression cases below and the existing video pipeline smoke checks.
  • git diff --check passed.
  • CI passed mise run build and mise run test on Linux, mise run lint and mise run ios:build:ci, mise run ios:coverage, and mise run ios:e2e. View the completed CI run.

The uploaded proof transcript records the local behaviour checks.

The regression run before the fix failed as expected. One squat targeting quads and glutes produced sore legs, where the regression expected fatigued legs.

􀢄  Test compoundExerciseFatiguesRegionOnce(_:) recorded an issue with 1 argument muscleGroups → [BetterFit.MuscleGroup.quads, BetterFit.MuscleGroup.glutes] at WorkoutRegionRecoveryTests.swift:20:9: Expectation failed: (recovery.regions → [BetterFit.BodyRegion.legs: BetterFit.RecoveryStatus.sore]) == ([.legs: .fatigued] → [BetterFit.BodyRegion.legs: BetterFit.RecoveryStatus.fatigued])
	 Executed 151 tests, with 2 failures (0 unexpected) in 2.518 (2.540) seconds

The final unit and integration test capture shows compound exercises, repeated muscles, several exercises in one session, separate workouts, pre-existing fatigue and untargeted regions. testCompleteWorkoutFlow checks the result through the BetterFit facade as well as history and streak updates.

Test Case '-[BetterFitTests.IntegrationTests testCompleteWorkoutFlow]' passed (0.126 seconds).
Test Case '-[BetterFitTests.RecoveryTests testBodyMapManager]' passed (0.001 seconds).
	 Executed 151 tests, with 0 failures (0 unexpected) in 2.249 (2.277) seconds
􁁛  Test compoundExerciseFatiguesRegionOnce(_:) with 3 test cases passed after 0.005 seconds.
􁁛  Test multipleExercisesFatigueEachTargetedRegionOnce() passed after 0.005 seconds.
􁁛  Test workoutsWithoutTargetMusclesLeaveRegionsUnchanged(_:) with 2 test cases passed after 0.005 seconds.
􁁛  Test separateWorkoutsStillEscalateFatigue() passed after 0.005 seconds.
􁁛  Test existingFatigueStillEscalates(_:) with 3 test cases passed after 0.005 seconds.
􁁛  Suite WorkoutRegionRecoveryTests passed after 0.005 seconds.
􁁛  Test run with 22 tests in 3 suites passed after 0.006 seconds.

No app UI or layout changed. Unit and integration output was the successful capture method for this core logic slice; local simulator screenshots and local XCUITest captures were not attempted. CI also passed the full simulator test suites. Scratch logs remain under .tmp/proof/ and are not committed.

The CI simulator capture also confirms the recovery insights screen still runs, with all 27 UI tests passing.

Test Case '-[BetterFitAppUITests.AdjustSetsUITests testRecoveryInsightsVisible]' passed (8.758 seconds).
	 Executed 27 tests, with 0 failures (0 unexpected) in 521.473 (521.502) seconds
** TEST SUCCEEDED **

Recovery timing, completed-set weighting, persisted historical fatigue values and equipment substitution remain follow-up work under #5. This change preserves the current API and Codable format.

Co-authored-by: OpenAI Codex <noreply@openai.com>
@johnnyhuy

Copy link
Copy Markdown
Contributor Author

Captured the recovery regression before and after the fix.

Before the fix

􀢄  Test compoundExerciseFatiguesRegionOnce(_:) recorded an issue with 1 argument muscleGroups → [BetterFit.MuscleGroup.quads, BetterFit.MuscleGroup.glutes] at WorkoutRegionRecoveryTests.swift:20:9: Expectation failed: (recovery.regions → [BetterFit.BodyRegion.legs: BetterFit.RecoveryStatus.sore]) == ([.legs: .fatigued] → [BetterFit.BodyRegion.legs: BetterFit.RecoveryStatus.fatigued])
	 Executed 151 tests, with 2 failures (0 unexpected) in 2.518 (2.540) seconds

After the fix

Test Case '-[BetterFitTests.IntegrationTests testCompleteWorkoutFlow]' passed (0.126 seconds).
Test Case '-[BetterFitTests.RecoveryTests testBodyMapManager]' passed (0.001 seconds).
	 Executed 151 tests, with 0 failures (0 unexpected) in 2.249 (2.277) seconds
􁁛  Test compoundExerciseFatiguesRegionOnce(_:) with 3 test cases passed after 0.005 seconds.
􁁛  Test multipleExercisesFatigueEachTargetedRegionOnce() passed after 0.005 seconds.
􁁛  Test workoutsWithoutTargetMusclesLeaveRegionsUnchanged(_:) with 2 test cases passed after 0.005 seconds.
􁁛  Test separateWorkoutsStillEscalateFatigue() passed after 0.005 seconds.
􁁛  Test existingFatigueStillEscalates(_:) with 3 test cases passed after 0.005 seconds.
􁁛  Suite WorkoutRegionRecoveryTests passed after 0.005 seconds.
􁁛  Test run with 22 tests in 3 suites passed after 0.006 seconds.

All final repository gates passed: mise run lint, mise run build, mise run test. No app UI changed.

@johnnyhuy
johnnyhuy merged commit 88d3de0 into main Nov 12, 2026
10 checks passed
@johnnyhuy
johnnyhuy deleted the agent/issue-43-recovery-regions branch November 12, 2026 19:42
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.

Count each body region once when recording a workout

1 participant