diff --git a/frontend/src/index.css b/frontend/src/index.css
index ca20498..51b967c 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -647,8 +647,8 @@ h4.sec{
.setextra .chip.add:disabled{opacity:.35}
/* why the next target is what it is (issue #17) */
.progline{
- display:flex;align-items:flex-start;gap:7px;margin:6px 0 2px;
- font-size:13px;line-height:1.38;color:var(--acc);
+ width:100%;display:flex;align-items:flex-start;gap:7px;margin:6px 0 2px;padding:0;
+ text-align:left;font-size:13px;line-height:1.38;color:var(--acc);
}
.progline.warn{color:var(--yellow)}
.progline svg{flex:none;margin-top:2px}
diff --git a/frontend/src/lib/progression-copy.js b/frontend/src/lib/progression-copy.js
new file mode 100644
index 0000000..d642db2
--- /dev/null
+++ b/frontend/src/lib/progression-copy.js
@@ -0,0 +1,13 @@
+import { POLICY_NAME } from './progression.js'
+
+/**
+ * Presentation-only view of a progression result. The engine remains the source of truth for
+ * both the outcome and its explanation; this helper only makes the policy behind that result
+ * explicit in the workout guidance.
+ */
+export function progressionGuidance(plan) {
+ if (!plan?.why || plan.kind === 'off' || plan.policy === 'off') return null
+ const policyLabel = POLICY_NAME[plan.policy]
+ if (!policyLabel) return null
+ return { policyLabel, why: plan.why }
+}
diff --git a/frontend/src/lib/progression-copy.test.js b/frontend/src/lib/progression-copy.test.js
new file mode 100644
index 0000000..d49c050
--- /dev/null
+++ b/frontend/src/lib/progression-copy.test.js
@@ -0,0 +1,30 @@
+import { describe, expect, it } from 'vitest'
+import { progressionGuidance } from './progression-copy.js'
+
+describe('policy-labelled progression guidance', () => {
+ it('keeps the calculated outcome and identifies the policy that produced it', () => {
+ const why = ['Every rep last time — {0} {1} more.', 2.5, 'kg']
+
+ expect(progressionGuidance({ policy: 'linear', kind: 'up', weight: 62.5, why }))
+ .toEqual({ policyLabel: 'Linear progression', why })
+ })
+
+ it('labels hold and deload outcomes without changing their calculated reasons', () => {
+ const hold = ['Missed reps last time — same weight again ({0} of {1} to go).', 2, 3]
+ const deload = ['Missed reps — reset to {0} {1} and work back up.', 55, 'kg']
+
+ expect(progressionGuidance({ policy: 'double', kind: 'hold', why: hold }))
+ .toEqual({ policyLabel: 'Double progression', why: hold })
+ expect(progressionGuidance({ policy: 'greyskull', kind: 'deload', why: deload }))
+ .toEqual({ policyLabel: 'Greyskull LP', why: deload })
+ })
+
+ it('labels a baseline outcome and omits policies with no visible outcome', () => {
+ const baseline = ['Nothing logged yet — this session sets the baseline.']
+ expect(progressionGuidance({ policy: 'linear', kind: 'first', why: baseline }))
+ .toEqual({ policyLabel: 'Linear progression', why: baseline })
+ expect(progressionGuidance({ policy: 'off', kind: 'off' })).toBeNull()
+ expect(progressionGuidance({ policy: 'linear', kind: 'first' })).toBeNull()
+ expect(progressionGuidance(null)).toBeNull()
+ })
+})
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index 65a5de4..25be741 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -14,6 +14,7 @@ import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, topWeigh
import Icon from '../components/Icon.jsx'
import { Button, Check, NumberField } from '../components/ui.jsx'
import { nextPrescription, applyPrescription, defaultIncrement } from '../lib/progression.js'
+import { progressionGuidance } from '../lib/progression-copy.js'
import { glyphOf } from '../lib/glyphs.js'
import { isWarmupRow, isDropSet, isRestPauseSet, dropsOf, clustersOf, addDrop, addCluster, removeDropAt, removeClusterAt, setDropAt, setClusterAt, nextDropWeight, nextBurstReps } from '../lib/workout-model.js'
import { canMoveActiveWorkoutUnit, moveActiveWorkoutUnit } from '../lib/active-workout-order.js'
@@ -61,7 +62,7 @@ function Elapsed({ start }) {
}
/* ---------- one exercise block (reps: weight×reps · time: a held duration · cardio: duration+speed) ---------- */
-function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemoveSet, onAddWarmup, onRemoveSetAt, onStartTimed, onPairPrev, onPairNext, onSetRowRef }) {
+function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemoveSet, onAddWarmup, onRemoveSetAt, onStartTimed, onPairPrev, onPairNext, onSetRowRef, onProgressionSettings }) {
const S = useStore(s => s.S)
const update = useStore(s => s.update)
const working = useUI(s => s.work)
@@ -111,6 +112,7 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
// What the progression policy decided for this session, and why (issue #17). Computed when
// the session was built so the reason matches the numbers already in the rows.
const plan = entry.plan
+ const guidance = progressionGuidance(plan)
// A bodyweight set has no weight to type, so the column is not there (issue #32) — one
// stepper instead of two, which is the whole point of the flag. Adding a belt weight in the
// config brings it back, now labelled as the addition it is.
@@ -195,10 +197,11 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
}
{entry.note &&
{entry.note}
}
{last && {t('Last time')} ({fmtDate(last.d)}): {last.sets.map(s => setLabel(entry.id, s, last.target)).join(', ')}
}
- {plan && plan.why && plan.kind !== 'off' &&
+ {guidance &&
}
+ {t(guidance.policyLabel)} · {t(...guidance.why)}
+ }
{/* the header carries the same eff3 sizing as the rows, or the labels drift off their columns */}
{col1.hd}{col2 && {col2.hd}}{col3 && {col3.hd}}{timed && }
@@ -431,6 +434,23 @@ function ActiveWorkout() {
navigateUnit(dx < 0 ? 1 : -1)
}
+ const openProgressionSettings = idx => {
+ const state = useStore.getState().S
+ const entry = state.active?.entries?.[idx]
+ if (!entry) return
+ const routine = state.routines.find(r => r.id === state.active.routineId)
+ exConfigSheet(exOr(entry.id), entry.target, cfg => update(s => {
+ const activeEntry = s.active?.entries?.[idx]
+ if (!activeEntry) return
+ const full = { ...cfg, id: activeEntry.id }
+ const activeRoutine = s.routines.find(r => r.id === s.active.routineId)
+ const plan = nextPrescription(s, full, activeRoutine)
+ activeEntry.target = { ...cfg }
+ activeEntry.plan = plan
+ activeEntry.sets = applyPrescription(activeEntry.sets, plan, defaultIncrement(activeEntry.id, s.unit))
+ }), null, routine)
+ }
+
// Remove a whole exercise from the session. The confirmation always asks first; in a
// superset it asks WHICH exercise of the group to remove.
const removeExercise = removeActiveExercise
@@ -603,12 +623,12 @@ function ActiveWorkout() {
return
bindExRef(entry, el)} className="ss-ex" data-exidx={idx}>
{k > 0 &&
+
}
bindSetRef(entry, setIdx, el)}
- onToggle={i => toggle(idx, i)} onField={(i, f, v) => setField(idx, i, f, v)} onAddSet={() => addSet(idx)} onRemoveSet={() => removeSet(idx)} onAddWarmup={() => addWarmup(idx)} onRemoveSetAt={i => removeSetAt(idx, i)} onStartTimed={i => startTimed(idx, i)} />
+ onToggle={i => toggle(idx, i)} onField={(i, f, v) => setField(idx, i, f, v)} onAddSet={() => addSet(idx)} onRemoveSet={() => removeSet(idx)} onAddWarmup={() => addWarmup(idx)} onRemoveSetAt={i => removeSetAt(idx, i)} onStartTimed={i => startTimed(idx, i)} onProgressionSettings={() => openProgressionSettings(idx)} />
})}
) : (
- toggle(cur, i)} onField={(i, f, v) => setField(cur, i, f, v)} onAddSet={() => addSet(cur)} onRemoveSet={() => removeSet(cur)} onAddWarmup={() => addWarmup(cur)} onRemoveSetAt={i => removeSetAt(cur, i)} onStartTimed={i => startTimed(cur, i)} onPairPrev={onPairPrev} onPairNext={onPairNext} />
+ toggle(cur, i)} onField={(i, f, v) => setField(cur, i, f, v)} onAddSet={() => addSet(cur)} onRemoveSet={() => removeSet(cur)} onAddWarmup={() => addWarmup(cur)} onRemoveSetAt={i => removeSetAt(cur, i)} onStartTimed={i => startTimed(cur, i)} onPairPrev={onPairPrev} onPairNext={onPairNext} onProgressionSettings={() => openProgressionSettings(cur)} />
)}
> :
{t('Freestyle workout — add your first exercise.')}
}
diff --git a/frontend/src/views/Workout.test.jsx b/frontend/src/views/Workout.test.jsx
index dd17e03..72c0082 100644
--- a/frontend/src/views/Workout.test.jsx
+++ b/frontend/src/views/Workout.test.jsx
@@ -137,6 +137,13 @@ async function toggleSet(index) {
await act(async () => { checkbox.dispatchEvent(new dom.Event('click', { bubbles: true })) })
}
+async function pressProgression(index = 0) {
+ const button = container.querySelectorAll('.progline')[index]
+ expect(button).toBeTruthy()
+ await act(async () => { button.dispatchEvent(new dom.Event('click', { bubbles: true })) })
+ return button
+}
+
async function requestDiscard() {
const button = container.querySelector('button[aria-label="Discard"]')
expect(button).toBeTruthy()
@@ -428,6 +435,106 @@ describe('Workout discard timer lifecycle', () => {
})
})
+describe('progression guidance', () => {
+ it('labels the visible outcome with the policy that calculated it', async () => {
+ await mount([exercise('plain-bench', [false, false, false], {
+ plan: {
+ policy: 'linear',
+ kind: 'up',
+ weight: 62.5,
+ why: ['Every rep last time — {0} {1} more.', 2.5, 'kg'],
+ },
+ })])
+
+ expect(container.querySelector('.progline')?.textContent)
+ .toContain('Linear progression · Every rep last time — 2.5 kg more.')
+ })
+
+ it('is a keyboard-accessible button that opens settings for the pressed grouped entry', async () => {
+ const plan = {
+ policy: 'linear', kind: 'up', weight: 62.5,
+ why: ['Every rep last time — {0} {1} more.', 2.5, 'kg'],
+ }
+ const first = exercise('plain-bench', [false], { sg: 'group', plan })
+ const second = exercise('plain-bench', [false], {
+ sg: 'group', plan, target: { mode: 'reps', reps: 8, weight: 80, bodyweight: false },
+ })
+ await mount([first, second])
+ const firstBefore = JSON.stringify(mocks.S.active.entries[0])
+
+ const button = await pressProgression(1)
+
+ expect(button.tagName).toBe('BUTTON')
+ expect(button.getAttribute('type')).toBe('button')
+ expect(button.getAttribute('aria-label')).toBe('Open progression settings')
+ expect(mocks.exConfigSheet).toHaveBeenCalledOnce()
+ expect(mocks.exConfigSheet.mock.calls[0][1]).toBe(second.target)
+ expect(mocks.exConfigSheet.mock.calls[0][4]).toBe(mocks.S.routines[0])
+
+ mocks.exConfigSheet.mock.calls[0][2]({ ...second.target, prog: 'double', repsMin: 6 })
+ expect(JSON.stringify(mocks.S.active.entries[0])).toBe(firstBefore)
+ expect(mocks.S.active.entries[1].target.prog).toBe('double')
+ expect(mocks.S.active.cur).toBe(0)
+ })
+
+ it('leaves the active entry unchanged when progression settings are cancelled', async () => {
+ const entry = exercise('plain-bench', [true, false], {
+ plan: {
+ policy: 'linear', kind: 'up', weight: 62.5,
+ why: ['Every rep last time — {0} {1} more.', 2.5, 'kg'],
+ },
+ })
+ await mount([entry])
+ const before = JSON.stringify(mocks.S.active.entries[0])
+
+ await pressProgression()
+
+ expect(JSON.stringify(mocks.S.active.entries[0])).toBe(before)
+ })
+
+ it('saves the active policy, preserves completed rows, and refreshes guidance immediately', async () => {
+ const entry = exercise('plain-bench', [true, false], {
+ plan: {
+ policy: 'linear', kind: 'up', weight: 62.5,
+ why: ['Every rep last time — {0} {1} more.', 2.5, 'kg'],
+ },
+ })
+ await mount([entry])
+ mocks.S.workouts = [{
+ d: '2026-08-27',
+ entries: [{
+ id: entry.id,
+ target: { sets: 2, reps: 5, weight: 60 },
+ sets: [{ w: 60, r: 5, done: true }, { w: 60, r: 5, done: true }],
+ }],
+ }]
+ const completed = mocks.S.active.entries[0].sets[0]
+ await pressProgression()
+ const save = mocks.exConfigSheet.mock.calls[0][2]
+
+ await act(async () => {
+ save({ ...entry.target, prog: 'double', repsMin: 3 })
+ root.render(React.createElement(Workout))
+ })
+
+ const saved = mocks.S.active.entries[0]
+ expect(saved.target.prog).toBe('double')
+ expect(saved.sets[0]).toEqual(completed)
+ expect(saved.sets[0]).toEqual({ w: 60, r: 5, done: true })
+ expect(saved.sets[1]).toEqual({ w: 62.5, r: 3, done: false })
+ expect(container.querySelector('.progline')?.textContent)
+ .toContain('Double progression · Top of the rep range in every set — 2.5 kg more, back to 3 reps.')
+
+ const persisted = JSON.parse(JSON.stringify(mocks.S))
+ await unmount()
+ mocks.S = persisted
+ installDom()
+ await act(async () => { root.render(React.createElement(Workout)) })
+ expect(container.querySelector('.progline')?.textContent)
+ .toContain('Double progression · Top of the rep range in every set — 2.5 kg more, back to 3 reps.')
+ })
+})
+
describe('superset flow survives an exercise being removed mid-session', () => {
// removeActiveExercise splices A.entries, shifting every index above the removal down.
// The high-water marks are index-keyed, so without re-baselining the shifted exercise