Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(pr-416): close adversarial review findings
Alfredo Lopez1b55d8b193bb
diff --git a/.github/workflows/ci-public.yml b/.github/workflows/ci-public.ymlindex aeca7ecce..91c1be1ad 100644--- a/.github/workflows/ci-public.yml+++ b/.github/workflows/ci-public.yml@@ -29,7 +29,7 @@ jobs:# mode 100644), which breaks `make minikube-setup` with Permission# denied on a fresh clone. Regression gate for the PR #93 fix.run: |- bad=$(git ls-files -s '*.sh' | awk '$1 != "100755" {print $4}' || true)+ bad=$(git ls-files -s '*.sh' | awk '$1 != "100755" {print $4}')if [ -n "$bad" ]; thenecho "::error::Non-executable shell scripts (mode must be 100755):"echo "$bad"diff --git a/Makefile b/Makefileindex ba6a4be01..4e367b802 100644--- a/Makefile+++ b/Makefile@@ -123,6 +123,10 @@ build-preflight: ## Run local build preflight across deployable packages# ── Minikube Cluster ─────────────────────────────────────────────────MINIKUBE_PROFILE ?= clerum-test+# Startup supports the documented shared local profile before a branch-owned+# T2 lease exists. The mode is passed only by minikube-start; standalone auth+# sync remains lease-protected.+MINIKUBE_STARTUP_AUTH_SYNC_MODE ?= lockedMINIKUBE_MULTI_NODE ?= falseMINIKUBE_NODES ?=MINIKUBE_MEMORY ?= 10240@@ -145,7 +149,7 @@ minikube-start: ## Start minikube cluster (starts Docker Desktop if needed)echo "Docker ready."; \fiMINIKUBE_PROFILE="$(MINIKUBE_PROFILE)" MINIKUBE_MULTI_NODE="$(MINIKUBE_MULTI_NODE)" MINIKUBE_NODES="$(MINIKUBE_NODES)" MINIKUBE_MEMORY="$(MINIKUBE_MEMORY)" MINIKUBE_CPUS="$(MINIKUBE_CPUS)" scripts/minikube/start.sh- @$(MAKE) --no-print-directory minikube-sync-auth-key-if-present+ @$(MAKE) --no-print-directory MINIKUBE_STARTUP_AUTH_SYNC_MODE=shared-profile-mcp minikube-sync-auth-key-if-present.PHONY: minikube-stopminikube-stop: ## Stop minikube cluster@@ -448,7 +452,7 @@ minikube-apply-secrets: ## Apply all secrets to cluster (LLM keys read from .envminikube-apply-namespaces: ## Create all namespaces$(KC) apply -f deploy/base/namespaces.yaml-.PHONY: minikube-sync-auth-key minikube-sync-auth-key-body+.PHONY: minikube-sync-auth-key minikube-sync-auth-key-body minikube-sync-auth-key-shared-profileminikube-sync-auth-key: ## Sync JWT public key from rpc-proxy-secrets into runtime ConfigMaps when drift exists@T2_PROJECT_DIR="$(CURDIR)" T2_PROFILE="$(MINIKUBE_PROFILE)" T2_CONTEXT="$(MINIKUBE_PROFILE)" \T2_SKIP_LOCK="$(T2_SKIP_LOCK)" T2_LOCK_TOKEN="$(T2_LOCK_TOKEN)" \@@ -468,6 +472,10 @@ minikube-sync-auth-key-body:bash scripts/minikube/sync-auth-key.sh --context=$(MINIKUBE_PROFILE) --skip-gfs --require-mcp; \fi+minikube-sync-auth-key-shared-profile: ## Sync only MCP auth on the documented shared profile during startup+ @T2_PROJECT_DIR="$(CURDIR)" T2_PROFILE="$(MINIKUBE_PROFILE)" T2_CONTEXT="$(MINIKUBE_PROFILE)" \+ bash scripts/minikube/sync-auth-key.sh --context=$(MINIKUBE_PROFILE) --shared-profile-bootstrap --skip-gfs --require-mcp+.PHONY: minikube-sync-auth-key-if-presentminikube-sync-auth-key-if-present: ## Sync JWT public key only when minikube auth resources already exist@kubectl_probe_is_not_found() { \@@ -499,8 +507,10 @@ minikube-sync-auth-key-if-present: ## Sync JWT public key only when minikube autfi; \printf '%s\n' "$$mcp_probe_output" >&2; exit "$$mcp_probe_status"; \fi; \- if [ "$(T2_MUTATION_LOCK_WRAPPED)" = "true" ]; then \- $(MAKE) --no-print-directory minikube-sync-auth-key-body; \+ if [ "$(MINIKUBE_STARTUP_AUTH_SYNC_MODE)" = "shared-profile-mcp" ]; then \+ $(MAKE) --no-print-directory minikube-sync-auth-key-shared-profile; \+ elif [ "$(T2_MUTATION_LOCK_WRAPPED)" = "true" ]; then \+ $(MAKE) --no-print-directory minikube-sync-auth-key-body; \else \$(MAKE) --no-print-directory minikube-sync-auth-key; \fidiff --git a/deploy/scripts/lib/gfs-credential-rollout.sh b/deploy/scripts/lib/gfs-credential-rollout.shindex 1c8bf071e..20dbc9c7f 100755--- a/deploy/scripts/lib/gfs-credential-rollout.sh+++ b/deploy/scripts/lib/gfs-credential-rollout.sh@@ -97,8 +97,8 @@ rollout_exact() {credential_rollout_proof() {local secret="$1" deployment="$2" rotated_at="$3"local secret_json secret_rv active_dsn template_revision generation observed_revision- local selector rows pod_name pod_created pod_ready pod_deleting pod_owner pod_revision- local owner_revision+ local selector rows pod_name pod_created pod_ready pod_deleting pod_owner+ local owner_revision owner_revision_statuslocal pod_count=0 current_rvif ! deployment_uses_secret "$deployment" "$secret"; thendie "$GFS_NS/$deployment does not reference $GFS_NS/$secret; refusing to certify credential consumption"@@ -142,10 +142,10 @@ print(str(metadata.get("resourceVersion", "")) + "\t" + dsn)'); then*) die "unsupported GFSC deployment for credential proof: $deployment" ;;esacif ! rows="$(kc -n "$GFS_NS" get pods -l "$selector" -o \- 'jsonpath={range .items[*]}{.metadata.name}{"|"}{.metadata.creationTimestamp}{"|"}{.status.conditions[?(@.type=="Ready")].status}{"|"}{.metadata.deletionTimestamp}{"|"}{.metadata.ownerReferences[0].name}{"|"}{.metadata.annotations.clerum\.io/gfs-template-hash}{"\n"}{end}')"; then+ 'jsonpath={range .items[*]}{.metadata.name}{"|"}{.metadata.creationTimestamp}{"|"}{.status.conditions[?(@.type=="Ready")].status}{"|"}{.metadata.deletionTimestamp}{"|"}{.metadata.ownerReferences[0].name}{"\n"}{end}')"; thendie "cannot list $GFS_NS/$deployment pods for credential proof"fi- while IFS='|' read -r pod_name pod_created pod_ready pod_deleting pod_owner pod_revision; do+ while IFS='|' read -r pod_name pod_created pod_ready pod_deleting pod_owner; do[ -n "$pod_name" ] || continue[ -z "$pod_deleting" ] || continueif ! python3 - "$pod_created" "$rotated_at" <<'PY'@@ -164,9 +164,13 @@ PYdie "$GFS_NS/$deployment Ready pod predates the committed credential rotation"fi[ "$pod_ready" = True ] || die "$GFS_NS/$deployment has a live pod that is not Ready"+ [ -n "$pod_owner" ] || die "$GFS_NS/$deployment Ready pod has no owning ReplicaSet"+ owner_revision_status=0owner_revision="$(kc -n "$GFS_NS" get rs "$pod_owner" \- -o 'jsonpath={.metadata.annotations.deployment\.kubernetes\.io/revision}' 2>/dev/null || true)"- [ -n "$owner_revision" ] || owner_revision="$pod_revision"+ -o 'jsonpath={.metadata.annotations.deployment\.kubernetes\.io/revision}' 2>/dev/null)" || owner_revision_status=$?+ if [ "$owner_revision_status" -ne 0 ] || [ -z "$owner_revision" ]; then+ die "$GFS_NS/$deployment Ready pod owner ReplicaSet could not be verified"+ fi[ "$owner_revision" = "$template_revision" ] ||die "$GFS_NS/$deployment Ready pod is not on the observed template revision"if ! printf '%s' "$active_dsn" |diff --git a/deploy/scripts/provision-gfs-runtime.sh b/deploy/scripts/provision-gfs-runtime.shindex 1096f2c42..9c7689196 100755--- a/deploy/scripts/provision-gfs-runtime.sh+++ b/deploy/scripts/provision-gfs-runtime.sh@@ -218,7 +218,7 @@ else# context authorization into the auth-key mutator; it must not infer remote# ownership from a failed local Minikube probe.GFS_REMOTE_RECONCILE_AUTHORIZED=true ALLOWED_CONTEXTS="$CONTEXT" \- bash scripts/minikube/sync-auth-key.sh --context "$CONTEXT" --require-gfs+ bash "$ROOT/scripts/minikube/sync-auth-key.sh" --context "$CONTEXT" --require-gfsfiif [ "$SKIP_INSTANCES" = "1" ]; thendiff --git a/docs/deploy/minikube.md b/docs/deploy/minikube.mdindex 345a2aee5..dc85db36d 100644--- a/docs/deploy/minikube.md+++ b/docs/deploy/minikube.md@@ -221,6 +221,11 @@ single-node as the default, adds `--nodes=<n>` only when`MINIKUBE_MULTI_NODE=true` or `MINIKUBE_NODES>1`, enables`default-storageclass` and `storage-provisioner`, and fails if native minikubestatus or required node/storage readiness checks do not pass.+After the cluster is ready, startup performs an explicit MCP-only auth-key+bootstrap for the documented shared profile. It passes+`--shared-profile-bootstrap --skip-gfs --require-mcp`, so it does not mutate+the GFS plane or claim a branch-owned T2 lease. Standalone auth-key sync and+all T2/GFS mutations remain behind the branch-profile lease.If `full-setup.sh` detects a broken profile, it refuses destructive recreationunless `MINIKUBE_RECREATE_PROFILE=true` and `CONFIRM_PROFILE=<profile>` are bothset for that exact profile.diff --git a/scripts/e2e/minikube-real-postgres.sh b/scripts/e2e/minikube-real-postgres.shindex 4d980dd6f..008712ab3 100755--- a/scripts/e2e/minikube-real-postgres.sh+++ b/scripts/e2e/minikube-real-postgres.sh@@ -11,10 +11,10 @@ source "$PROJECT_DIR/scripts/minikube/t2-common.sh"PG_NAMESPACE="$T2_CONTROL_NAMESPACE"PG_SERVICE=control-postgresPG_SECRET=control-postgres-# Only suites that DROP/ALTER cluster-global roles cannot share live-# control-postgres (#412). They run against a throwaway PostgreSQL 16 that-# matches CI; the remaining control-api suites must exercise the validated-# branch profile database.+# Every control-api real-Postgres suite is isolated because any migration+# path may DROP/ALTER cluster-global roles (#412). They run against a+# throwaway PostgreSQL 16 that matches CI; the shared branch-profile database+# is reserved for the non-control-api lane.T1_ISOLATED_PG_IMAGE="${T1_ISOLATED_PG_IMAGE:-postgres:16-alpine}"T1_TIMEOUT="$T2_TIMEOUT_SECONDS"T1_TMP_ROOT="$T2_TMP_ROOT"diff --git a/scripts/minikube/filter-gfs-resources.py b/scripts/minikube/filter-gfs-resources.pyindex cfdc0239c..d56323d3c 100755--- a/scripts/minikube/filter-gfs-resources.py+++ b/scripts/minikube/filter-gfs-resources.py@@ -27,7 +27,7 @@ class MappingLine(NamedTuple):MAPPING_LINE = re.compile(- r"^(?P<indent>[ \t]*)(?P<key>[A-Za-z_][A-Za-z0-9_.-]*):"+ r"^(?P<indent>[ \t]*)(?P<key>[A-Za-z_][A-Za-z0-9_.-]*|\"[^\"\r\n]+\"|'[^'\r\n]+'):"r"(?:[ \t]*(?P<value>.*?))?[ \t]*$")DOCUMENT_START = re.compile(r"^---[ \t]*(?:#.*)?(?:\r?\n)?$")@@ -57,7 +57,7 @@ def mapping_line(line: str) -> MappingLine | None:return Nonereturn MappingLine(indentation(line),- match.group("key"),+ scalar_value(match.group("key")),match.group("value") or "",)diff --git a/scripts/minikube/pre-gate-sync.sh b/scripts/minikube/pre-gate-sync.shindex 84ade574a..7c5e55cd0 100755--- a/scripts/minikube/pre-gate-sync.sh+++ b/scripts/minikube/pre-gate-sync.sh@@ -11,7 +11,9 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"PROJECT_DIR="$(cd "${SCRIPT_DIR}/../.." && pwd)"PROFILE="${MINIKUBE_PROFILE:-clerum-test}"KC="kubectl --context=${PROFILE}"-WORKTREE_ID="$(printf '%s' "${PROJECT_DIR}" | shasum | awk '{print $1}')"+# shellcheck source=t2-worktree-id.sh+source "$SCRIPT_DIR/t2-worktree-id.sh"+WORKTREE_ID="$(t2_worktree_id "${PROJECT_DIR}")"STATE_ROOT="${TMPDIR:-/tmp}/clerum-pre-gate-sync"STATE_DIR="${STATE_ROOT}/${WORKTREE_ID}"CLUSTER_SYNC_STATE_CONFIGMAP="${CLERUM_PRE_GATE_SYNC_CONFIGMAP:-clerum-pre-gate-sync-state}"@@ -273,6 +275,21 @@ persist_state() {printf '%s' "${value}" >"$(state_file_for "${key}")"}+cluster_marker_value() {+ local field="$1" output+ if output="$(${KC} get configmap "${CLUSTER_SYNC_STATE_CONFIGMAP}" -n control-plane \+ -o "jsonpath={.data.${field}}" 2>&1)"; then+ printf '%s' "${output}"+ return 0+ fi+ if [[ "${output}" == *NotFound* || "${output}" == *"not found"* ]]; then+ printf ''+ return 0+ fi+ log "WARNING: unable to inspect ${CLUSTER_SYNC_STATE_CONFIGMAP}.${field}; treating marker as stale: ${output}" >&2+ printf ''+}+cluster_marker_matches() {local expected_cluster_fingerprint="$1"local expected_worktree_id="$2"@@ -281,18 +298,18 @@ cluster_marker_matches() {expected_git_head="$(git -C "${PROJECT_DIR}" rev-parse --verify HEAD 2>/dev/null || true)"- actual_cluster_fingerprint="$(${KC} get configmap "${CLUSTER_SYNC_STATE_CONFIGMAP}" -n control-plane -o jsonpath='{.data.clusterFingerprint}' 2>/dev/null || true)"- actual_worktree_id="$(${KC} get configmap "${CLUSTER_SYNC_STATE_CONFIGMAP}" -n control-plane -o jsonpath='{.data.worktreeId}' 2>/dev/null || true)"- actual_git_head="$(${KC} get configmap "${CLUSTER_SYNC_STATE_CONFIGMAP}" -n control-plane -o jsonpath='{.data.gitHead}' 2>/dev/null || true)"+ actual_cluster_fingerprint="$(cluster_marker_value clusterFingerprint)"+ actual_worktree_id="$(cluster_marker_value worktreeId)"+ actual_git_head="$(cluster_marker_value gitHead)"# The image coordinate is part of "in sync". gitHead cannot tell a ghcr# cluster from a local one, nor v0.6.0 from latest, and the acquisition stamp# is what catches a `make minikube-setup` between two pre-gates: that re-pulls# every release image and discards any shadow build while leaving this marker# untouched, so without it no sync would run and the gate would silently test# release code.- actual_image_source="$(${KC} get configmap "${CLUSTER_SYNC_STATE_CONFIGMAP}" -n control-plane -o jsonpath='{.data.imageSource}' 2>/dev/null || true)"- actual_image_tag="$(${KC} get configmap "${CLUSTER_SYNC_STATE_CONFIGMAP}" -n control-plane -o jsonpath='{.data.imageTag}' 2>/dev/null || true)"- actual_images_generated_at="$(${KC} get configmap "${CLUSTER_SYNC_STATE_CONFIGMAP}" -n control-plane -o jsonpath='{.data.imagesGeneratedAt}' 2>/dev/null || true)"+ actual_image_source="$(cluster_marker_value imageSource)"+ actual_image_tag="$(cluster_marker_value imageTag)"+ actual_images_generated_at="$(cluster_marker_value imagesGeneratedAt)"[[ "${actual_cluster_fingerprint}" == "${expected_cluster_fingerprint}" ]] &&[[ "${actual_worktree_id}" == "${expected_worktree_id}" ]] &&diff --git a/scripts/minikube/require-t2-mutation-lock.sh b/scripts/minikube/require-t2-mutation-lock.shindex 7110798dc..e63ab6e7f 100755--- a/scripts/minikube/require-t2-mutation-lock.sh+++ b/scripts/minikube/require-t2-mutation-lock.sh@@ -33,7 +33,7 @@ actual_root="$(git -C "${T2_PROJECT_DIR}" rev-parse --show-toplevel 2>/dev/null}T2_BRANCH="$(git -C "${T2_PROJECT_DIR}" branch --show-current 2>/dev/null || true)"T2_HEAD="$(git -C "${T2_PROJECT_DIR}" rev-parse --verify HEAD 2>/dev/null || true)"-T2_WORKTREE_ID="$(printf '%s' "${T2_PROJECT_DIR}" | shasum | awk '{print $1}')"+T2_WORKTREE_ID="$(t2_worktree_id "${T2_PROJECT_DIR}")"[[ -n "${T2_BRANCH}" && -n "${T2_HEAD}" ]] || {printf 'DEVELOPMENT_SCOPE_REQUIRED: mutation child cannot resolve branch and HEAD\n' >&2exit 1diff --git a/scripts/minikube/settle-gfs-reader-rollout.sh b/scripts/minikube/settle-gfs-reader-rollout.shindex 5167c5227..e98266c65 100755--- a/scripts/minikube/settle-gfs-reader-rollout.sh+++ b/scripts/minikube/settle-gfs-reader-rollout.sh@@ -155,12 +155,16 @@ if [ "$ready" != "$desired" ]; thenfi# Desired Ready is met from here on: leftovers below serve nothing.-current_rev="$(kc -n "$GFS_NS" get deployment "$DEPLOY" \- -o jsonpath='{.metadata.annotations.deployment\.kubernetes\.io/revision}')"+if ! current_rev="$(kc -n "$GFS_NS" get deployment "$DEPLOY" \+ -o jsonpath='{.metadata.annotations.deployment\.kubernetes\.io/revision}' 2>&1)"; then+ die "unable to read current revision for ${GFS_NS}/${DEPLOY}: ${current_rev}"+fiscaled_rs_names=()-rs_rows="$(kc -n "$GFS_NS" get rs -l "$SELECTOR" -o \+if ! rs_rows="$(kc -n "$GFS_NS" get rs -l "$SELECTOR" -o \'jsonpath={range .items[*]}{.metadata.name}{"|"}{.metadata.ownerReferences[0].name}{"|"}{.spec.replicas}{"|"}{.status.readyReplicas}{"|"}{.metadata.annotations.deployment\.kubernetes\.io/revision}{"\n"}{end}' \- 2>/dev/null)"+ 2>&1)"; then+ die "unable to inspect ${GFS_NS} ReplicaSets before reader settlement: ${rs_rows}"+fiwhile IFS='|' read -r rs_name rs_owner rs_replicas rs_ready rs_rev; do[ -n "$rs_name" ] || continue[ "$rs_owner" = "$DEPLOY" ] || continue@@ -180,9 +184,11 @@ if [ "${#scaled_rs_names[@]}" -gt 0 ]; thendonefi-pod_rows="$(kc -n "$GFS_NS" get pods -l "$SELECTOR" -o \+if ! pod_rows="$(kc -n "$GFS_NS" get pods -l "$SELECTOR" -o \'jsonpath={range .items[*]}{.metadata.name}{"|"}{.status.conditions[?(@.type=="Ready")].status}{"|"}{.metadata.deletionTimestamp}{"|"}{.status.containerStatuses[0].state.waiting.reason}{"\n"}{end}' \- 2>/dev/null)"+ 2>&1)"; then+ die "unable to inspect ${GFS_NS} reader pods before crash-loop cleanup: ${pod_rows}"+fiwhile IFS='|' read -r pod_name pod_ready pod_deleting pod_reason; do[ -n "$pod_name" ] || continue[ -z "$pod_deleting" ] || continuediff --git a/scripts/minikube/sync-auth-key.sh b/scripts/minikube/sync-auth-key.shindex ef99e2fee..221f97f5b 100755--- a/scripts/minikube/sync-auth-key.sh+++ b/scripts/minikube/sync-auth-key.sh@@ -6,6 +6,7 @@ PROFILE="clerum-test"REQUIRE_GFS=falseREQUIRE_MCP=falseSYNC_GFS=true+SHARED_PROFILE_BOOTSTRAP=falsewhile [[ $# -gt 0 ]]; docase "$1" in@@ -34,8 +35,15 @@ while [[ $# -gt 0 ]]; doSYNC_GFS=falseshift;;+ --shared-profile-bootstrap)+ # The documented shared local profile may be started before a+ # branch-owned T2 lease exists. This mode is intentionally limited to+ # MCP-only convergence; GFS and remote authorization stay forbidden.+ SHARED_PROFILE_BOOTSTRAP=true+ shift+ ;;-h|--help)- echo "Usage: scripts/minikube/sync-auth-key.sh [--context <kubectl-context>] [--require-mcp] [--require-gfs|--skip-gfs]" >&2+ echo "Usage: scripts/minikube/sync-auth-key.sh [--context <kubectl-context>] [--require-mcp] [--require-gfs|--skip-gfs] [--shared-profile-bootstrap]" >&2exit 0;;*)@@ -50,6 +58,17 @@ if [[ "${REQUIRE_GFS}" == "true" && "${SYNC_GFS}" != "true" ]]; thenexit 2fi+if [[ "${SHARED_PROFILE_BOOTSTRAP}" == "true" ]]; then+ if [[ "${REQUIRE_MCP}" != "true" || "${SYNC_GFS}" != "false" || "${REQUIRE_GFS}" == "true" ]]; then+ echo "--shared-profile-bootstrap requires --require-mcp --skip-gfs and forbids --require-gfs" >&2+ exit 2+ fi+ if [[ "${GFS_REMOTE_RECONCILE_AUTHORIZED:-false}" == "true" ]]; then+ echo "--shared-profile-bootstrap cannot carry remote reconciliation authorization" >&2+ exit 2+ fi+fi+log() { printf '[sync-auth-key] %s\n' "$*"; }die() {log "ERROR: $*" >&2@@ -87,7 +106,7 @@ fi[[ "${PROFILE}" == "${T2_PROFILE}" && "${PROFILE}" == "${T2_CONTEXT}" ]] ||die "auth-key convergence target profile and Kubernetes context do not match"-if [ "${REMOTE_RECONCILE}" != true ]; then+if [ "${REMOTE_RECONCILE}" != true ] && [ "${SHARED_PROFILE_BOOTSTRAP}" != true ]; then# Auth-key convergence mutates runtime ConfigMaps and restarts consumers. It# is a child of the owning T2/full-setup transition, never an independent# writer. Validate the complete lease identity, including branch/HEAD and@@ -99,7 +118,7 @@ if [ "${REMOTE_RECONCILE}" != true ]; thendie "auth-key convergence worktree does not match the lease repository"T2_BRANCH="$(git -C "${T2_PROJECT_DIR}" branch --show-current 2>/dev/null || true)"T2_HEAD="$(git -C "${T2_PROJECT_DIR}" rev-parse --verify HEAD 2>/dev/null || true)"- T2_WORKTREE_ID="$(printf '%s' "${T2_PROJECT_DIR}" | shasum | awk '{print $1}')"+ T2_WORKTREE_ID="$(t2_worktree_id "${T2_PROJECT_DIR}")"[[ -n "${T2_BRANCH}" && -n "${T2_HEAD}" ]] || die "auth-key convergence cannot resolve the current branch and HEAD"t2_lock_validate_inheritedfi@@ -539,7 +558,7 @@ sync_gfs() {log "Deferring active gfsc auth proof until GFS credentials are reconciled"return 0fi- die "cannot inspect ${GFS_NAMESPACE}/gfs-controller-db before gfsc restart: ${dsn_encoded}"+ die "cannot inspect ${GFS_NAMESPACE}/gfs-controller-db before gfsc restart"fiif [[ -z "${dsn_encoded}" ]]; thenif [[ "${GFS_AUTH_SYNC_ALLOW_STAGED}" == "true" ]]; thendiff --git a/scripts/minikube/t0.sh b/scripts/minikube/t0.shindex d8f777b26..6a41f531b 100755--- a/scripts/minikube/t0.sh+++ b/scripts/minikube/t0.sh@@ -58,12 +58,14 @@ elseprintf 'T0_SHELLCHECK=NOT_APPLICABLE\n'fi-for package in "${package_dirs[@]}"; do- printf '[minikube-t0] affected package: %s test\n' "$package"- (cd "$PROJECT_DIR/$package" && npm test)- printf '[minikube-t0] affected package: %s build/typecheck\n' "$package"- (cd "$PROJECT_DIR/$package" && npm run build)-done+if [ "${#package_dirs[@]}" -gt 0 ]; then+ for package in "${package_dirs[@]}"; do+ printf '[minikube-t0] affected package: %s test\n' "$package"+ (cd "$PROJECT_DIR/$package" && npm test)+ printf '[minikube-t0] affected package: %s build/typecheck\n' "$package"+ (cd "$PROJECT_DIR/$package" && npm run build)+ done+fiprintf 'T0_AFFECTED_PACKAGES=%s\n' "${package_dirs[*]:-none}"printf 'T0_AFFECTED_CHECKS=PASS\n'diff --git a/scripts/minikube/t2-common.sh b/scripts/minikube/t2-common.shindex ea0d1e258..9ce7a8e25 100755--- a/scripts/minikube/t2-common.sh+++ b/scripts/minikube/t2-common.sh@@ -7,6 +7,8 @@ set +uT2_SCRIPT_DIR="$T2_SCRIPT_DIR"if [ -z "$T2_SCRIPT_DIR" ]; then T2_SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"; fi+# shellcheck source=t2-worktree-id.sh+. "$T2_SCRIPT_DIR/t2-worktree-id.sh"# shellcheck source=profile-readiness.sh. "$T2_SCRIPT_DIR/profile-readiness.sh"T2_PROJECT_DIR="$T2_PROJECT_DIR"@@ -191,7 +193,7 @@ t2_repo_metadata() {T2_NEXT_COMMAND='commit or restore the worktree before invoking Minikube validation't2_fail DEVELOPMENT_SCOPE_REQUIRED 'worktree is dirty'fi- T2_WORKTREE_ID="$(printf '%s' "$T2_PROJECT_DIR" | shasum | awk '{print $1}')"+ T2_WORKTREE_ID="$(t2_worktree_id "$T2_PROJECT_DIR")"}t2_profile_scope() {@@ -609,9 +611,12 @@ for (namespace, name), item in selected:return int(value)desired = integer(spec.get("replicas"), "spec.replicas")- # A present deployment explicitly scaled to zero is an intentional local- # suspension; it is not an unready pod.+ # Additional deployments may be intentionally suspended locally, but a+ # deployment in the required scope is part of the certification contract+ # and must not pass readiness at replicas=0.if desired == 0:+ if (namespace, name) in scope_refs:+ bad.append(f"{namespace}/{name} scaled to zero")continueready = integer(status.get("readyReplicas"), "status.readyReplicas")available = integer(status.get("availableReplicas"), "status.availableReplicas")diff --git a/scripts/minikube/t2-worktree-id.sh b/scripts/minikube/t2-worktree-id.shnew file mode 100755index 000000000..e3805fbd2--- /dev/null+++ b/scripts/minikube/t2-worktree-id.sh@@ -0,0 +1,6 @@+#!/usr/bin/env bash+# Shared deterministic worktree identity for the local T2 mutation contract.++t2_worktree_id() {+ printf '%s' "$1" | shasum | awk '{print $1}'+}diff --git a/scripts/tests/test-minikube-filter-gfs-resources.sh b/scripts/tests/test-minikube-filter-gfs-resources.shindex d167e1bcc..6fb897cda 100755--- a/scripts/tests/test-minikube-filter-gfs-resources.sh+++ b/scripts/tests/test-minikube-filter-gfs-resources.sh@@ -34,6 +34,12 @@ metadata:name: gfs"""+source += """---+apiVersion: v1+"kind": Namespace+"metadata":+ "name": gfs+"""result = subprocess.run([sys.executable, filter_path],input=source,@@ -50,6 +56,7 @@ assert " ---\n kind: Namespace" in outputassert "kind: Example" in outputassert "spec:\n name: gfs" in outputassert "kind: Namespace\nmetadata:\n name: gfs" not in output+assert '"kind": Namespace\n"metadata":\n "name": gfs' not in outputempty = subprocess.run([sys.executable, filter_path],diff --git a/scripts/tests/test-minikube-makefile.sh b/scripts/tests/test-minikube-makefile.shindex 768f6c611..9d1668a6f 100755--- a/scripts/tests/test-minikube-makefile.sh+++ b/scripts/tests/test-minikube-makefile.sh@@ -81,6 +81,7 @@ assert_succeeds_dry minikube-verify-networkpoliciesassert_contains minikube-start "minikube-sync-auth-key-if-present"assert_contains minikube-start "--context=clerum-test"+assert_contains minikube-start "MINIKUBE_STARTUP_AUTH_SYNC_MODE=shared-profile-mcp"assert_contains minikube-deploy-all "with-t2-mutation-lock.sh"assert_contains minikube-deploy-all-body "minikube-sync-auth-key"assert_contains minikube-sync-auth-key "with-t2-mutation-lock.sh"@@ -93,6 +94,9 @@ assert_contains minikube-sync-auth-key-if-present "minikube-sync-auth-key"assert_contains minikube-sync-auth-key-if-present "NotFound"assert_contains minikube-sync-auth-key-if-present "rpc_probe_status"assert_not_contains minikube-sync-auth-key-if-present "canonical T2 profile lock is not held"+assert_contains minikube-sync-auth-key-shared-profile "--shared-profile-bootstrap"+assert_not_contains minikube-sync-auth-key-shared-profile "with-t2-mutation-lock.sh"+assert_file_contains scripts/minikube/sync-auth-key.sh "--shared-profile-bootstrap"assert_contains minikube-deploy-all-body "set -o pipefail"assert_contains minikube-deploy-all-body "mktemp"assert_contains minikube-deploy-all-body "filtered_manifest"diff --git a/scripts/tests/test-minikube-settle-gfs-reader-rollout.sh b/scripts/tests/test-minikube-settle-gfs-reader-rollout.shindex 834b70e35..8655ccc85 100755--- a/scripts/tests/test-minikube-settle-gfs-reader-rollout.sh+++ b/scripts/tests/test-minikube-settle-gfs-reader-rollout.sh@@ -11,6 +11,10 @@ grep -Fq 'if [ "${#scaled_rs_names[@]}" -gt 0 ]; then' "$SCRIPT" ||fail 'settle must guard empty ReplicaSet arrays under Bash 3.2 set -u'grep -Fq 'if [ -n "${ALLOWED_CONTEXTS:-}" ]; then' "$SCRIPT" ||fail 'settle must guard empty authorization-context arrays under Bash 3.2 set -u'+grep -Fq 'unable to inspect ${GFS_NS} ReplicaSets before reader settlement' "$SCRIPT" ||+ fail 'settle must report ReplicaSet inspection failures instead of swallowing kubectl stderr'+grep -Fq 'unable to inspect ${GFS_NS} reader pods before crash-loop cleanup' "$SCRIPT" ||+ fail 'settle must report reader-pod inspection failures instead of swallowing kubectl stderr'run_settle() {local fake_dir repo profile shadiff --git a/scripts/tests/test-minikube-t2-contract.sh b/scripts/tests/test-minikube-t2-contract.shindex dfc20664e..896398a83 100755--- a/scripts/tests/test-minikube-t2-contract.sh+++ b/scripts/tests/test-minikube-t2-contract.sh@@ -59,6 +59,12 @@ grep -Fq 't0.sh' "$T2"grep -Fq 'T0_SHELLCHECK=PASS' "$T0"grep -Fq 'npm run build' "$T0"grep -Fq 'npm test' "$T0"+grep -Fq 'if [ "${#package_dirs[@]}" -gt 0 ]' "$T0"+grep -Fq 'Ready pod owner ReplicaSet could not be verified' "$ROOT/deploy/scripts/lib/gfs-credential-rollout.sh"+grep -Fq 'treating marker as stale' "$ROOT/scripts/minikube/pre-gate-sync.sh"+for identity_file in "$COMMON" "$ROOT/scripts/minikube/sync-auth-key.sh" "$ROOT/scripts/minikube/require-t2-mutation-lock.sh" "$ROOT/scripts/minikube/pre-gate-sync.sh"; do+ grep -Fq 't2_worktree_id' "$identity_file"+donegrep -Fq 'bash "$T2_PROJECT_DIR/scripts/tests/test-minikube-t2-contract.sh"' "$T2"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 ZERO_TESTS_EXECUTED PORT_FORWARD_CONFLICT NP08_HCC_AUTHORIZATION_FAILED"diff --git a/scripts/tests/test-minikube-t2-scenarios.sh b/scripts/tests/test-minikube-t2-scenarios.shindex 4edcb6e79..475efb6ca 100755--- a/scripts/tests/test-minikube-t2-scenarios.sh+++ b/scripts/tests/test-minikube-t2-scenarios.sh@@ -311,6 +311,13 @@ default_core_ready_json='{"items":[{"metadata":{"namespace":"control-plane","namenv "${repo_env[@]}" T2_REQUIRED_DEPLOYMENTS= DEFAULT_CORE_READY_JSON="$default_core_ready_json" \bash -c 'source "$1"; T2_PLAN_MODE=false; T2_BOOTSTRAP_REQUIRED=false; t2_kc(){ printf "%s" "$DEFAULT_CORE_READY_JSON"; }; t2_deployment_check' bash "$COMMON"+# A required core Deployment scaled to zero is not a valid certification+# result, even though additional non-core Deployments may remain suspended.+zero_core_json='{"items":[{"metadata":{"namespace":"control-plane","name":"control-api","generation":1},"spec":{"replicas":0},"status":{"observedGeneration":1,"updatedReplicas":0,"readyReplicas":0,"availableReplicas":0,"unavailableReplicas":0}},{"metadata":{"namespace":"control-plane","name":"host-context-controller","generation":1},"spec":{"replicas":1},"status":{"observedGeneration":1,"updatedReplicas":1,"readyReplicas":1,"availableReplicas":1,"unavailableReplicas":0}},{"metadata":{"namespace":"profiles","name":"external-rest-api","generation":1},"spec":{"replicas":1},"status":{"observedGeneration":1,"updatedReplicas":1,"readyReplicas":1,"availableReplicas":1,"unavailableReplicas":0}},{"metadata":{"namespace":"rpc-proxy","name":"rpc-proxy","generation":1},"spec":{"replicas":1},"status":{"observedGeneration":1,"updatedReplicas":1,"readyReplicas":1,"availableReplicas":1,"unavailableReplicas":0}},{"metadata":{"namespace":"mcp-host","name":"chatllm","generation":1},"spec":{"replicas":1},"status":{"observedGeneration":1,"updatedReplicas":1,"readyReplicas":1,"availableReplicas":1,"unavailableReplicas":0}}]}'+expect_code PROFILE_UNHEALTHY required-core-scaled-zero required-core-scaled-zero \+ env "${repo_env[@]}" T2_REQUIRED_DEPLOYMENTS= ZERO_CORE_JSON="$zero_core_json" \+ bash -c 'source "$1"; T2_PLAN_MODE=false; T2_BOOTSTRAP_REQUIRED=false; t2_kc(){ printf "%s" "$ZERO_CORE_JSON"; }; t2_deployment_check' bash "$COMMON"+# Production scope also evaluates every additional Deployment. Keep the five# core Deployments healthy while an otherwise out-of-scope UI is unready; the# old allowlist passed this fixture and certified a broken profile.