Repository navigation
fix: don't raise the weight in double progression before the top of the range - #297
Conversation
…range Double progression should only add weight once every set reaches the top of the rep range. But the code checked "last.ok", which just means the session matched whatever reps were recorded as its own target - and the very first session for a fresh exercise (or one mid-climb) has that target seeded below the top of the range. Hitting exactly that many reps was read as a full hit and the weight went up right away, before the range was ever climbed. Fixes DuarteSantos8#278. Add a test that reproduces it: a first session at the bottom of the range (8 of a 8-12 range) must not trigger "up". Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
This fixes the immediate weight-increase symptom. I ran into the same Opened PR#301 which fixes the stored value at the source instead, so all three |
|
Thanks for the quick PR and fix. I really appreciate you taking the time to sort this out. |
…per routine, edited plans restart (#275, #216, #278, #297) # Conflicts: # frontend/src/lib/pt-br-locale.test.js # frontend/src/locales/de.js # frontend/src/locales/es.js # frontend/src/locales/fr.js # frontend/src/locales/hi.js # frontend/src/locales/hu.js # frontend/src/locales/it.js # frontend/src/locales/ko.js # frontend/src/locales/pl.js # frontend/src/locales/pt-BR.js # frontend/src/locales/pt.js # frontend/src/locales/ru.js # frontend/src/locales/th.js # frontend/src/locales/tr.js # frontend/src/locales/zh.js
|
Thanks @bluzername, merged as it was, and it fixes #278. One correction to the description, for anyone reading this later: a genuine first double-progression session is stamped at the top of the range, so 3×8 there already holds. The path #278 hit is a bottom stamped after an "up", for example history at 8 reps under linear followed by a switch to double 8–12. Your @tdsnxsuplewski-mateusz's #301 goes after the same root cause for the stall count and the deload. I've answered there. Released in v1.3.9: https://github.com/DuarteSantos8/openGym/releases/tag/v1.3.9 |
Fixes #278.
What was wrong
Double progression should only add weight when every set reaches the top of
the rep range. The code checked
last.ok, but that only means the sessionmatched whatever reps were recorded as its own target for that session -
not that it reached the top of the range. A fresh exercise's first session
gets its target seeded at the bottom of the range (8 of an 8-12 range,
say). Doing exactly 8 reps in every set matched that target, so it read as
a full hit and the weight went up right away, before the range was ever
climbed. This matches the report in #278 exactly: 3 sets of 8 (the bottom
of an 8-12 range) triggered the weight step on the very next session.
The fix
In the
doublepolicy branch ofnextPrescription, only treat a sessionas earning more weight when it also reached the top of the range
(
last.low >= top), not just when it matched its own recorded target.Test
Added a test in
frontend/src/lib/progression.test.js:"does not raise the weight for a session that only matched its own
recorded target, short of the top of the range (issue #278)" - builds a
history where the recorded target is the bottom of the range (8) and all
sets hit exactly 8, and asserts the next prescription is not
up.I confirmed it fails on unmodified code (
expected 'up' not to be 'up')and passes after the fix.
Verification
cd frontend && npx vitest run src/lib/progression.test.js- 97/97 pass(was 96/97 with the new test added before the fix, RED confirmed by
temporarily reverting the fix).
cd frontend && npx vitest run- full suite, 1573 tests, all pass (afew files hit a vitest worker-pool timeout under sandboxed CI-like
parallelism and pass cleanly when run alone - not related to this
change).
No new dependency, one file of production code touched
(
frontend/src/lib/progression.js), plus its test file.This account (bluzername) is not a collaborator on this repo, so I can't
merge - opening this for a maintainer to review.
🤖 Generated with Claude Code