Skip to content

Fix/689 stop at top per exercise leak - #692

Merged
9thLevelSoftware merged 3 commits into
mainfrom
fix/689-stopAtTop-per-exercise-leak
Aug 4, 2026
Merged

Fix/689 stop at top per exercise leak#692
9thLevelSoftware merged 3 commits into
mainfrom
fix/689-stopAtTop-per-exercise-leak

Conversation

@9thLevelSoftware

Copy link
Copy Markdown
Owner

No description provided.

Devil added 3 commits August 1, 2026 08:43
Three WorkoutParameters.copy() transition sites in autoplay omitted
stopAtTop and repCountTiming, causing per-exercise 'end at the top'
and rep count timing settings to leak from one exercise to all
subsequent exercises in a routine.

Added explicit propagation from the next RoutineExercise at:
- DefaultWorkoutSessionManager.proceedFromSummary (autoplay OFF path)
- ActiveSessionEngine.startRestTimer (rest timer → next set)
- ActiveSessionEngine.startNextSetOrExercise (autoplay ON path)

Fixes #689
…ropagation

Issue #689: Adds a focused regression test that verifies
proceedFromSummary() propagates stopAtTop and repCountTiming
from the next RoutineExercise when transitioning between exercises
(autoplay OFF path). Without the fix from commit 8dc3fcf, the first
exercise's values would leak to all subsequent exercises.

Addresses Copilot review feedback on PR #690.
Copilot AI review requested due to automatic review settings August 4, 2026 02:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

* stopAtTop and repCountTiming values with the next RoutineExercise's values.
*/
@Test
fun startNextSet_propagatesPerExerciseStopAtTopAndRepCountTiming() = runTest {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 The Roast: Commit 3 "autoplay coverage" is actually a bait-and-switch — it removed the proceedFromSummary regression test from commit 2 and replaced it with a startNextSet test that exercises the same startNextSetOrExercise copy block. Net regression coverage of #689 is unchanged: exactly one of three fixed transition sites is defended. The other two — DWSM.proceedFromSummary (line 940) and ActiveSessionEngine.startRestTimer (line 4447) — are now running naked through production with nothing but the author's good intentions protecting them. If someone reverts just one of those two lines in three months, CI will smile and ship a regression right back into users' workouts.

🩹 The Fix: Keep this test (it covers the autoplay-ON path). Then add a second test that drives the proceedFromSummary site (call harness.dwsm.proceedFromSummary() while WorkoutState.SetSummary is active with _currentSetIndex at the last set) and asserts the next exercise's stopAtTop/repCountTiming propagate. That's the minimal addition to put regression bars back on all three sites named in the PR description.

The startRestTimer site is harder to drive from a unit harness, so an integration-level test is acceptable there — but at minimum the proceedFromSummary site deserves a direct regression test since commit 2 had one and commit 3 silently deleted it.

📏 Severity: warning

@kilo-code-bot

kilo-code-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Roast 🔥

Verdict: Warning Found | Recommendation: Add regression test for proceedFromSummary site before merge

Overview

Severity Count
🚨 critical 0
⚠️ warning 1
💡 suggestion 0
🤏 nitpick 0
Issue Details (click to expand)
File Line Roast
shared/src/commonTest/.../DWSMRoutineFlowTest.kt 867 Test commit swaps coverage from proceedFromSummary site to startNextSet site (both exercise the same startNextSetOrExercise block), leaving startRestTimer and proceedFromSummary with zero direct regression coverage out of the three sites the PR description claims to fix.

🏆 Best part: The fix at line 4855 of ActiveSessionEngine.kt mirrors the existing pattern in RoutineFlowManager.kt (lines 845, 1108, 1183, 1428) — same fields, same nextExercise source, same intent. Consistency like that is rarer than a polite code-review exchange.

💀 Worst part: The PR description names three sites; the post-commit-3 test covers one of them — and not even a new one, just a swap. Net regression coverage of #689 is exactly what it was before commit 2 added a test: nil for two of three sites. The commit message "cover autoplay per-exercise timing transition" is doing a lot of verbal heavy lifting that the diff doesn't back up.

📊 Overall: The bug fix itself is tight and correct — six lines, three sites, two fields, matching the established project pattern. The test churn across commits 2 and 3 is what drags this from "clean fix" to "needs one more test before it ships." Add the proceedFromSummary regression, and this is a fast approve.

Files Reviewed (3 files)
  • shared/src/commonMain/kotlin/com/devil/phoenixproject/presentation/manager/ActiveSessionEngine.kt - 0 issues (lines 4447–4448 and 4855–4856 are correctly minimal and match project pattern)
  • shared/src/commonMain/kotlin/com/devil/phoenixproject/presentation/manager/DefaultWorkoutSessionManager.kt - 0 issues (lines 940–941 follow same pattern)
  • shared/src/commonTest/kotlin/com/devil/phoenixproject/presentation/manager/DWSMRoutineFlowTest.kt - 1 issue (coverage regression on swapped test)

Fix these issues in Kilo Cloud


Reviewed by minimax-m3 · Input: 48.6K · Output: 8K · Cached: 415.6K

Review guidance: REVIEW.md from base branch main

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 614b18ed0a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

assertEquals(RepCountTiming.TOP, harness.dwsm.coordinator.workoutParameters.value.repCountTiming)

// Simulate a completed rest countdown advancing from exercise 0 to exercise 1.
harness.setActiveSummaryCountdownSeconds(0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Enable autoplay in the autoplay regression test

Setting summaryCountdownSeconds to 0 disables autoplay (SettingsManager.autoplayEnabled is derived from summaryCountdownSeconds != 0). Consequently, startNextSet() follows the manual enterSetReady path, which already copies stopAtTop and repCountTiming in RoutineFlowManager; this test therefore still passes if the new autoplay propagation in ActiveSessionEngine is removed. Use a nonzero countdown, as the existing autoplay tests do, so this regression test actually exercises and protects the changed production path.

Useful? React with 👍 / 👎.

@9thLevelSoftware

Copy link
Copy Markdown
Owner Author

@codex Address all comments

@chatgpt-codex-connector

Copy link
Copy Markdown

Summary

Testing

  • git diff --check
  • ./gradlew -Pskip.supabase.check=true :shared:tasks --all
  • ⚠️ ./gradlew -Pskip.supabase.check=true :shared:testAndroidHostTest --tests 'com.devil.phoenixproject.presentation.manager.DWSMRoutineFlowTest' (Android SDK location is not configured in the environment.)
  • git status --short --branch (clean working tree after commit)

View task →

@9thLevelSoftware
9thLevelSoftware merged commit d5c7691 into main Aug 4, 2026
16 checks passed
@9thLevelSoftware
9thLevelSoftware deleted the fix/689-stopAtTop-per-exercise-leak branch August 4, 2026 03:04
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.

2 participants