Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(minikube): children of run_t0 must not inherit the origin/dev pin
Alfredo Lopez6a3cb34a1019
diff --git a/scripts/tests/test-minikube-t2-contract.sh b/scripts/tests/test-minikube-t2-contract.shindex 4d991df77..332d09747 100755--- a/scripts/tests/test-minikube-t2-contract.sh+++ b/scripts/tests/test-minikube-t2-contract.sh@@ -101,6 +101,22 @@ for identity_file in "$COMMON" "$ROOT/scripts/minikube/sync-auth-key.sh" "$ROOT/grep -Fq 't2_worktree_id' "$identity_file"donegrep -Fq 'bash "$T2_PROJECT_DIR/scripts/tests/test-minikube-t2-contract.sh"' "$T2"+# run_t0 runs under the lease owner but does not hold the lease, so its children+# must not inherit the pinned origin/dev: t2_resolve_origin_dev refuses a pin+# without T2_SKIP_LOCK=true. Every child starts through t2_run_outside_lease;+# T0 receives origin/dev explicitly as T0_ORIGIN_DEV.+# Continuation lines are joined so a wrapped command is checked as one line.+run_t0_body="$(awk '/^run_t0\(\) \{/{f=1} !f{next} sub(/\\$/, ""){buf=buf $0; next} {print buf $0; buf=""} /^\}/{exit}' "$T2")"+[ -n "$run_t0_body" ] || { printf 'FAIL: run_t0 not found in t2.sh\n' >&2; exit 1; }+unwrapped_t0_children="$(printf '%s\n' "$run_t0_body" | grep -E '^[[:space:]]*(bash |T0_PROJECT_DIR=)' | grep -Ev '^[[:space:]]*bash -n ' || true)"+[ -z "$unwrapped_t0_children" ] || {+ printf 'FAIL: run_t0 starts a child without t2_run_outside_lease:\n%s\n' "$unwrapped_t0_children" >&2+ exit 1+}+[ "$(printf '%s\n' "$run_t0_body" | grep -Ec '^[[:space:]]*t2_run_outside_lease ')" -eq 4 ] || {+ printf 'FAIL: run_t0 must start t0.sh, T2_T0_COMMAND, the contract test and the setup-handoff test through t2_run_outside_lease\n' >&2+ exit 1+}required_codes="DEVELOPMENT_SCOPE_REQUIRED PROFILE_OWNERSHIP_MISMATCH PROFILE_BUSY PROFILE_LOCK_REQUIRED HEAD_MARKER_MISMATCH IMAGE_MANIFEST_MISMATCH BOOTSTRAP_REQUIRED CERTIFICATION_REQUIRED SECRET_MISSING CONFIGMAP_MISSING POSTGRES_NOT_READY REAL_PG_REQUIRED_BUT_UNAVAILABLE REAL_PG_SUITE_FAILED REAL_PG_REPORT_INCOMPLETE UNSUPPORTED_T1_CONCURRENCY ZERO_TESTS_EXECUTED PORT_FORWARD_CONFLICT NP08_HCC_AUTHORIZATION_FAILED PLAYWRIGHT_FAILED"for code in $required_codes; dodiff --git a/scripts/tests/test-minikube-t2-scenarios.sh b/scripts/tests/test-minikube-t2-scenarios.shindex b26b862b3..5b7861ef2 100755--- a/scripts/tests/test-minikube-t2-scenarios.sh+++ b/scripts/tests/test-minikube-t2-scenarios.sh@@ -606,12 +606,24 @@ grep -Fq 'origin/dev moved' "$tmp/pin-current.out" && fail 'a pin equal to the l# The children are require-t2-mutation-lock.sh, the boundary that validates a# lease without resolving repository metadata again."${pin_env[@]}" T2_LOCK_ROOT="$tmp/pin-locks" bash -c '- common="$1" base="$2" other="$3" out="$4" child="$5"+ common="$1" base="$2" other="$3" out="$4" child="$5" print="$6"source "$common"t2_repo_metadatat2_lock_acquiregrep -Fqx "ORIGIN_DEV=$base" "$T2_LOCK_DIR/owner.env" || { echo "owner.env does not record the pinned origin/dev" >&2; exit 11; }[ "$(bash -c '\''printf %s "$T2_PINNED_ORIGIN_DEV"'\'')" = "$base" ] || { echo "the lease owner does not export the pinned origin/dev" >&2; exit 12; }+ # T0 runs under the owner without holding the lease (no T2_SKIP_LOCK): a child+ # that inherits the pin is refused, which is how the first lane on 6ca44cbeb+ # died inside T0. t2_run_outside_lease starts such a child without the pin.+ if bash -c "$print" bash "$common" >"$out/unleased-leak.out" 2>&1; then+ echo "an unleased child that inherits the pin was accepted" >&2; exit 20+ fi+ grep -Fq "T2_PINNED_ORIGIN_DEV is only honored under an inherited T2 lease" "$out/unleased-leak.out" || { cat "$out/unleased-leak.out" >&2; exit 21; }+ t2_run_outside_lease bash -c "$print" bash "$common" >"$out/unleased.out" 2>&1 ||+ { cat "$out/unleased.out" >&2; echo "a child started through t2_run_outside_lease was refused" >&2; exit 22; }+ grep -Fqx "ORIGIN_DEV=$base" "$out/unleased.out" || { cat "$out/unleased.out" >&2; exit 23; }+ [ "$(t2_run_outside_lease bash -c '\''printf %s "${T2_PINNED_ORIGIN_DEV-unset}"'\'')" = unset ] ||+ { echo "t2_run_outside_lease passed the pin to its child" >&2; exit 24; }T2_LOCK_TOKEN="$T2_LOCK_TOKEN" bash "$child" ||{ echo "an inherited lease carrying the owner pin was refused" >&2; exit 13; }if T2_LOCK_TOKEN="$T2_LOCK_TOKEN" T2_PINNED_ORIGIN_DEV="$other" bash "$child" 2>"$out/pin-mismatch.err"; then@@ -630,8 +642,8 @@ grep -Fq 'origin/dev moved' "$tmp/pin-current.out" && fail 'a pin equal to the lfigrep -Fq "PROFILE_OWNERSHIP_MISMATCH: profile lock owner does not match ORIGIN_DEV" "$out/pin-unrecorded.err" || { cat "$out/pin-unrecorded.err" >&2; exit 19; }t2_lock_release 0-' bash "$COMMON" "$base_sha" "$dev_next" "$tmp" "$ROOT/scripts/minikube/require-t2-mutation-lock.sh" ||- fail 'the lease owner must record and export the pinned origin/dev, and its children must match it'+' bash "$COMMON" "$base_sha" "$dev_next" "$tmp" "$ROOT/scripts/minikube/require-t2-mutation-lock.sh" "$print_origin_dev" ||+ fail 'the lease owner must record and export the pinned origin/dev, its lease children must match it, and unleased children must not inherit it'[ ! -e "$tmp/pin-locks/$profile.lock" ] || fail 'the pinned lease was not released'# branch-profile.sh lifecycle (preflight, start, status, pf, health, pf-health,