Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(minikube): renew the host port-forward hold after pre-gate-sync
Alfredo Lopezcd9618d5b6fd
diff --git a/.cursor/rules/minikube-t0-t1-t2.mdc b/.cursor/rules/minikube-t0-t1-t2.mdcindex 7fc35ff30..546cf2db6 100644--- a/.cursor/rules/minikube-t0-t1-t2.mdc+++ b/.cursor/rules/minikube-t0-t1-t2.mdc@@ -53,6 +53,10 @@ Host-side hold for Control UI / Desktop. Profile-owned random ports only`branch-profile-pf`. Do not kill this lane's forwards.`branch-profile-pf-health` stops PFs on EXIT. Inner `pre-gate-sync` may use`--skip-port-forwards`; never pass that globally into `make minikube-t2`.+`pre-gate-sync` can restart every deployment and leave the hold bound to+terminated pods: run `make minikube-t2` on the host with+`T2_PORT_FORWARD_COMMAND` set to the `branch-profile-pf` command; T2 runs it+once after an in-run sync, before Health/Playwright (`PortForwards=` evidence).## Profile and evidencediff --git a/.cursor/skills/minikube-t0-t1-t2/SKILL.md b/.cursor/skills/minikube-t0-t1-t2/SKILL.mdindex 9f586d493..c9c34f0c0 100644--- a/.cursor/skills/minikube-t0-t1-t2/SKILL.md+++ b/.cursor/skills/minikube-t0-t1-t2/SKILL.md@@ -51,6 +51,11 @@ Before running anything, verify ALL of these:that hold with `make minikube-pf-all-bg`. Do not start UI PFs from asandboxed agent shell. Do not kill this lane's `branch-profile-pf`.`branch-profile-pf-health` stops PFs on EXIT — not a lasting hold.+- [ ] Run `make minikube-t2` from a host terminal with+ `T2_PORT_FORWARD_COMMAND` set to that `branch-profile-pf` command.+ `pre-gate-sync` can restart every deployment; T2 then renews the hold+ once, before Health/Playwright, and records `PortForwards=` evidence.+ Without it an in-run sync leaves the hold on terminated pods.Shell contract-test rule: fixtures that exercise Git/lease state must use atemporary repository via `scripts/tests/lib/minikube-fixture-repo.sh`. Keep thediff --git a/AGENTS.md b/AGENTS.mdindex ed1d48236..3cacb6b26 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -52,6 +52,11 @@ only and must not replace `branch-profile-pf`. Do not kill this lane'sforwards. `branch-profile-pf-health` starts then stops PFs on EXIT — do notuse it as the lasting hold. Inner `pre-gate-sync` may use`--skip-port-forwards`; never pass that globally into `make minikube-t2`.+`pre-gate-sync` can restart every deployment, which leaves the host hold+bound to terminated pods. Run `make minikube-t2` from a host terminal with+`T2_PORT_FORWARD_COMMAND` set to the `branch-profile-pf` command above; T2+runs it once after an in-run sync, before Health and Playwright, and records+`PortForwards=` in the evidence.Port-forwards are owned by atomic `0600` records bound to the exact profile,context, canonical worktree, namespace, Service, local/remote ports, PID,diff --git a/docs/testing/minikube-t2-runbook.md b/docs/testing/minikube-t2-runbook.mdindex 2b117d869..d6094b375 100644--- a/docs/testing/minikube-t2-runbook.md+++ b/docs/testing/minikube-t2-runbook.md@@ -74,6 +74,20 @@ Inner `pre-gate-sync` may use `--skip-port-forwards`; never pass thatglobally into `make minikube-t2`. `branch-profile-pf-health` starts PFs thenSTOPS them on EXIT — do not use it as the lasting hold.+`pre-gate-sync` can roll every deployment (a full image build runs+`minikube-restart-all`). A `kubectl port-forward svc/...` stays bound to the+pod it resolved at start, so after an in-run sync the host hold points at+terminated pods and the Health/Playwright journeys fail against it. Run+`make minikube-t2` from a host terminal with+`T2_PORT_FORWARD_COMMAND='MINIKUBE_PROFILE=<owned-profile> make -f .local-notes/minikube-profiles/branch.mk branch-profile-pf'`.+T2 runs that command from its own working directory, so in a worktree without+a local `.local-notes/` pass the absolute path of the main checkout's+`branch.mk`. T2 runs it once, after NP-08 and before Health, only when+`pre-gate-sync` ran in this invocation, and records `PortForwards=PASS`,+`SKIPPED` (already synced), `NOT_RUN` (no registered hold and no command) or+`FAIL` (`PORT_FORWARD_CONFLICT`: the command failed, or a registered hold+exists and no command renews it). T2 never adopts or kills the hold itself.+## State transitions### Bootstrap@@ -352,7 +366,9 @@ non-T2 scope guard.UI/Desktop Playwright remains opt-in via `T2_PLAYWRIGHT_COMMAND`. Both arerecorded as separate evidence statuses (`NOT_RUN` when optional;`T2_REQUIRE_PLAYWRIGHT=true` refuses a missing journey). Product E2E scripts- such as `scripts/e2e/e2e-hcc-rollout-readiness.sh` are not T2.+ such as `scripts/e2e/e2e-hcc-rollout-readiness.sh` are not T2. When+ `pre-gate-sync` ran, `T2_PORT_FORWARD_COMMAND` renews the host hold+ before those journeys (see Branch-profile UI port-forwards).CI, static tests, T1, T2, Playwright, and product E2E scripts are separateevidence lanes. A green CI job or unit suite is not proof of T2 runtimediff --git a/scripts/minikube/t2-common.sh b/scripts/minikube/t2-common.shindex 9bbe1f03d..97747d2fa 100755--- a/scripts/minikube/t2-common.sh+++ b/scripts/minikube/t2-common.sh@@ -139,6 +139,7 @@ T2_REQUIRE_PLAYWRIGHT="$T2_REQUIRE_PLAYWRIGHT"T2_T0_COMMAND="$T2_T0_COMMAND"T2_PLAYWRIGHT_COMMAND="$T2_PLAYWRIGHT_COMMAND"T2_HEALTHCHECK_COMMAND="$T2_HEALTHCHECK_COMMAND"+T2_PORT_FORWARD_COMMAND="$T2_PORT_FORWARD_COMMAND"T2_RESET_PVC="$T2_RESET_PVC"T2_EXPECTED_PVC_UID="$T2_EXPECTED_PVC_UID"T2_TMP_ROOT="$TMPDIR"diff --git a/scripts/minikube/t2.sh b/scripts/minikube/t2.shindex 6cf2d23e0..e930effe4 100755--- a/scripts/minikube/t2.sh+++ b/scripts/minikube/t2.sh@@ -21,6 +21,7 @@ if [ -z "$T2_REQUIRE_PLAYWRIGHT" ]; then T2_REQUIRE_PLAYWRIGHT=false; fiT2_T0_COMMAND="$T2_T0_COMMAND"T2_PLAYWRIGHT_COMMAND="$T2_PLAYWRIGHT_COMMAND"T2_HEALTHCHECK_COMMAND="$T2_HEALTHCHECK_COMMAND"+T2_PORT_FORWARD_COMMAND="$T2_PORT_FORWARD_COMMAND"T2_HEALTHCHECK_TIMEOUT_SECONDS="${T2_HEALTHCHECK_TIMEOUT_SECONDS:-120}"T2_HEALTHCHECK_KILL_GRACE_SECONDS="${T2_HEALTHCHECK_KILL_GRACE_SECONDS:-5}"T2_DEADLINE_RUNNER="${T2_DEADLINE_RUNNER:-$SCRIPT_DIR/run-with-deadline.mjs}"@@ -31,6 +32,8 @@ T2_T2_STATUS=NOT_RUNT2_NP08_HCC_AUTHORIZATION_STATUS=NOT_RUNT2_HEALTH_STATUS=NOT_RUNT2_PLAYWRIGHT_STATUS=NOT_RUN+T2_PORT_FORWARD_STATUS=NOT_RUN+T2_PRE_GATE_SYNC_RAN=falseT2_HEALTHCHECK_REQUIRED=false# A bootstrap or full reconcile must build the current worktree. Reusing a# marker's ghcr coordinate would validate a release image rather than HEAD.@@ -250,6 +253,10 @@ run_pre_gate() {T2_SETUP_HANDOFF_TTL_SECONDS="$T2_SETUP_HANDOFF_TTL_SECONDS" \MINIKUBE_PROFILE="$T2_PROFILE" CONTROL_API_REAL_PG_CONTEXT="$T2_CONTEXT" \make minikube-pre-gate-sync GATE=minikube-t2 ARGS='--skip-port-forwards'+ # pre-gate-sync may roll any deployment (a full image build runs+ # minikube-restart-all). A host `kubectl port-forward svc/...` stays bound to+ # the pod it resolved at start, so the host hold is stale from here on.+ T2_PRE_GATE_SYNC_RAN=truet2_evidence_write pre-gate-sync PASS \"duration=$((SECONDS - phase_started_seconds))s setupHandoffExpected=$setup_handoff_expected"}@@ -388,6 +395,49 @@ validate_healthcheck_contract() {fi}+refresh_port_forwards_if_requested() {+ # The orchestrator never adopts or kills the host hold; the operator supplies+ # the command that renews it (branch-profile-pf) and T2 runs it once, after+ # every in-run rollout and before the user-facing journeys use the forwards.+ if [ "$T2_PRE_GATE_SYNC_RAN" != true ]; then+ T2_PORT_FORWARD_STATUS=SKIPPED+ t2_evidence_write PortForwards SKIPPED 'pre-gate-sync did not run; no in-run rollout invalidated the host forwards'+ return 0+ fi+ if [ -z "$T2_PORT_FORWARD_COMMAND" ]; then+ # A registered forward for this profile is a host hold the sync just+ # invalidated; certifying over it would pass on known-stale forwards.+ local pid_file+ for pid_file in "$T2_PROFILE_ROOT/$T2_PROFILE"/pids/*.pid; do+ [ -f "$pid_file" ] || continue+ T2_PORT_FORWARD_STATUS=FAIL+ t2_evidence_write PortForwards FAIL 'pre-gate-sync ran, a host hold is registered and no T2_PORT_FORWARD_COMMAND renews it'+ T2_NEXT_COMMAND="set T2_PORT_FORWARD_COMMAND to the branch-profile-pf command for $T2_PROFILE, then run MINIKUBE_PROFILE=$T2_PROFILE CONTROL_API_REAL_PG_CONTEXT=$T2_CONTEXT make minikube-t2-runtime"+ t2_fail PORT_FORWARD_CONFLICT "pre-gate-sync invalidated the registered host port-forwards: $pid_file"+ return 1+ done+ T2_PORT_FORWARD_STATUS=NOT_RUN+ t2_evidence_write PortForwards NOT_RUN 'no host port-forward is registered and no refresh command was supplied'+ return 0+ fi+ local refresh_status=0+ # See run_healthcheck_if_requested for the inherited lease identity.+ T2_SKIP_LOCK=true T2_LOCK_TOKEN="$T2_LOCK_TOKEN" \+ T2_PROFILE="$T2_PROFILE" T2_CONTEXT="$T2_CONTEXT" \+ T2_PROJECT_DIR="$T2_PROJECT_DIR" T2_LOCK_ROOT="$T2_LOCK_ROOT" \+ bash -c "$T2_PORT_FORWARD_COMMAND" || refresh_status=$?+ if [ "$refresh_status" -eq 0 ]; then+ T2_PORT_FORWARD_STATUS=PASS+ t2_evidence_write PortForwards PASS 'host port-forward refresh command passed after pre-gate-sync'+ else+ T2_PORT_FORWARD_STATUS=FAIL+ t2_evidence_write PortForwards FAIL "host port-forward refresh command failed; exit=$refresh_status"+ T2_NEXT_COMMAND="repair the host port-forward command, then run MINIKUBE_PROFILE=$T2_PROFILE CONTROL_API_REAL_PG_CONTEXT=$T2_CONTEXT make minikube-t2-runtime"+ t2_fail PORT_FORWARD_CONFLICT 'host port-forward refresh command failed after pre-gate-sync'+ return 1+ fi+}+run_healthcheck_if_requested() {local phase_started_seconds="$SECONDS" health_status=0if [ -z "$T2_HEALTHCHECK_COMMAND" ]; then@@ -423,6 +473,9 @@ run_healthcheck_if_requested() {t2_evidence_write Health FAIL \"profile-owned user-facing health command failed; exit=$health_status duration=$((SECONDS - phase_started_seconds))s"T2_NEXT_COMMAND="repair the health failure, then run MINIKUBE_PROFILE=$T2_PROFILE CONTROL_API_REAL_PG_CONTEXT=$T2_CONTEXT make minikube-t2-runtime"+ if [ "$T2_PORT_FORWARD_STATUS" = NOT_RUN ]; then+ T2_NEXT_COMMAND="pre-gate-sync rolled deployments and no host forwards were renewed; start branch-profile-pf, then run MINIKUBE_PROFILE=$T2_PROFILE CONTROL_API_REAL_PG_CONTEXT=$T2_CONTEXT make minikube-t2-runtime"+ fiif [ "$health_status" -eq 124 ]; thent2_fail PROFILE_UNHEALTHY \"user-facing health check exceeded ${T2_HEALTHCHECK_TIMEOUT_SECONDS}s"@@ -529,6 +582,7 @@ main() {firun_final_preflightrun_np08_hcc_authorization+ refresh_port_forwards_if_requestedrun_healthcheck_if_requestedrun_playwright_if_requested# Journeys may mutate the owned profile under the inherited lease. Certify@@ -542,12 +596,13 @@ main() {return 1fi- t2_evidence_write complete PASS "T0=$T2_T0_STATUS T1=$T2_T1_STATUS T2=$T2_T2_STATUS NP08_HCC_AUTHORIZATION=$T2_NP08_HCC_AUTHORIZATION_STATUS Health=$T2_HEALTH_STATUS Playwright=$T2_PLAYWRIGHT_STATUS"+ t2_evidence_write complete PASS "T0=$T2_T0_STATUS T1=$T2_T1_STATUS T2=$T2_T2_STATUS NP08_HCC_AUTHORIZATION=$T2_NP08_HCC_AUTHORIZATION_STATUS PortForwards=$T2_PORT_FORWARD_STATUS Health=$T2_HEALTH_STATUS Playwright=$T2_PLAYWRIGHT_STATUS"printf 'MINIKUBE_T2_PASS\n'printf 'T0=%s\n' "$T2_T0_STATUS"printf 'T1=%s\n' "$T2_T1_STATUS"printf 'T2=%s\n' "$T2_T2_STATUS"printf 'NP08_HCC_AUTHORIZATION=%s\n' "$T2_NP08_HCC_AUTHORIZATION_STATUS"+ printf 'PortForwards=%s\n' "$T2_PORT_FORWARD_STATUS"printf 'Health=%s\n' "$T2_HEALTH_STATUS"printf 'Playwright=%s\n' "$T2_PLAYWRIGHT_STATUS"printf 'evidence=%s\n' "$T2_EVIDENCE_FILE"diff --git a/scripts/tests/test-minikube-t2-contract.sh b/scripts/tests/test-minikube-t2-contract.shindex a3f0339bf..4ad119f65 100755--- a/scripts/tests/test-minikube-t2-contract.sh+++ b/scripts/tests/test-minikube-t2-contract.sh@@ -53,7 +53,8 @@ for file in "$MINIKUBE_DIR/profile-readiness.sh" "$ROOT/scripts/tests/test-minik"$ROOT/scripts/tests/test-minikube-t2-process-owner.sh" \"$ROOT/scripts/tests/test-minikube-explicit-context.sh" \"$ROOT/scripts/tests/test-minikube-t2-evidence.sh" \- "$ROOT/scripts/tests/test-minikube-targeted-health.sh"; do+ "$ROOT/scripts/tests/test-minikube-targeted-health.sh" \+ "$ROOT/scripts/tests/test-minikube-t2-port-forward-refresh.sh"; dobash -n "$file"done"$ROOT/scripts/tests/test-minikube-t1-port-forward-owner.sh"@@ -61,6 +62,7 @@ done"$ROOT/scripts/tests/test-minikube-explicit-context.sh""$ROOT/scripts/tests/test-minikube-t2-evidence.sh""$ROOT/scripts/tests/test-minikube-targeted-health.sh"+"$ROOT/scripts/tests/test-minikube-t2-port-forward-refresh.sh""$ROOT/scripts/tests/test-minikube-filter-gfs-resources.sh""$ROOT/scripts/tests/test-minikube-t1-docker-boundary.sh""$ROOT/scripts/tests/test-minikube-pull-images.sh"@@ -327,6 +329,7 @@ grep -Fq 'validate_healthcheck_contract' "$T2"grep -Fq 'T2_HEALTHCHECK_REQUIRED=true' "$T2"grep -Fq -- '--label t2-user-facing-health' "$T2"grep -Fq 'Health=$T2_HEALTH_STATUS' "$T2"+grep -Fq 'PortForwards=$T2_PORT_FORWARD_STATUS' "$T2"grep -Fq 'run_np08_hcc_authorization' "$T2"grep -Fq "CLERUM_PROFILE_PORTS_ENV=\"\$T2_PORTS_ENV\"" "$T2"grep -Fq 'NP08_HCC_AUTHORIZATION PASS' "$T2"diff --git a/scripts/tests/test-minikube-t2-port-forward-refresh.sh b/scripts/tests/test-minikube-t2-port-forward-refresh.shnew file mode 100755index 000000000..6643df24a--- /dev/null+++ b/scripts/tests/test-minikube-t2-port-forward-refresh.sh@@ -0,0 +1,134 @@+#!/usr/bin/env bash+set -euo pipefail++ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd -P)"+T2="$ROOT/scripts/minikube/t2.sh"++# shellcheck source=scripts/minikube/t2.sh+source "$T2"++fail() {+ printf 'FAIL: %s\n' "$*" >&2+ exit 1+}++EVIDENCE_LOG=''+t2_evidence_write() {+ EVIDENCE_LOG+="$1=$2;"+}++WORK="$(mktemp -d)"+trap 'rm -rf "$WORK"' EXIT+CALLS="$WORK/calls"+T2_PROFILE_ROOT="$WORK/profiles"+T2_PROFILE=pf-refresh-fixture+PIDS="$T2_PROFILE_ROOT/$T2_PROFILE/pids"+mkdir -p "$PIDS"++reset_case() {+ EVIDENCE_LOG=''+ T2_ERROR_CODE=''+ T2_NEXT_COMMAND=''+ T2_PORT_FORWARD_STATUS=NOT_RUN+ rm -f "$PIDS"/*.pid+ : >"$CALLS"+}++# run_pre_gate records the sync only when it actually ran.+make() { printf 'make %s\n' "$*" >>"$CALLS"; }+reset_case+T2_PRE_GATE_SYNC_RAN=false+T2_PLAN_STATE=already-synced+run_pre_gate >/dev/null+[[ "$T2_PRE_GATE_SYNC_RAN" == false && ! -s "$CALLS" && "$EVIDENCE_LOG" == 'pre-gate-sync=SKIPPED;' ]] ||+ fail "an already-synced plan recorded a sync: flag=${T2_PRE_GATE_SYNC_RAN} evidence=${EVIDENCE_LOG}"+reset_case+T2_PLAN_STATE=full-reconcile+run_pre_gate >/dev/null+[[ "$T2_PRE_GATE_SYNC_RAN" == true && "$(cat "$CALLS")" == 'make minikube-pre-gate-sync GATE=minikube-t2 ARGS=--skip-port-forwards' ]] ||+ fail "a full-reconcile plan did not record its sync: flag=${T2_PRE_GATE_SYNC_RAN} calls=$(cat "$CALLS")"+unset -f make++# pre-gate-sync did not run (already-synced): the hold is not touched.+reset_case+T2_PRE_GATE_SYNC_RAN=false+T2_PORT_FORWARD_COMMAND="printf refreshed >>'$CALLS'"+refresh_port_forwards_if_requested+[[ "$T2_PORT_FORWARD_STATUS" == SKIPPED && "$EVIDENCE_LOG" == 'PortForwards=SKIPPED;' ]] ||+ fail "an already-synced run recorded ${T2_PORT_FORWARD_STATUS} / ${EVIDENCE_LOG}"+[[ ! -s "$CALLS" ]] || fail 'the refresh command ran although pre-gate-sync did not'++# pre-gate-sync ran and the operator supplied the command: it runs exactly once+# with the inherited lease identity.+reset_case+T2_PRE_GATE_SYNC_RAN=true+T2_LOCK_TOKEN=lease-token-1+T2_PORT_FORWARD_COMMAND="printf '%s|%s\\n' \"\$T2_SKIP_LOCK\" \"\$T2_LOCK_TOKEN\" >>'$CALLS'"+refresh_port_forwards_if_requested+[[ "$T2_PORT_FORWARD_STATUS" == PASS && "$EVIDENCE_LOG" == 'PortForwards=PASS;' ]] ||+ fail "a successful refresh recorded ${T2_PORT_FORWARD_STATUS} / ${EVIDENCE_LOG}"+[[ "$(cat "$CALLS")" == 'true|lease-token-1' ]] ||+ fail "the refresh command did not run once under the inherited lease: $(cat "$CALLS")"++# pre-gate-sync ran and the command fails: T2 stops with a stable code.+reset_case+T2_PRE_GATE_SYNC_RAN=true+T2_PORT_FORWARD_COMMAND="printf attempted >>'$CALLS'; exit 7"+if refresh_port_forwards_if_requested >/dev/null 2>&1; then+ fail 'a failing refresh command was accepted'+fi+[[ "$(cat "$CALLS")" == attempted ]] || fail 'the failing refresh command did not run'+[[ "$T2_ERROR_CODE" == PORT_FORWARD_CONFLICT && "$T2_PORT_FORWARD_STATUS" == FAIL &&+ "$EVIDENCE_LOG" == 'PortForwards=FAIL;' && "$T2_NEXT_COMMAND" == *'repair the host port-forward command'* ]] ||+ fail "a failed refresh returned ${T2_ERROR_CODE:-<empty>} / ${T2_PORT_FORWARD_STATUS} / ${EVIDENCE_LOG} / ${T2_NEXT_COMMAND}"++# pre-gate-sync ran, a host hold is registered and no command renews it: fail+# closed before any journey runs against the stale forwards.+reset_case+T2_PRE_GATE_SYNC_RAN=true+T2_PORT_FORWARD_COMMAND=''+printf '4242\n' >"$PIDS/control-ui.pid"+if refresh_port_forwards_if_requested >/dev/null 2>&1; then+ fail 'a registered hold invalidated by pre-gate-sync was accepted without a refresh command'+fi+[[ "$T2_ERROR_CODE" == PORT_FORWARD_CONFLICT && "$T2_PORT_FORWARD_STATUS" == FAIL &&+ "$EVIDENCE_LOG" == 'PortForwards=FAIL;' && "$T2_NEXT_COMMAND" == *'set T2_PORT_FORWARD_COMMAND'* ]] ||+ fail "a stale registered hold returned ${T2_ERROR_CODE:-<empty>} / ${T2_PORT_FORWARD_STATUS} / ${EVIDENCE_LOG} / ${T2_NEXT_COMMAND}"++# pre-gate-sync ran with no hold and no command: recorded NOT_RUN, and a later+# health failure names the missing forwards in its next step.+T2_PLAN_STATE=full-reconcile+T2_HEALTHCHECK_COMMAND='exit 2'+T2_HEALTHCHECK_TIMEOUT_SECONDS=5+validate_healthcheck_contract+reset_case+T2_PRE_GATE_SYNC_RAN=true+T2_PORT_FORWARD_COMMAND=''+refresh_port_forwards_if_requested+[[ "$T2_PORT_FORWARD_STATUS" == NOT_RUN && "$EVIDENCE_LOG" == 'PortForwards=NOT_RUN;' ]] ||+ fail "a profile with no hold and no command recorded ${T2_PORT_FORWARD_STATUS} / ${EVIDENCE_LOG}"+if run_healthcheck_if_requested >/dev/null 2>&1; then+ fail 'a failing health command passed'+fi+[[ "$T2_ERROR_CODE" == PROFILE_UNHEALTHY && "$T2_NEXT_COMMAND" == *'start branch-profile-pf'* ]] ||+ fail "a health failure after an unrenewed sync did not name the forwards: ${T2_NEXT_COMMAND}"++# A health failure after renewed or untouched forwards keeps the generic next+# step: the forwards are not the suspect.+for status in PASS SKIPPED; do+ reset_case+ T2_PORT_FORWARD_STATUS="$status"+ if run_healthcheck_if_requested >/dev/null 2>&1; then+ fail "a failing health command passed with PortForwards=$status"+ fi+ [[ "$T2_ERROR_CODE" == PROFILE_UNHEALTHY && "$T2_NEXT_COMMAND" == *'repair the health failure'* &&+ "$T2_NEXT_COMMAND" != *branch-profile-pf* ]] ||+ fail "PortForwards=$status blamed the forwards: ${T2_ERROR_CODE:-<empty>} / ${T2_NEXT_COMMAND}"+done++# The orchestrator refreshes after NP-08 and before the user-facing journeys.+order="$(grep -nE '^ (run_np08_hcc_authorization|refresh_port_forwards_if_requested|run_healthcheck_if_requested|run_playwright_if_requested)$' "$T2" | cut -d: -f2 | tr -d ' ' | tr '\n' ' ')"+[[ "$order" == 'run_np08_hcc_authorization refresh_port_forwards_if_requested run_healthcheck_if_requested run_playwright_if_requested ' ]] ||+ fail "main does not refresh host forwards between NP-08 and Health: ${order}"++printf 'PASS: T2 renews the host port-forward hold after pre-gate-sync and before Health\n'diff --git a/scripts/tests/test-minikube-t2-proxy-runtime.sh b/scripts/tests/test-minikube-t2-proxy-runtime.shindex 580a5c44d..cf3374059 100755--- a/scripts/tests/test-minikube-t2-proxy-runtime.sh+++ b/scripts/tests/test-minikube-t2-proxy-runtime.sh@@ -134,6 +134,7 @@ T2_HEALTHCHECK_TIMEOUT_SECONDS=10T2_HEALTHCHECK_KILL_GRACE_SECONDS=1T2_HEALTHCHECK_REQUIRED=falseT2_REQUIRE_PLAYWRIGHT=true+T2_PORT_FORWARD_STATUS=SKIPPEDt2_evidence_write() { :; }# Stable process metadata makes start-time verification hermetic even when# native sandboxed ps intentionally hides host process details.