Skip to content

fix(progression): an imported session is graded on all of its sets - #349

Merged
DuarteSantos8 merged 1 commit into
DuarteSantos8:mainfrom
kurktchiev:gh/import-grading
Oct 7, 2026
Merged

DuarteSantos8 merged 1 commit into
DuarteSantos8:mainfrom
kurktchiev:gh/import-grading

Conversation

@kurktchiev

Copy link
Copy Markdown
Contributor

After a Hevy or CSV import, the first weight the app suggests for a lift can come from the light early sets. A session logged as 40/50/60/70/80 × 5 reads as a 60 kg session when the routine asks for 3 sets today, and the next prescription is 62.5.

#233 grades only the sets the plan asked for, and readSession takes that count from (entry && entry.target) || fallback. The importers write no target, and neither did anything logged before v1.2.2. For those entries the count comes from the exercise's current config, which sessionsFor passes in as the fallback, so the slice keeps the first three rows of a session that was never planned as three sets.

readSession now slices only when the entry carries its own target. An entry without one is graded on every work set, which is how it was read before #233. enough, the goal and the mode still come from the fallback, as before. api/coach/core/payload.js has its own copy of readSession and gets the same one-line rule, so the Coach's stall count keeps agreeing with the app.

Tests:

  • progression.extra-sets.test.js: The ramp above reads 80 kg, and nextPrescription after it is 82.5. On the old progression.js they read 60 and 62.5. The file's 8 tests pass.
  • payload-parity.test.js: An imported session whose fourth set falls short is a miss on both sides. It fails with either copy reverted. 4 pass.
  • Also run: progression.test.js, assisted, exercise-history, progression-copy, session-start, coach-parity, import-hevy, import-csv, RoutineEdit.progression and Workout.noprog (410 tests across 11 files with the extra-sets file), Workout.test.jsx (119), mcp/test/tools.test.js (63), and api payload, payload-bounds, cohort, review-repair, jobs and prompts (76). All pass.

Overlaps:

🤖 Generated with Claude Code

After a Hevy or CSV import, the first weight the app suggests for a lift
can come from the light early sets. A session logged 40/50/60/70/80 x 5
reads as a 60 kg session when the routine asks for 3 sets today, and the
next prescription is 62.5.

DuarteSantos8#233 grades only the sets the plan asked for, and readSession takes that
count from `target`: `(entry && entry.target) || fallback`. The
importers write no target, and neither did anything logged before
v1.2.2, so for those the count is the exercise's current config, which
sessionsFor passes as the fallback. The slice then keeps the first three
rows of a session nobody planned as three sets.

readSession now slices only when the entry carries its own target. An
entry without one is graded on every work set it has, as it was before
DuarteSantos8#233. api/coach/core/payload.js keeps its own copy of readSession and
gets the same rule, so the Coach's stall count agrees with the app.

progression.extra-sets.test.js: the ramp reads 80 (was 60) and the next
prescription is 82.5 (was 62.5); both fail on the old progression.js.
payload-parity.test.js: an imported session with a short fourth set is
a miss on both sides; it fails with either copy reverted.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@DuarteSantos8
DuarteSantos8 merged commit d32f157 into DuarteSantos8:main Oct 7, 2026
3 of 4 checks passed
@DuarteSantos8

Copy link
Copy Markdown
Owner

Merged and released in v1.3.10, thanks @kurktchiev!

https://github.com/DuarteSantos8/openGym/releases/tag/v1.3.10

@kurktchiev
kurktchiev deleted the gh/import-grading branch October 9, 2026 15:34
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