Combine routines (ENG-9) phase 1: data model + pure helpers

Model A, no new entity. Per-entry noProg replaces the whole-workout
excludeFromProgression flag; the planner day slot and the active/saved
session widen to routine-id lists. No migration — every reader tolerates
the old scalar shape.

- session-start.js: buildSessionEntries returns a bare array, stamps
  entry.noProg (only when true) instead of an { entries, excluded } wrapper.
- session-merge.js (new): buildCombinedEntries(st, routineIds) concatenates
  N routines' entries in order and stamps entry.rid; deriveSessionName.
- history.js: entryExcluded(w, entry) predicate; effectiveRoutineIds /
  effectiveRoutines plural primaries with thin singular wrappers;
  lastEntryFor skips excluded entries (retires the buildWorkSets `regular`
  wrapper); nextTrainingDay iterates the day's routines.
- progression.js: sessionsFor drops the whole-workout return for a
  per-entry entryExcluded check — the file's only exclusion path.
- finish-workout.js: carries rid/noProg onto saved entries; writes
  routineIds + routineId mirror; excludeFromProgression mirror iff every
  completed entry is noProg.
- plan-share.js: week schedule is a routine-id list through build / parse /
  merge / print; [].concat tolerates a legacy scalar bundle value.
- mcp/tools.js, sheets.jsx loadStarterPlan: adjust to the new shapes.

Unit tests for every changed helper (session-merge new; progression cases
1-7; history 8-16; finish-workout 17-19; plan-share 20-22). Fixtures in
sheets.starter / coach migrated to the list shape.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JVbWJtoyQU4WgwFR4eAKgy
This commit is contained in:
HenryandClaude Sonnet 5 committed 2026-09-06 19:27:24 +01:00
1 parent f97fcbccd7
commit 1c877173f4
16 files changed
+504 -65

No files matched your search

+1 -1
View File
@@ -466,7 +466,7 @@ export const previewSession = {
// The same builder the app starts a session with (sheets.jsx beginWorkout → session-start.js):
// prescription, step, progression-off targets, deload routines and warm-up ramps all come from
// there, so the preview cannot drift from what the screen shows.
const built = buildSessionEntries(S, r).entries
const built = buildSessionEntries(S, r)
const exercises = (r.ex || []).map((cfg, i) => {
const ex = exerciseOf(cfg.id, S)
const mode = modeOf({ ...cfg, id: cfg.id })