72 lines
3.5 KiB
Bash
Executable File
72 lines
3.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
|
|
ROOT="${ROOT:-/var/www/dhv2.korexlabs.com}"
|
|
API_URL="${API_URL:-http://127.0.0.1:3101/api/v3}"
|
|
TMP_MIGRATION="/tmp/dhv2-d539-accept-migration-$$.log"
|
|
trap 'rm -f "$TMP_MIGRATION"' EXIT
|
|
cd "$ROOT"
|
|
|
|
echo "========== D5.3.9 · VERSIONES =========="
|
|
[[ "$(node -p "require('./api-v3/package.json').version")" == "0.19.3-9" ]]
|
|
[[ "$(node -p "require('./web-v2/package.json').version")" == "0.19.3-9" ]]
|
|
grep -Fq "API_PHASE = 'D5.3.9'" api-v3/src/version.ts
|
|
grep -Fq "APP_PHASE = 'Fase D5.3.9 · Revisión obligatoria clara'" web-v2/src/config/version.ts
|
|
echo "API: 0.19.3-9"
|
|
echo "WEB: 0.19.3-9"
|
|
|
|
echo
|
|
echo "========== D5.3.9 · DB Y MIGRACIONES =========="
|
|
[[ "$(docker inspect dhv2-db --format '{{.State.Health.Status}}')" == "healthy" ]]
|
|
docker compose exec -T db sh -lc 'pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB"'
|
|
docker compose --profile tools run --rm migrate npm run migration:show 2>&1 | tee "$TMP_MIGRATION"
|
|
grep -Fq 'Pending migrations: no' "$TMP_MIGRATION"
|
|
|
|
echo
|
|
echo "========== D5.3.9 · HEALTH =========="
|
|
HEALTH="$(curl -fsS "$API_URL/health")"
|
|
echo "$HEALTH"
|
|
grep -Fq '"version":"0.19.3-9"' <<<"$HEALTH"
|
|
grep -Fq '"phase":"D5.3.9"' <<<"$HEALTH"
|
|
grep -Fq '"database":"ok"' <<<"$HEALTH"
|
|
|
|
echo
|
|
echo "========== D5.3.9 · REVISION OBLIGATORIA =========="
|
|
grep -Fq 'PLAN_DEPENDENCY_REVIEW_CODES' api-v3/src/asset-imports/asset-import-plan.ts
|
|
grep -Fq 'directReviewItems' api-v3/src/asset-imports/asset-import-plan.ts
|
|
grep -Fq 'dependencyReviewItems' api-v3/src/asset-imports/asset-import-plan.ts
|
|
grep -Fq 'isPlanDependencyReview' api-v3/src/asset-imports/asset-import-plan.ts
|
|
grep -Fq "review_codes <@" api-v3/src/asset-imports/asset-imports.service.ts
|
|
grep -Fq 'REVISIÓN OBLIGATORIA' web-v2/src/pages/AssetImportsPage.tsx
|
|
grep -Fq 'Estas son las únicas tarjetas que tenés que resolver' web-v2/src/pages/AssetImportsPage.tsx
|
|
grep -Fq 'dependencias automáticas' web-v2/src/pages/AssetImportsPage.tsx
|
|
grep -Fq 'el plan se regenera automáticamente' web-v2/src/pages/AssetImportsPage.tsx
|
|
grep -Fq 'const regenerated = await generateAssetImportPlan' web-v2/src/pages/AssetImportsPage.tsx
|
|
grep -Fq 'import-review-mandatory-banner' web-v2/src/styles.css
|
|
grep -Fq 'import-review-dependencies' web-v2/src/styles.css
|
|
echo "Separación decisión humana / dependencia automática: OK"
|
|
|
|
echo
|
|
echo "========== D5.3.9 · SEGURIDAD HEREDADA =========="
|
|
grep -Fq 'private async masterStateFingerprint' api-v3/src/asset-imports/asset-imports.service.ts
|
|
grep -Fq 'ASSET_IMPORT_CONTEXT_MATCH_INVALID' api-v3/src/asset-imports/asset-imports.service.ts
|
|
grep -Fq "classificationStatus:'SOURCE_PRESERVED'" api-v3/src/asset-imports/asset-imports.service.ts
|
|
grep -Fq 'inventoryContextOverrides' api-v3/src/asset-imports/asset-imports.service.ts
|
|
if grep -Fq '[A VALIDAR]' api-v3/src/asset-imports/asset-imports.service.ts; then
|
|
echo "ERROR: no debe reaparecer la jerarquía inventada [A VALIDAR]"; exit 1
|
|
fi
|
|
STRONG_BACKUP="$(find /root/DH_V2_BACKUPS -maxdepth 1 -type d -name 'INVENTARIO_A_REVISAR_*' -printf '%T@ %p\n' | sort -nr | head -n1 | cut -d' ' -f2-)"
|
|
[[ -n "$STRONG_BACKUP" && -s "$STRONG_BACKUP/BACKUP_OK.txt" ]]
|
|
grep -Fq 'INVENTARIO A REVISAR' "$STRONG_BACKUP/BACKUP_OK.txt"
|
|
echo "Backup fuerte de referencia: $STRONG_BACKUP"
|
|
|
|
echo
|
|
echo "========== D5.3.9 · CONTENEDORES =========="
|
|
docker compose ps -a
|
|
[[ "$(docker inspect dhv2-db --format '{{.State.Health.Status}}')" == "healthy" ]]
|
|
[[ "$(docker inspect dhv2-api --format '{{.State.Status}}')" == "running" ]]
|
|
[[ "$(docker inspect dhv2-web --format '{{.State.Status}}')" == "running" ]]
|
|
|
|
echo
|
|
echo "ACEPTACIÓN DE FASE D5.3.9: OK"
|