Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(scripts): close the preflight phase in certification evidence

Alfredo Lopez086648635e2b
diff --git a/scripts/e2e/minikube-real-postgres.sh b/scripts/e2e/minikube-real-postgres.sh
index d74673ace..a9ceeb5ee 100755
--- a/scripts/e2e/minikube-real-postgres.sh
+++ b/scripts/e2e/minikube-real-postgres.sh
@@ -603,6 +603,8 @@ main() {
T1_NEXT_COMMAND="MINIKUBE_PROFILE=$T2_PROFILE make minikube-setup-local"
die_t1 POSTGRES_NOT_READY 'control-postgres did not become Ready'
fi
+ # Close the phase t2_evidence_init opened before the suites start.
+ t2_evidence_write preflight PASS 'marker, process and control-postgres readiness checks passed'
T1_TMP_DIR="$(mktemp -d "$T1_TMP_ROOT/evenfire-t1.XXXXXX")"
PG_USER="$(secret_field POSTGRES_USER)"
diff --git a/scripts/minikube/t2.sh b/scripts/minikube/t2.sh
index 4468ccc81..d9bec234c 100755
--- a/scripts/minikube/t2.sh
+++ b/scripts/minikube/t2.sh
@@ -137,6 +137,9 @@ PY
printf '[minikube-t2] transition=%s reason=%s\n' "$T2_PLAN_STATE" "$T2_PLAN_REASON"
t2_evidence_write planner PASS \
"state=$T2_PLAN_STATE duration=$((SECONDS - phase_started_seconds))s"
+ # Close the phase t2_evidence_init opened: local-preflight and the planner
+ # have both passed, so this run's preflight is complete.
+ t2_evidence_write preflight PASS "local-preflight and planner passed; transition=$T2_PLAN_STATE"
}
run_pvc_reset_if_authorized() {
diff --git a/scripts/tests/test-minikube-t2-contract.sh b/scripts/tests/test-minikube-t2-contract.sh
index 874f6ff11..ad3d01812 100755
--- a/scripts/tests/test-minikube-t2-contract.sh
+++ b/scripts/tests/test-minikube-t2-contract.sh
@@ -364,6 +364,24 @@ if [ -z "$post_runtime_process_check_line" ] || [ -z "$complete_pass_line" ] ||
echo 'FAIL: T2 does not revalidate port-forward ownership before complete PASS' >&2
exit 1
fi
+# t2_evidence_init opens every evidence file with `preflight RUNNING`. The
+# planner closes it; each certification writer must close it too, or a PASS
+# attestation keeps a phase whose latest status reads as still running.
+preflight_plan_body="$(awk '/^run_preflight_plan\(\) \{$/,/^\}$/' "$T2")"
+if [ -z "$preflight_plan_body" ] ||
+ ! grep -Fq 't2_evidence_write preflight PASS' <<<"$preflight_plan_body"; then
+ echo 'FAIL: T2 certification evidence never closes the preflight phase opened by t2_evidence_init' >&2
+ exit 1
+fi
+# awk prints an empty line number when nothing matches, so the explicit FAIL
+# below reports the gap instead of pipefail ending the script silently.
+t1_evidence_init_line="$(awk '$0 == " t2_evidence_init" { line = NR } END { print line }' "$T1")"
+t1_preflight_pass_line="$(awk 'index($0, "t2_evidence_write preflight PASS") { line = NR } END { print line }' "$T1")"
+if [ -z "$t1_evidence_init_line" ] || [ -z "$t1_preflight_pass_line" ] ||
+ [ "$t1_preflight_pass_line" -le "$t1_evidence_init_line" ]; then
+ echo 'FAIL: T1 certification evidence never closes the preflight phase opened by t2_evidence_init' >&2
+ exit 1
+fi
if ! grep -Fq 'instead of already-synced' "$T2"; then
echo 'FAIL: final T2 preflight does not require already-synced' >&2
exit 1