eb30074792
- .claude/rules/registry_calls.md - apps/dag_engine/README.md - apps/dag_engine/app.md - docs/capabilities/INDEX.md - docs/capabilities/systemd.md - docs/execution_standard.md - dev/proposals_e2e_checks_0121/ - docs/capabilities/backends.md Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
117 lines
5.3 KiB
YAML
117 lines
5.3 KiB
YAML
# e2e_checks proposal — registry_api
|
|
#
|
|
# app_id: registry_api
|
|
# lang: go
|
|
# stack: net/http, CGO+FTS5, SQLite (mattn/go-sqlite3), replace fn-registry => ../../
|
|
# date: 2026-05-19
|
|
# issue: 0121 (design-e2e fn-recopilador)
|
|
#
|
|
# Diagnostico del stack:
|
|
# - entry_point: main.go (acepta --port N y --db PATH)
|
|
# - health endpoint: GET /api/status (sin auth, siempre 200 + JSON {"status":"ok",...})
|
|
# - auth layer: checkToken() en handleSync solamente; Traefik basicAuth en prod (no
|
|
# aplica en e2e local). /api/status, /api/search, /api/locations NO tienen auth.
|
|
# - no hay *_test.go => check "tests" omitido
|
|
# - operations.db no declarada para esta app => ops_audit omitido
|
|
# - puerto prod 8420 => e2e usa 8521 para no colisionar
|
|
#
|
|
# Instrucciones de adopcion:
|
|
# 1. Copiar el bloque "e2e_checks:" al frontmatter de apps/registry_api/app.md
|
|
# (justo antes del primer "##" de la seccion de prosa).
|
|
# 2. Revisar que el binario compilado quede en apps/registry_api/registry_api
|
|
# (el build check lo deja ahi por convencian).
|
|
# 3. El check auth_check requiere que REGISTRY_API_TOKEN este seteada en el
|
|
# entorno de test; si no lo esta, /api/sync devuelve 200 (token desactivado).
|
|
# Ajustar severity a "warning" si el CI no tiene la variable disponible.
|
|
#
|
|
# NOTA: NO escribir directo al app.md — propuesta para revision humana.
|
|
|
|
e2e_checks:
|
|
# --- build ---
|
|
# Compila el binario localmente con CGO+FTS5. El replace directive en go.mod
|
|
# apunta a ../../ (raiz del registry), por lo que el build debe lanzarse
|
|
# desde dentro del directorio de la app.
|
|
- id: build
|
|
cmd: "cd /home/lucas/fn_registry/apps/registry_api && CGO_ENABLED=1 go build -tags fts5 -o registry_api ."
|
|
timeout_s: 120
|
|
severity: critical
|
|
# por que: sin binario el resto de checks no tiene sentido; fallo de build
|
|
# indica cambio de API en fn-registry (replace) o dep rota.
|
|
|
|
# --- smoke ---
|
|
# Arranca el servidor con una BD efimera en /tmp y espera que responda en
|
|
# /api/status. Puerto 8521 (!=8420 prod, !=8420 dev) para no colisionar.
|
|
# El proceso en background se mata al terminar la suite por fn-analizador.
|
|
- id: smoke
|
|
cmd: "/home/lucas/fn_registry/apps/registry_api/registry_api -port 8521 -db /tmp/registry_api_e2e.db &"
|
|
health: "http://127.0.0.1:8521/api/status"
|
|
timeout_s: 10
|
|
severity: critical
|
|
# por que: tag 'service' => gate minimo es que el binario arranca y sirve
|
|
# el health endpoint. Sin esto no tiene sentido probar endpoints de negocio.
|
|
|
|
# --- status_json ---
|
|
# Verifica que /api/status devuelve JSON con campo "status":"ok".
|
|
# Distingue un servidor arrancado de uno en modo degradado.
|
|
- id: status_json
|
|
cmd: "curl -sf http://127.0.0.1:8521/api/status"
|
|
expect_stdout_contains: '"status":"ok"'
|
|
timeout_s: 5
|
|
severity: critical
|
|
# por que: el health check del smoke solo valida HTTP 200; este check
|
|
# valida ademas el contrato de respuesta JSON.
|
|
|
|
# --- search_open ---
|
|
# Verifica que /api/search acepta GET sin auth y devuelve JSON valido.
|
|
# Usa q=test para tener un resultado predecible (siempre devuelve arrays).
|
|
- id: search_open
|
|
cmd: "curl -sf 'http://127.0.0.1:8521/api/search?q=test'"
|
|
expect_stdout_contains: '"functions"'
|
|
timeout_s: 5
|
|
severity: critical
|
|
# por que: /api/search es el endpoint mas usado por fn sync y el MCP.
|
|
# Fallo aqui indica problema de FTS5 o schema de registry.db.
|
|
|
|
# --- search_missing_q ---
|
|
# Verifica que /api/search sin q= devuelve 400 (validacion de entrada).
|
|
- id: search_missing_q
|
|
cmd: "curl -s -o /dev/null -w '%{http_code}' 'http://127.0.0.1:8521/api/search'"
|
|
expect_stdout_contains: "400"
|
|
timeout_s: 5
|
|
severity: warning
|
|
# por que: regression guard para la validacion de parametros obligatorios.
|
|
|
|
# --- auth_check ---
|
|
# Verifica que POST /api/sync rechaza requests con token incorrecto cuando
|
|
# REGISTRY_API_TOKEN esta seteada. Usa credencial falsa conocida.
|
|
# IMPORTANTE: si REGISTRY_API_TOKEN no esta en el entorno de e2e, el servidor
|
|
# responde 200 (token desactivado por diseno). En ese caso este check pasa
|
|
# igualmente (exit 0 de curl) pero no valida auth real — ajustar a warning
|
|
# o setear la variable antes de correr la suite.
|
|
- id: auth_check
|
|
cmd: >
|
|
REGISTRY_API_TOKEN=real-secret
|
|
/home/lucas/fn_registry/apps/registry_api/registry_api -port 8522 -db /tmp/registry_api_e2e_auth.db &
|
|
sleep 1 &&
|
|
STATUS=$(curl -s -o /dev/null -w '%{http_code}'
|
|
-X POST http://127.0.0.1:8522/api/sync
|
|
-H 'Content-Type: application/json'
|
|
-H 'X-Registry-Token: wrong-token'
|
|
-d '{"pc_id":"e2e"}') &&
|
|
kill %1 2>/dev/null; [ "$STATUS" = "401" ]
|
|
timeout_s: 15
|
|
severity: warning
|
|
# por que: /api/sync es el unico endpoint protegido por token de aplicacion.
|
|
# Fallo indica regresion en checkToken(). Severity warning porque en CI sin
|
|
# REGISTRY_API_TOKEN el comportamiento es abierto por diseno.
|
|
|
|
# --- locations_open ---
|
|
# Verifica que /api/locations devuelve JSON sin requerir auth.
|
|
- id: locations_open
|
|
cmd: "curl -sf http://127.0.0.1:8521/api/locations"
|
|
expect_stdout_contains: "["
|
|
timeout_s: 5
|
|
severity: warning
|
|
# por que: /api/locations es consumido por fn sync locations; fallo indica
|
|
# problema en db.ListAllPcLocations() o schema de pc_locations.
|