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:
1 parent
f554b6b004
commit
ba412cb36d
5 files changed
+16
-7
No files matched your search
@@ -1,7 +1,11 @@
|
||||
// Pure helpers over the state object S (ported 1:1 from the vanilla app).
|
||||
import { todayISO, isoOf, weekKey, fmtNum } from './format.js'
|
||||
import { isCardio, isBodyweightEq } from './exercises.js'
|
||||
import { t } from './i18n.js'
|
||||
// i18n-core, not i18n: this file is imported by mcp/, which is plain Node with no Vite and no
|
||||
// React. i18n.js is the Vite half — import.meta.glob over the locale packs, useSyncExternalStore
|
||||
// for the hook — and it re-exports this very `t` from core, so nothing changes here except what
|
||||
// gets dragged along behind it.
|
||||
import { t } from './i18n-core.js'
|
||||
|
||||
// How an exercise is logged (issue #16). This used to be derived from the body part alone,
|
||||
// which meant a plank or a farmer's carry could only be timed by filing it under cardio.
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
//
|
||||
// Like the demo build, MOBILE is replaced at build time, so all of this folds away in
|
||||
// web bundles; the Capacitor plugins are only ever imported behind it.
|
||||
import { t } from './i18n.js'
|
||||
import { t } from './i18n-core.js'
|
||||
|
||||
export const MOBILE = import.meta.env.VITE_MOBILE === '1'
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import { EXIDX, isBodyweightEq } from './exercises.js'
|
||||
import { modeOf, fmtSec, isBw, isPerSide, sideReps } from './history.js'
|
||||
import { uid, todayISO, DAYN, fmtNum, exCount } from './format.js'
|
||||
import { t } from './i18n.js'
|
||||
import { t } from './i18n-core.js'
|
||||
|
||||
const PLAN_FMT = 1
|
||||
const WEEK_ORDER = [1, 2, 3, 4, 5, 6, 0] // Mon-first, matching the Plan screen
|
||||
|
||||
+1
-1
@@ -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'
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user