Docker etant redevenu disponible dans cette session, j'ai pu lancer pour de vrai la suite Mocha d'apps/api (334/334, y compris les tests Phase 1/2 qui n'avaient pu etre executes precedemment) ainsi que les scripts de la Phase 5 contre une vraie base de test. - tech-step-eval-dataset.ts : corrige un vrai bug d'auteur - "Take the plates..." collisionnait avec le synonyme anglais enregistre "plates" (technique plate), invalidant ce cas negatif. Remplace par "dishes". - tech-step-eval-runner.ts : F1 reel mesure = 0.815 (33 TP / 9 FP / 6 FN). Documente ce chiffre et les vraies erreurs de classification decouvertes (ex: "Blanchissez les haricots verts..." classifie a tort comme "peel") - des faiblesses reelles du classifieur que ce harness est cense detecter, pas a masquer en ajustant le jeu de test. - retrain-tech-steps.ts : le script loggait `appliedIds.length`/ `rejectedIds.length` (ce qui a ete demande) au lieu du `count` reel retourne par `updateMany` (ce qui a vraiment ete modifie) - un id inexistant faisait afficher un faux succes. Decouvert en executant le script pour de vrai avec des ids partiellement invalides. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
import { expect } from "chai";
|
|
import { prisma } from "../../src/db/prisma.js";
|
|
import {
|
|
MIN_OVERALL_F1,
|
|
runTechStepEvalSuite,
|
|
} from "../../src/lib/recipe-matching/tech-step-eval-runner.js";
|
|
import { resetDatabase } from "../../test-support/reset-db.js";
|
|
|
|
/**
|
|
* Regression gate for `TECH_STEP_TRAINING_DATA` — every change to that
|
|
* corpus (including a maintainer applying suggestions from
|
|
* `TechStepTrainingSuggestion`, see `scripts/retrain-tech-steps.ts`) must
|
|
* keep this suite green. Runs {@link runTechStepEvalSuite} (the real
|
|
* trained classifier against `tech-step-eval-dataset.ts`) and asserts the
|
|
* aggregate F1 doesn't fall below {@link MIN_OVERALL_F1} — see that
|
|
* constant's own doc comment (`tech-step-eval-runner.ts`) for the real run
|
|
* it was calibrated against.
|
|
*/
|
|
|
|
describe("tech-step-eval", () => {
|
|
beforeEach(async () => {
|
|
await resetDatabase();
|
|
});
|
|
|
|
after(async () => {
|
|
await prisma.$disconnect();
|
|
});
|
|
|
|
it(`scores at least ${MIN_OVERALL_F1} aggregate F1 against the labeled evaluation set`, async () => {
|
|
const { overall, byKey } = await runTechStepEvalSuite();
|
|
|
|
expect(
|
|
overall.f1,
|
|
`aggregate F1 ${overall.f1.toFixed(3)} (precision ${overall.precision.toFixed(3)}, recall ${overall.recall.toFixed(3)}) fell below the ${MIN_OVERALL_F1} floor — per-technique breakdown: ${JSON.stringify(byKey)}`,
|
|
).to.be.at.least(MIN_OVERALL_F1);
|
|
});
|
|
});
|