From 738af54c93ef6744c55926dbf9146e6d0cfe3f3c Mon Sep 17 00:00:00 2001 From: root Date: Mon, 31 Aug 2026 18:54:03 +0000 Subject: [PATCH] phase13.5: verify recreate post-gates against target class --- .../control-plane/cp2a2_2b/rq-historical | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/red-queen-architecture/control-plane/cp2a2_2b/rq-historical b/red-queen-architecture/control-plane/cp2a2_2b/rq-historical index a3f2069..90d617f 100755 --- a/red-queen-architecture/control-plane/cp2a2_2b/rq-historical +++ b/red-queen-architecture/control-plane/cp2a2_2b/rq-historical @@ -1264,8 +1264,13 @@ wait_for_historical_service_ready() { # Post-Recreate/Post-Rollback Gates (Punkt 13/17). Read-only. FAIL CLOSED. recreate_post_gates() { - # $1 = erwartete Image-ID (CANDIDATE_IMAGE_ID oder RECOVERY_GOLD_IMAGE_ID) - local expect="$1" cid running img rh rr + # $1 = erwartete Image-ID (CANDIDATE_IMAGE_ID oder RECOVERY_GOLD_IMAGE_ID oder REMEDIATION-Full-ID) + # $2 = Zielklasse: gold|recovery (Default; 63/63 Gold) | remediation (62+1 autorisierter Runner-Overlay). + # Der Post-Gate prüft den laufenden Container gegen den ERWARTETEN Zielzustand. + # (Phase 13.5: Target-State-Conflict-Fix — vorher wurde IMMER verify_recovery_gold_image + # = strikt Gold ausgeführt; ein autorisierter Remediation-Container 62+1 fuhr damit + # fälschlich in FALSE FAIL CLOSED.) + local expect="$1" TARGETCLASS="${2:-gold}" cid running img rh rr echo " Startup-/Readiness-Wartephase (Timing-Fix):" # Wartet fail-closed mit festem Timeout/Poll auf health=200 UND ready=200. # Container-exit/dead/restart-loop/wrong-image -> frueh FAIL CLOSED (Helper). @@ -1282,8 +1287,18 @@ recreate_post_gates() { echo " Final Re-Check: /health=$rh /ready=$rr" [ "$rh" = "200" ] && [ "$rr" = "200" ] || die "Post-Gate FAIL: health/ready != 200 (FAIL CLOSED)" [ "$img" = "$expect" ] || die "Post-Gate FAIL: Running Image != erwartet (FAIL CLOSED)" - echo " [Code] 63/63 Manifest + Critical SHAs + Config:" - ( verify_recovery_gold_image >/dev/null 2>&1 ) && echo " OK (63/63, Critical SHAs MATCH, Config PASS)" || die "Post-Gate FAIL: Code-Verify (FAIL CLOSED)" + echo " [Code] Target-zustands-bewusste Verify (Zielklasse=$TARGETCLASS):" + if [ "$TARGETCLASS" = "remediation" ]; then + # Remediation-Ziel (62 Gold + 1 autorisierter Runner-Overlay, repository.py Gold). IMAGE-ONLY. + # Reuse: exakt der produktiv in Gate B gepruefte Helper verify_candidate_target_image + # (62+1, repository.py Gold-Hard-Gate, Critical-SHAs runner-allowance, Config). + ( verify_candidate_target_image "$expect" >/dev/null 2>&1 ) \ + && echo " OK (62 MATCH + 1 autorisierter Runner-Divergenz; repository.py Gold; Critical-SHAs + Config PASS)" \ + || die "Post-Gate FAIL: Remediation-Target-Code-Verify (62+1) (FAIL CLOSED)" + else + # Gold/Recovery-Ziel (Default): strikt 63/63 Gold. Unveraendert. + ( verify_recovery_gold_image >/dev/null 2>&1 ) && echo " OK (63/63, Critical SHAs MATCH, Config PASS)" || die "Post-Gate FAIL: Code-Verify (FAIL CLOSED)" + fi echo " historical-db gleiche Container-ID:" local dbid; dbid="$(docker inspect -f '{{.Id}}' historical-db 2>/dev/null)" echo " $dbid" @@ -2074,7 +2089,7 @@ recreate_runner_remediation_safe() { docker compose -f "$COMPOSE_FILE" -f "$ovf" up -d --no-deps --no-build "$HISTORICAL_SERVICE" || { rm -f "$ovf"; die "recreate-runner-remediation-safe fehlgeschlagen (FAIL CLOSED)"; } rm -f "$ovf" echo " Post-Gates:" - recreate_post_gates "$imgid" + recreate_post_gates "$imgid" remediation echo "RECREATE-RUNNER-REMEDIATION-SAFE OK. Container laeuft mit Remediation-Image (gespeicherte ID)." }