Files
fn_registry/cpp/scripts/check_tested.sh
T
egutierrez cbc0714c80 chore(cpp/scripts): update_goldens.sh y check_tested.sh
- update_goldens.sh: build primitives_gallery + lanza --capture sobre
  cpp/tests/golden/ con LIBGL_ALWAYS_SOFTWARE=1.
- check_tested.sh [days]: CI gate que falla si una funcion C++ creada en
  los ultimos N dias (default 30) no tiene tested:true en su .md. Hookeado
  al final de run_tests.sh. No-op si registry.db no existe.

Issue 0048.
2026-04-29 00:18:45 +02:00

29 lines
997 B
Bash
Executable File

#!/usr/bin/env bash
# CI gate (issue 0048): falla si una funcion C++ creada en los ultimos N dias
# no tiene `tested: true` en su frontmatter del .md.
#
# Uso:
# cpp/scripts/check_tested.sh [days] # default: 30
#
# Requiere que registry.db este actualizada (corre `fn index` antes).
set -euo pipefail
DAYS="${1:-30}"
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
DB="$ROOT/registry.db"
if [ ! -f "$DB" ]; then
echo "WARN: registry.db not found at $DB; run 'fn index' first."
exit 0
fi
UNTESTED=$(sqlite3 "$DB" \
"SELECT id FROM functions WHERE lang='cpp' AND tested=0 \
AND (created_at IS NULL OR created_at > datetime('now','-${DAYS} days'));")
if [ -n "$UNTESTED" ]; then
echo "FAIL: las siguientes funciones C++ recientes no tienen tested:true en .md:"
echo "$UNTESTED"
echo ""
echo "Anade un test (cpp/tests/test_<name>.cpp) y marca el frontmatter del .md con tested:true."
exit 1
fi
echo "OK: todas las funciones C++ recientes (<= ${DAYS}d) tienen tests."