Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(minikube): preserve marker JSON and inventory errors
Alfredo Lopez38119a4ccee7
diff --git a/scripts/minikube/build-images.sh b/scripts/minikube/build-images.shindex 02d236522..4d992a62e 100755--- a/scripts/minikube/build-images.sh+++ b/scripts/minikube/build-images.sh@@ -550,6 +550,10 @@ normalize_minikube_image_tag() {MINIKUBE_IMAGE_INVENTORY_JSON=""MINIKUBE_IMAGE_INVENTORY_CACHED=false+# Return code 1 is reserved for a successful inventory proving that a requested+# image is absent. Any failed or invalid inventory must stay distinguishable so+# callers cannot turn an infrastructure failure into a pull/load cache miss.+MINIKUBE_IMAGE_INVENTORY_ERROR_STATUS=2minikube_image_inventory() {local inventory_status=0@@ -558,7 +562,7 @@ minikube_image_inventory() {minikube -p "$PROFILE" image ls --format=json || inventory_status=$?if [[ "$inventory_status" -ne 0 ]]; thenerr "Minikube image inventory failed or exceeded its deadline" >&2- return "$inventory_status"+ return "$MINIKUBE_IMAGE_INVENTORY_ERROR_STATUS"fi}diff --git a/scripts/minikube/t2-common.sh b/scripts/minikube/t2-common.shindex 10fc64d86..ca46dfdb5 100755--- a/scripts/minikube/t2-common.sh+++ b/scripts/minikube/t2-common.sh@@ -434,7 +434,7 @@ t2_marker_check() {# result. Preserve every other kubectl failure: a timeout, RBAC denial, or# transport error must never be reclassified as bootstrap permission.marker_probe="$(t2_kc -n "$T2_CONTROL_NAMESPACE" get configmap "$T2_MARKER_NAME" \- -o json --ignore-not-found 2>&1)" || marker_status=$?+ -o json --ignore-not-found)" || marker_status=$?if [ "$marker_status" -ne 0 ]; thenT2_NEXT_COMMAND='verify the explicit branch-owned Kubernetes context and retry the read-only preflight't2_fail PROFILE_UNHEALTHY \diff --git a/scripts/tests/test-minikube-build-images-hardening.sh b/scripts/tests/test-minikube-build-images-hardening.shindex 8d10e3134..268ab6d4c 100755--- a/scripts/tests/test-minikube-build-images-hardening.sh+++ b/scripts/tests/test-minikube-build-images-hardening.sh@@ -349,6 +349,21 @@ elsefail "verify-only did not preserve its read-only lease exemption (status=$verify_status)"fi+clear_runtime_state+inventory_failure_output="$TMP_DIR/inventory-failure.out"+inventory_failure_status=0+run_build "$inventory_failure_output" verify \+ FAKE_MINIKUBE_INVENTORY_MODE=exit-1 \+ bash "$BUILD_SCRIPT" --verify-only || inventory_failure_status=$?+if [[ "$inventory_failure_status" -eq 2 ]] \+ && grep -Fq 'Minikube image inventory failed or exceeded its deadline' "$inventory_failure_output" \+ && ! grep -Fq 'MISSING:' "$inventory_failure_output" \+ && [[ ! -s "$DOCKER_LOG" ]]; then+ pass 'a Minikube inventory failure is not misclassified as a missing image'+else+ fail "a Minikube inventory failure was treated as an image miss (status=$inventory_failure_status)"+fi+descendant_is_dead() {local record descendant[[ -f "$DESCENDANT_PID_FILE" ]] || return 1diff --git a/scripts/tests/test-minikube-t2-scenarios.sh b/scripts/tests/test-minikube-t2-scenarios.shindex 0c730ed39..0f5ff52d5 100755--- a/scripts/tests/test-minikube-t2-scenarios.sh+++ b/scripts/tests/test-minikube-t2-scenarios.sh@@ -439,6 +439,20 @@ plan_mode_head="$(env "${marker_env[@]}" T2_PLAN_MODE=true FAKE_MARKER='{"data":bash -c 'source "$1"; T2_WORKTREE_ID=worktree-a; T2_HEAD=feature; T2_PLAN_MODE=true; t2_kc(){ printf "%s" "$FAKE_MARKER"; }; t2_marker_check; printf "%s" "$T2_MARKER_MATCHES_HEAD"' bash "$COMMON")"[ "$plan_mode_head" = false ] || fail "planner mode still treated a stale marker as matching HEAD"+# The bounded kubectl runner writes HARNESS_DEADLINE diagnostics to stderr.+# They must remain outside the captured JSON so a valid exact-head marker keeps+# the already-synced fast path.+marker_stderr="$tmp/marker-deadline.stderr"+marker_fast_path_status=0+marker_fast_path="$(env "${marker_env[@]}" T2_PLAN_MODE=false \+ FAKE_MARKER='{"data":{"clusterFingerprint":"fp","gitHead":"feature","worktreeId":"worktree-a","imageSource":"local","imageTag":"test","imagesGeneratedAt":"generated"}}' \+ bash -c 'source "$1"; T2_WORKTREE_ID=worktree-a; T2_HEAD=feature; T2_PLAN_MODE=false; t2_kc(){ printf "%s" "$FAKE_MARKER"; printf "%s\n" "[HARNESS_DEADLINE] label=t2-kubectl event=exit" >&2; }; t2_marker_check; printf "%s" "$T2_MARKER_MATCHES_HEAD"' bash "$COMMON" 2>"$marker_stderr")" || marker_fast_path_status=$?+if [ "$marker_fast_path_status" -ne 0 ] || [ "$marker_fast_path" != true ]; then+ fail "stderr from the bounded marker read broke the valid-marker fast path (status=$marker_fast_path_status result=$marker_fast_path)"+fi+grep -Fq '[HARNESS_DEADLINE] label=t2-kubectl event=exit' "$marker_stderr" ||+ fail 'marker deadline diagnostics were not preserved on stderr'+evidence="$tmp/evidence.json"detail_value="$(printf '%s://%s:%s@%s' postgresql user marker local-db)"env "${repo_env[@]}" T2_EVIDENCE_FILE="$evidence" T2_EVIDENCE_DIR="$tmp/evidence-dir" \