-
-
Notifications
You must be signed in to change notification settings - Fork 26
Fix stall detection to allow failure detection on first working rep #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -510,21 +510,20 @@ class DWSMWorkoutLifecycleTest { | |
| advanceUntilIdle() | ||
| assertIs<WorkoutState.Active>(harness.dwsm.coordinator.workoutState.value) | ||
|
|
||
| // Complete warmup and first working rep | ||
| // Complete warmup | ||
| completeWarmupReps(harness, warmupTarget = 3, workingTarget = 8) | ||
| completeFirstWorkingRep(harness, warmupTarget = 3, workingTarget = 8) | ||
| advanceUntilIdle() | ||
| assertTrue(harness.dwsm.coordinator.repCount.value.isWarmupComplete) | ||
| assertEquals(1, harness.dwsm.coordinator.repCount.value.workingReps) | ||
| assertEquals(0, harness.dwsm.coordinator.repCount.value.workingReps) | ||
|
|
||
| // Simulate starting a second rep (pending at TOP = failed bench press scenario) | ||
| // Simulate starting the first rep (pending at TOP = failed bench press scenario) | ||
| harness.fakeBleRepo.emitRepNotification( | ||
| RepNotification( | ||
| topCounter = 5, // warmup(3) + working(2) = 5th up counter | ||
| completeCounter = 4, // Only 4 downs (second working rep not completed) | ||
| topCounter = 4, // warmup(3) + working(1) = 4th up counter | ||
| completeCounter = 3, // Only 3 downs (first working rep not completed) | ||
| repsRomCount = 3, | ||
| repsRomTotal = 3, | ||
| repsSetCount = 1, // Still 1 completed working rep | ||
| repsSetCount = 0, // Still 0 completed working reps | ||
| repsSetTotal = 8, | ||
| rangeTop = 800f, | ||
| rangeBottom = 0f, | ||
|
|
@@ -571,17 +570,16 @@ class DWSMWorkoutLifecycleTest { | |
| assertIs<WorkoutState.Active>(harness.dwsm.coordinator.workoutState.value) | ||
|
|
||
| completeWarmupReps(harness, warmupTarget = 3, workingTarget = 8) | ||
| completeFirstWorkingRep(harness, warmupTarget = 3, workingTarget = 8) | ||
| advanceUntilIdle() | ||
|
|
||
| // Simulate pending rep (stalled mid-concentric) | ||
| // Simulate pending first rep (stalled mid-concentric) | ||
| harness.fakeBleRepo.emitRepNotification( | ||
| RepNotification( | ||
| topCounter = 5, | ||
| completeCounter = 4, | ||
| topCounter = 4, | ||
| completeCounter = 3, | ||
| repsRomCount = 3, | ||
| repsRomTotal = 3, | ||
| repsSetCount = 1, | ||
| repsSetCount = 0, | ||
|
Comment on lines
+575
to
+582
|
||
| repsSetTotal = 8, | ||
| rangeTop = 800f, | ||
| rangeBottom = 0f, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The KDoc contradicts the implementation: it states the
hasPendingRepguard was removed from deferral, but the updated logic explicitly uses!repCount.hasPendingRepto decide deferral. Please rewrite the Issue #256 note to reflect the actual change (i.e., deferral was narrowed to only when no rep is pending), and clarify what 'must be protected' means here (protected from deferral vs. protected from false positives) to avoid confusion for future maintainers.