Une seule feature livree en une seule PR, en 5 phases : - Phase 1 : enrichit le corpus NLP (tech-step-training-data.ts) et ajoute un harness d'evaluation (precision/rappel/F1) avec un jeu de test etiquete - la premiere metrique objective de qualite pour ce classifieur. - Phase 2 : schema Prisma (StepTechStepCorrection, TechStepTrainingSuggestion) + endpoints utilisateur (POST/GET corrections, ouverts a tout viewer, pas seulement l'auteur) + endpoints internes /internal/tech-steps/* proteges par secret partage (requireInternalWorker). - Phase 3 : UI de highlight/correction cote web (selection de texte -> association a une technique, ou clic sur un highlight existant pour le corriger/supprimer) - verifiee via Cypress (component + e2e, en Chrome reel). - Phase 4 : worker LLM autonome (services/tech-step-llm-worker, hors du monorepo pnpm comme experiments/llm-tech-step-poc) qui audite les clauses a faible confiance et transforme les corrections utilisateur en suggestions d'entrainement, sans jamais toucher le chemin interactif. - Phase 5 : script retrain-tech-steps.ts (gate de regression F1 + backfill) et list-pending-training-suggestions.ts pour la revue humaine avant application au corpus. Verification effectuee cette session : tsc/biome sur l'ensemble du repo, build complet (pnpm build), suite Cypress complete (component 39/39, e2e 75/76 - le seul echec est preexistant et sans rapport, cote recipe-form.feature/ingredient-picker), tests unitaires du worker (6/6) et son install/typecheck reels contre node-llama-cpp. Les tests Mocha d'apps/api (Phases 1 et 2) n'ont pas pu etre executes dans cette session (pas de Postgres local disponible) - a lancer avant merge. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
81 lines
3.5 KiB
YAML
81 lines
3.5 KiB
YAML
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
restart: unless-stopped
|
|
environment:
|
|
# No defaults on purpose: POSTGRES_USER/PASSWORD/DB must be set in your
|
|
# local, git-ignored .env (see .env.example). Compose fails loudly if
|
|
# they're missing instead of falling back to a guessable credential.
|
|
POSTGRES_USER: ${POSTGRES_USER:?set POSTGRES_USER in .env}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}
|
|
POSTGRES_DB: ${POSTGRES_DB:?set POSTGRES_DB in .env}
|
|
ports:
|
|
- "${POSTGRES_PORT:-5432}:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# Single service serving both the API and the built frontend (see
|
|
# apps/api/Dockerfile) — no separate nginx/web container, no cross-origin
|
|
# CORS_ORIGIN to keep in sync between two ports.
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: apps/api/Dockerfile
|
|
restart: unless-stopped
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
environment:
|
|
NODE_ENV: production
|
|
PORT: 3000
|
|
# Uses the "postgres" service name, not localhost/POSTGRES_PORT —
|
|
# container-to-container traffic stays on the compose network and
|
|
# always targets Postgres's internal port (5432).
|
|
DATABASE_URL: "postgresql://${POSTGRES_USER:?set POSTGRES_USER in .env}:${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}@postgres:5432/${POSTGRES_DB:?set POSTGRES_DB in .env}?schema=public"
|
|
JWT_SECRET: ${JWT_SECRET:?set JWT_SECRET in .env}
|
|
# Unset by default (falls back to NODE_ENV === "production", i.e.
|
|
# Secure cookie required) — set COOKIE_SECURE=false in .env only if
|
|
# this deployment is reachable over plain HTTP (no TLS in front of
|
|
# it yet), otherwise the session cookie never comes back and every
|
|
# authenticated request 401s despite login succeeding. See its doc
|
|
# comment in apps/api/src/config/env.ts.
|
|
COOKIE_SECURE: ${COOKIE_SECURE:-}
|
|
# Shared with the `tech-step-llm-worker` service below — see
|
|
# requireInternalWorker's doc comment
|
|
# (apps/api/src/middlewares/require-internal-worker.ts). Unset by
|
|
# default: `/internal/tech-steps/*` fails closed rather than open
|
|
# for a deployment that doesn't run the worker at all.
|
|
INTERNAL_WORKER_SECRET: ${INTERNAL_WORKER_SECRET:-}
|
|
ports:
|
|
- "${APP_PORT:-3000}:3000"
|
|
|
|
# Deliberately its own image, not built into `app`'s (see
|
|
# services/tech-step-llm-worker/Dockerfile's own doc comment) — a
|
|
# long-lived process with no exposed port (nothing ever calls *into* it,
|
|
# it only ever calls out to `app`). Optional: an `INTERNAL_WORKER_SECRET`-
|
|
# less deployment can omit this service entirely and `app` still runs
|
|
# fine, just without the offline audit/feedback-loop jobs.
|
|
tech-step-llm-worker:
|
|
build:
|
|
context: .
|
|
dockerfile: services/tech-step-llm-worker/Dockerfile
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- app
|
|
environment:
|
|
API_BASE_URL: "http://app:3000"
|
|
INTERNAL_WORKER_SECRET: ${INTERNAL_WORKER_SECRET:?set INTERNAL_WORKER_SECRET in .env to run this service}
|
|
TECH_STEP_WORKER_CRON: ${TECH_STEP_WORKER_CRON:-0 3 * * 0}
|
|
volumes:
|
|
# GGUF weights persist across restarts — see this service's own
|
|
# Dockerfile doc comment on its VOLUME declaration.
|
|
- tech_step_llm_worker_models:/worker/models
|
|
|
|
volumes:
|
|
postgres_data:
|
|
tech_step_llm_worker_models:
|