Skip to content

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

TypeScript

fix: verify minikube identity before recovery fencing

Alfredo Lopez16a6ff54ae5e
diff --git a/scripts/minikube/full-setup.sh b/scripts/minikube/full-setup.sh
index 3b19f576a..6676d18c6 100755
--- a/scripts/minikube/full-setup.sh
+++ b/scripts/minikube/full-setup.sh
@@ -873,15 +873,18 @@ fi
ok "Cluster '${PROFILE}' is reachable"
maybe_exit_after_cluster_step
+# Validate the explicit context and exact Minikube profile identity before an
+# interrupted-recovery journal is allowed to scale any writer. Reachability
+# alone is not authority: a kubeconfig can name another local cluster.
+t2_profile_status
+t2_context_check
+t2_profile_context_identity_check
+
# This is intentionally after the profile becomes reachable but before the
# first setup apply. A stopped profile may be started safely; an active journal
# must be fenced before any workload/configuration mutation.
guard_interrupted_writer_recovery || exit 1
-t2_profile_status
-t2_context_check
-t2_profile_context_identity_check
-
# ======================================================================
# Step 3: Namespaces + CRDs
# ======================================================================
diff --git a/scripts/tests/test-gfs-deploy-contract.sh b/scripts/tests/test-gfs-deploy-contract.sh
index 54e94c0b5..2dbe61f28 100755
--- a/scripts/tests/test-gfs-deploy-contract.sh
+++ b/scripts/tests/test-gfs-deploy-contract.sh
@@ -264,6 +264,11 @@ assert_pre_gate_defers_gfs_reconcile() {
# anchor.
assert_minikube_upgrade_classifier Makefile '# Upgrade path: adopt/validate writer' 'image-mode.sh --render-dir'
assert_minikube_upgrade_classifier scripts/minikube/full-setup.sh '# Upgrade path: stage the additive reader' 'Applying kustomize overlay'
+full_setup_identity_line="$(grep -nF 't2_profile_context_identity_check' scripts/minikube/full-setup.sh | tail -1 | cut -d: -f1)"
+full_setup_recovery_guard_line="$(grep -nF 'guard_interrupted_writer_recovery || exit 1' scripts/minikube/full-setup.sh | head -1 | cut -d: -f1)"
+[[ -n "$full_setup_identity_line" && -n "$full_setup_recovery_guard_line" && \
+ "$full_setup_identity_line" -lt "$full_setup_recovery_guard_line" ]] \
+ || fail 'full-setup can fence recovery writers before verifying exact context/profile identity'
assert_pre_gate_defers_gfs_reconcile 'apply-gfs-writer-secret.sh' 'incremental_build_images' scripts/minikube/pre-gate-sync.sh
full_setup_classifier="$(sed -n '/# Upgrade path: stage the additive reader/,/Applying kustomize overlay/p' scripts/minikube/full-setup.sh)"
reset_classifier="$(grep -n 'if \[ "$RESET_DB" = true \]; then' <<<"$full_setup_classifier" | head -1 | cut -d: -f1)"