MCP: die Lib bleibt unter reinem Node ladbar, und die Testwerte stimmen wieder

Der MCP-Server ist ein nacktes `node src/index.js` — kein Vite, kein React. PR 19
hatte dafuer den reinen Kern nach i18n-core.js gezogen; v1.2.4 hat danach in
history.js `t` wieder aus i18n.js geholt, und damit import.meta.glob ueber die
Locale-Packs plus useSyncExternalStore in einen Prozess, der beides nicht hat.
Der Server starb beim Import:

  TypeError: (intermediate value).glob is not a function

Die Testsuite konnte das nicht sehen: vitest transformiert import.meta.glob, also
liefen 33 gruene Tests gegen ein Binary, das nie startet. i18n.js re-exportiert
ohnehin genau dieses `t` aus dem Kern — history.js, mobile.js und plan-share.js
holen es jetzt direkt von dort, und mitgeschleppt wird nichts mehr.

Dazu die Werte, die der v1.2.4-Seed verschoben hat: Volumen 18500 → 18412.5
(Handsumme w×r ueber die zwanzig erledigten Saetze), Koerpergewicht 78.6 → 78.4,
Wiegung 78.5/1.5 → 78.3/1.3, Dauer 51 min → 1h 11m — samt der Zusicherung, die
sich das "N min"-Format noch fest verdrahtet hatte. Jeder Wert nachgerechnet,
nicht aus einem roten Lauf abgeschrieben.

Und das FORMULAS aus Punkt 2 des Reviews, das als einziges stehengeblieben war.
This commit is contained in:
Duarte Santos committed 2026-08-04 16:30:34 +02:00
1 parent f554b6b004
commit ba412cb36d
5 files changed
+16 -7

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@ import {
} from '../../frontend/src/lib/history.js'
import { EXIDX, exOr } from '../../frontend/src/lib/exercises.js'
import {
estimate1RM, best1RM, e1rmSeries, FORMULAS, DEFAULT_FORMULA, REP_CAP
estimate1RM, best1RM, e1rmSeries, DEFAULT_FORMULA, REP_CAP
} from '../../frontend/src/lib/onerm.js'
import { loadOfWorkouts, rankOf, levelsOf } from '../../frontend/src/lib/muscles.js'
+8 -3
View File
@@ -12,8 +12,11 @@ import { TOOLS } from '../src/tools.js'
// the demo state's exact values.
const FAKE_TODAY_ISO = '2026-07-27' // Monday — Push Day is scheduled
const GOAL_WEIGHT = 77
const NEWEST_WORKOUT = { date: '2026-07-24', name: 'Leg Day', volume: 18500, bw: 78.6, sets_done: 20, sets_total: 20, duration_min: 51 }
const LATEST_BW = { date: '2026-07-27', weight: 78.5, delta: 1.5 }
// Re-pinned against the v1.2.4 seed, which moved when the demo learned about bodyweight work
// and effort. Hand-checked rather than copied off a failing run: 18412.5 is the sum of w×r
// over the twenty completed sets, and 1.3 is 78.3 − 77.
const NEWEST_WORKOUT = { date: '2026-07-24', name: 'Leg Day', volume: 18412.5, bw: 78.4, sets_done: 20, sets_total: 20, duration: '1h 11m' }
const LATEST_BW = { date: '2026-07-27', weight: 78.3, delta: 1.3 }
const LEG_PRESS_ID = '0739' // sled 45° leg press in the demo data
const LEG_PRESS_BEST = { w: 152.5, r: 12, epley: 213.5, brzycki: 219.6 }
@@ -207,7 +210,9 @@ describe('list_workouts', () => {
expect(r.workouts[0].sets_done).toBe(NEWEST_WORKOUT.sets_done)
expect(r.workouts[0].sets_planned).toBe(NEWEST_WORKOUT.sets_total)
expect(r.workouts[0].sets_ratio).toBe(`${NEWEST_WORKOUT.sets_done}/${NEWEST_WORKOUT.sets_total}`)
expect(r.workouts[0].duration).toBe(`${NEWEST_WORKOUT.duration_min} min`)
// Past the hour the lib switches format, so the expectation carries the rendered string
// rather than assuming a "N min" shape that only held while the session was shorter.
expect(r.workouts[0].duration).toBe(NEWEST_WORKOUT.duration)
expect(r.workouts[0].bodyweight_at_workout).toBe(NEWEST_WORKOUT.bw)
r.workouts.forEach(w => {
expect(w.sets_done).toBeLessThanOrEqual(w.sets_planned)