Coach: der Fall ohne Vorgeschichte, und was der Validator durchgelassen hat
common.md wird jedem Prompt vorangestellt, also galt Regel 5 -- "jede Begruendung nennt das, was in ihren Daten dafuer sprach" -- auch beim ersten Plan fuer jemanden, der noch nichts geloggt hat. Da gibt es nichts zu nennen, und die Regel hat das Modell genau dorthin gedraengt, wo es sich etwas ausdenkt. Neu steht dabei, worauf man sich stattdessen beruft: Ziel, Erfahrung, Tage, Ausruestung, Einschraenkungen -- und dass ein fehlendes window kein Fehler ist. review.md sagt jetzt ausserdem, dass ohne Sessions die ehrliche Antwort nochange ist, statt einen Grund zu erfinden. repsMax stand im Validator, aber in keiner Tabelle -- das Modell konnte einen Typ nicht verwenden, den wir akzeptieren. payload.js laesst history ganz weg, wenn nichts mit Gewicht geloggt ist. Damit lief die FR-20-Deckelung ins Leere und ein erfundenes Startgewicht ging unveraendert an einen Anfaenger durch. Ohne Vergleichswerte fliegt weight jetzt raus; die erste Session setzt die Basis, so wie create.md es ohnehin verspricht. Dazu vier Luecken, die alle dieselbe Form haben -- etwas wird gezaehlt oder gesetzt, aber nicht auf Eindeutigkeit geprueft: - Zwei Routinen mit derselben id: known ist ein Set, die Woche validierte, ohne dass feststand, welche der beiden gemeint ist. - Dieselbe Uebung zweimal in einer Routine: danach ist jedes reorder unerfuellbar (es verlangt jede id genau einmal) und jede gezielte Aenderung trifft die erste Kopie. - Eine leere Woche uebersprang die Tagesanzahl-Pruefung ganz: "vier Tage" wurde mit einem Plan beantwortet, der gar nichts einplant. - inc war nach oben offen. add-routine trug ausserdem repsMin, prog und inc nicht mit, obwohl der Bundle-Pfad sie kennt. Die drei Codex-Flags sind aus invoke() in ein exportiertes argvFor() gewandert und werden jetzt beim Wert geprueft. Sie waren vorher nirgends getestet -- eines davon zu loeschen war ein gruener Build.
This commit is contained in:
1 parent
ad82db415a
commit
5fb237682b
6 files changed
+141
-13
No files matched your search
@@ -11,6 +11,7 @@ import { tempData } from './helpers.mjs';
|
||||
tempData();
|
||||
const { adapterFor, default: ADAPTERS } = await import('../coach/adapters/index.js');
|
||||
const { LOCKDOWN } = await import('../coach/adapters/claude.js');
|
||||
const { argvFor } = await import('../coach/adapters/codex.js');
|
||||
const cfg = await import('../coach/config.js');
|
||||
|
||||
test('every provider the config offers has an adapter, and vice versa', () => {
|
||||
@@ -68,3 +69,18 @@ test('the Codex credential cache is a sibling of ./data, never inside it', () =>
|
||||
cfg.save({ enabled: true, provider: 'claude' });
|
||||
assert.equal(cfg.jobEnv('/tmp/job', { ok: true }).CODEX_HOME, undefined);
|
||||
});
|
||||
|
||||
test('the Codex adapter runs with the three flags that keep host state out of a job', () => {
|
||||
// Same reasoning as the Claude lockdown above: these are not stylistic. --ignore-user-config
|
||||
// stops $CODEX_HOME/config.toml being an admin-invisible input to every job, --ephemeral stops
|
||||
// session files being written, and --skip-git-repo-check is what lets the bare mkdtemp job dir
|
||||
// run at all. Dropping any of them was a green build before this test existed.
|
||||
assert.deepEqual(argvFor(null), [
|
||||
'exec', '-', '--skip-git-repo-check', '--ephemeral', '--ignore-user-config'
|
||||
]);
|
||||
});
|
||||
|
||||
test('a configured model is appended, and nothing else is', () => {
|
||||
assert.deepEqual(argvFor('o4-mini').slice(-2), ['--model', 'o4-mini']);
|
||||
assert.equal(argvFor('o4-mini').length, argvFor(null).length + 2);
|
||||
});
|
||||
@@ -284,3 +284,76 @@ test('every allowed change type has a validator that accepts a well-formed insta
|
||||
assert.equal(r.ok, true, `${type} should validate: ${JSON.stringify(r.errors)}`);
|
||||
}
|
||||
});
|
||||
|
||||
/* ---- ambiguity the closed list did not previously catch ---- */
|
||||
|
||||
test('two routines cannot answer to the same id', () => {
|
||||
// `known` is a Set, so a week pointing at "r1" validated while it was ambiguous which of the
|
||||
// two it meant — and the client resolves it by whichever happened to be found first.
|
||||
const r = validatePlan({
|
||||
routines: [
|
||||
{ id: 'r1', name: 'A', ex: [{ id: '0001', sets: 3, reps: 10 }] },
|
||||
{ id: 'r1', name: 'B', ex: [{ id: '0002', sets: 3, reps: 10 }] }
|
||||
],
|
||||
week: { 1: 'r1' }
|
||||
});
|
||||
assert.equal(r.ok, false);
|
||||
assert.ok(r.errors.some(e => e.includes('already used')));
|
||||
});
|
||||
|
||||
test('an auto-assigned routine id cannot collide with an explicit one', () => {
|
||||
const r = validatePlan({
|
||||
routines: [
|
||||
{ name: 'A', ex: [{ id: '0001', sets: 3, reps: 10 }] }, // becomes "r0"
|
||||
{ id: 'r0', name: 'B', ex: [{ id: '0002', sets: 3, reps: 10 }] }
|
||||
]
|
||||
});
|
||||
assert.equal(r.ok, false);
|
||||
});
|
||||
|
||||
test('one exercise cannot appear twice in the same routine', () => {
|
||||
// A duplicate makes every later reorder unsatisfiable — it must list each id exactly once —
|
||||
// and makes a targeted change resolve to whichever copy comes first.
|
||||
const r = validatePlan({
|
||||
routines: [{ name: 'A', ex: [{ id: '0001', sets: 3, reps: 10 }, { id: '0001', sets: 4, reps: 8 }] }]
|
||||
});
|
||||
assert.equal(r.ok, false);
|
||||
assert.ok(r.errors.some(e => e.includes('twice')));
|
||||
});
|
||||
|
||||
test('a plan with no week at all does not satisfy a requested day count', () => {
|
||||
// The day-count check used to be skipped entirely when the week was empty, so "four days a
|
||||
// week" was answered with a plan that schedules nothing.
|
||||
const r = validatePlan(
|
||||
{ routines: [{ id: 'r1', name: 'A', ex: [{ id: '0001', sets: 3, reps: 10 }] }] },
|
||||
{ daysPerWeek: 4 }
|
||||
);
|
||||
assert.equal(r.ok, false);
|
||||
assert.ok(r.errors.some(e => e.includes('0 days')));
|
||||
});
|
||||
|
||||
test('a starting weight is dropped when there is nothing logged to justify it', () => {
|
||||
// With no working weights the FR-20 cap has nothing to clamp against, so an invented number
|
||||
// used to pass straight through to a lifter the model has never seen.
|
||||
const r = validatePlan(
|
||||
{ routines: [{ id: 'r1', name: 'A', ex: [{ id: '0001', sets: 3, reps: 10, weight: 100 }] }], week: { 1: 'r1' } },
|
||||
{ daysPerWeek: 1 }
|
||||
);
|
||||
assert.equal(r.ok, true);
|
||||
assert.equal(r.bundle.routines[0].ex[0].weight, undefined);
|
||||
});
|
||||
|
||||
test('a starting weight still survives when there is history to cap it against', () => {
|
||||
const r = validatePlan(
|
||||
{ routines: [{ id: 'r1', name: 'A', ex: [{ id: '0001', sets: 3, reps: 10, weight: 100 }] }], week: { 1: 'r1' } },
|
||||
{ daysPerWeek: 1, workingWeights: [{ id: '0002', best: 60 }] }
|
||||
);
|
||||
assert.equal(r.ok, true);
|
||||
assert.equal(r.bundle.routines[0].ex[0].weight, 100);
|
||||
});
|
||||
|
||||
test('a load step has an upper bound', () => {
|
||||
const r = validatePlan({ routines: [{ name: 'A', ex: [{ id: '0001', sets: 3, reps: 10, inc: 500 }] }] });
|
||||
assert.equal(r.ok, true);
|
||||
assert.equal(r.bundle.routines[0].ex[0].inc, undefined); // absurd step dropped, plan kept
|
||||
});
|
||||
Reference in new issue
Block a user