Coach: der Kern, den beide Laufzeiten laden koennen
payload, validate, parse, die Prompt-Montage, der Plan-Fingerprint und die invoke→parse→validate→repair-Schleife ziehen nach api/coach/core/ — ohne node:*, damit das Handy sie spaeter genauso importiert wie der Server. Die Bibliothek und die Prompts werden als ES-Module generiert (scripts/build-coach-assets.mjs), weil weder createRequire noch ?raw unter beiden Laufzeiten laden. Das Pseudonym wird uebergeben statt abgeleitet (handle.js behaelt den HMAC). check-core-loadable prueft unter blankem node, was vitest strukturell nicht pruefen kann.
This commit is contained in:
1 parent
4a9e1e3456
commit
697f1b1269
27 files changed
+402
-204
No files matched your search
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { modeOf as uiModeOf, isBw as uiIsBw, isPerSide as uiIsPerSide } from './history.js'
|
||||
import { modeOf as srvModeOf, isBw as srvIsBw, isPerSide as srvIsPerSide } from '../../../api/coach/payload.js'
|
||||
import { modeOf as srvModeOf, isBw as srvIsBw, isPerSide as srvIsPerSide } from '../../../api/coach/core/payload.js'
|
||||
import { exOr } from './exercises.js'
|
||||
|
||||
// Real ids from the catalogue, so `eq`/`bp` are whatever the dataset actually says rather than
|
||||
|
||||
@@ -9,8 +9,8 @@ import { registerCustom } from './exercises.js'
|
||||
|
||||
// The two runtimes share no build step, so the client's copy of the fingerprint logic is
|
||||
// checked against the server's actual source rather than against a transcribed expectation.
|
||||
import * as serverPayload from '../../../api/coach/payload.js'
|
||||
import { hashPlan as serverHashPlan } from '../../../api/coach/jobs.js'
|
||||
import * as serverPayload from '../../../api/coach/core/payload.js'
|
||||
import { hashPlan as serverHashPlan } from '../../../api/coach/core/plan-hash.js'
|
||||
|
||||
const state = (over = {}) => ({
|
||||
unit: 'kg', lang: 'en', customEx: [], workouts: [], bodyweight: [], exWeights: {}, dayPlan: {},
|
||||
@@ -138,7 +138,7 @@ describe('staleness', () => {
|
||||
|
||||
describe('applying changes', () => {
|
||||
it('has an implementation for every type the server can send', async () => {
|
||||
const { CHANGE_TYPES: serverTypes } = await import('../../../api/coach/validate.js')
|
||||
const { CHANGE_TYPES: serverTypes } = await import('../../../api/coach/core/validate.js')
|
||||
expect([...CHANGE_TYPES].sort()).toEqual([...serverTypes].sort())
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user