Skip to content

feat: apply equipment swaps to a specific workout entry - #79

Merged
johnnyhuy merged 1 commit into
mainfrom
agent/issue-78-entry-equipment-swap
Nov 14, 2026
Merged

johnnyhuy merged 1 commit into
mainfrom
agent/issue-78-entry-equipment-swap

Conversation

@johnnyhuy

@johnnyhuy johnnyhuy commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Adds EquipmentSwapManager.applySwap(workout:workoutExerciseId:newExercise:) so callers can replace one occurrence of a repeated exercise using its workout entry ID. The replacement preserves entry identity, sets, notes and all other workout data; the existing exercise-ID API keeps its first-match behaviour.

Completes the entry-specific swap application slice. Part of #5. Closes #78.

Verified locally with the repository gates.

  • mise run lint passed with 491 existing warnings and zero serious violations.
  • mise run build passed.
  • mise run test passed all 23 pipeline checks, 169 XCTest tests and 79 Swift Testing tests. The seven new test functions are listed in the transcript below; the missing-entry test covers empty and populated workouts.
  • git diff --check passed.
  • CI mise run build and mise run test passed on Linux in the SwiftPM job.
  • CI mise run lint and mise run ios:build:ci passed in the iOS build job.
  • CI mise run ios:coverage passed all 27 XCUITests in the UI coverage job.
  • CI mise run ios:e2e passed with one flaky test and three passed in the mobile e2e job. The first active-workout test failed its initial foreground check and passed on its internal retry. This existing issue remains tracked in Stabilise first app launch in mobile e2e on CI #62.
  • All CodeQL and Socket checks passed.

Unit test capture succeeded. This excerpt from .tmp/proof/issue-78-test.log shows selecting the second occurrence of a repeated exercise without changing workout data, targeting by identity after reordering, applying another replacement to the same entry, rejecting missing or incorrect IDs without mutation, and retaining compatibility with the existing API. Terminal glyphs were removed.

==> summary: 23 passed, 0 failed
Executed 169 tests, with 0 failures (0 unexpected) in 2.314 (2.343) seconds
Test legacyOverloadStillReplacesFirstMatchingExercise() passed after 0.020 seconds.
Test doesNotUseExerciseDefinitionIdAsWorkoutEntryId() passed after 0.020 seconds.
Test selectsEntryByIdentityAfterReordering() passed after 0.020 seconds.
Test replacesOnlySelectedRepeatedEntryAndPreservesWorkoutData() passed after 0.018 seconds.
Test keepsEntryAddressableAfterAReplacement() passed after 0.018 seconds.
Test legacyOverloadLeavesWorkoutUnchangedWhenExerciseIsMissing() passed after 0.017 seconds.
Test leavesWorkoutUnchangedWhenEntryIsMissing(empty:) with 2 test cases passed after 0.017 seconds.
Suite WorkoutEntrySwapTests passed after 0.022 seconds.
Test run with 79 tests in 11 suites passed after 0.024 seconds.

The CI UI coverage job and retained result bundle show the host app still runs its existing flows.

Executed 27 tests, with 0 failures (0 unexpected) in 382.236 (382.251) seconds
** TEST SUCCEEDED **

The mobile e2e log and retained report retain the initial foreground readiness failure and successful retry. No app or e2e files changed in this slice.

Error: app did not come to foreground
at resetAndLaunch (tests/helpers.ts:60:13)
start workout, log a set, rest timer appears (retry #1) passed
1 flaky
3 passed (5.0m)

No app UI or user-facing app behaviour changed. Simulator screenshots and local UI tests were not required; no capture method was blocked. The first lint attempt stopped at mise's trust check for the new worktree; after mise trust, the lint command passed. Scratch captures are not committed.

App wiring, entry-aware suggestion result types, movement equivalence and load adjustment remain follow-up slices. Both application APIs accept the caller's selected replacement without validating equipment availability or muscle matching. Sets and loads remain unchanged. Parent #5 remains open.

Co-authored-by: OpenAI Codex <noreply@openai.com>
@johnnyhuy
johnnyhuy merged commit ab44f69 into main Nov 14, 2026
10 checks passed
@johnnyhuy
johnnyhuy deleted the agent/issue-78-entry-equipment-swap branch November 14, 2026 23:39
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.

Apply equipment swaps to a specific workout entry

1 participant