Skip to content

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

TypeScript

fix(minikube): enforce profile mutation ownership and readiness

Alfredo Lopez6db0071e163b
diff --git a/Makefile b/Makefile
index 51aec064c..ecbe24d04 100644
--- a/Makefile
+++ b/Makefile
@@ -226,12 +226,19 @@ minikube-deploy-instances: ## Apply CRD test instances (context, host, channel)
minikube-detect-k8s-api-ip: ## Patch overlays/minikube/patches/k8s-api-ip.yaml with current node IP
@CONTEXT=$(MINIKUBE_PROFILE) deploy/scripts/minikube-detect-k8s-api-ip.sh
-.PHONY: minikube-deploy-all
+.PHONY: minikube-deploy-all minikube-deploy-all-body
minikube-deploy-all: ## Deploy ALL services via Kustomize minikube overlay
+ @T2_PROJECT_DIR="$(CURDIR)" T2_PROFILE="$(MINIKUBE_PROFILE)" T2_CONTEXT="$(MINIKUBE_PROFILE)" \
+ T2_SKIP_LOCK="$(T2_SKIP_LOCK)" T2_LOCK_TOKEN="$(T2_LOCK_TOKEN)" \
+ MINIKUBE_GFS_MUTATION="$(MINIKUBE_GFS_MUTATION)" \
+ bash scripts/minikube/with-t2-mutation-lock.sh -- \
+ $(MAKE) --no-print-directory minikube-deploy-all-body
+
+minikube-deploy-all-body:
+ @T2_PROJECT_DIR="$(CURDIR)" T2_PROFILE="$(MINIKUBE_PROFILE)" T2_CONTEXT="$(MINIKUBE_PROFILE)" \
+ T2_SKIP_LOCK=true T2_LOCK_TOKEN="$(T2_LOCK_TOKEN)" \
+ bash scripts/minikube/require-t2-mutation-lock.sh
@$(MAKE) --no-print-directory minikube-detect-k8s-api-ip
- @if [ "$(MINIKUBE_GFS_MUTATION)" = "true" ] && [ -z "$(T2_LOCK_TOKEN)" ]; then \
- echo "[minikube-deploy-all] refusing GFS mutation without the owning T2 profile lock" >&2; exit 1; \
- fi
@# Upgrade path: adopt/validate writer and stage reader before HCC cutover.
@if [ "$(MINIKUBE_GFS_MUTATION)" != "true" ]; then echo "[minikube-deploy-all] GFS mutation disabled for this non-T2 sync"; fi
@if [ "$(MINIKUBE_GFS_MUTATION)" = "true" ]; then \
@@ -321,8 +328,18 @@ minikube-restart-all: ## Restart all Clerum deployments
done
@echo "All deployments restarted."
-.PHONY: minikube-deploy-crds
+.PHONY: minikube-deploy-crds minikube-deploy-crds-body
minikube-deploy-crds: ## Install/upgrade CRDs via Helm chart + apply CRD YAML (idempotent)
+ @T2_PROJECT_DIR="$(CURDIR)" T2_PROFILE="$(MINIKUBE_PROFILE)" T2_CONTEXT="$(MINIKUBE_PROFILE)" \
+ T2_SKIP_LOCK="$(T2_SKIP_LOCK)" T2_LOCK_TOKEN="$(T2_LOCK_TOKEN)" \
+ MINIKUBE_GFS_MUTATION="$(MINIKUBE_GFS_MUTATION)" \
+ bash scripts/minikube/with-t2-mutation-lock.sh -- \
+ $(MAKE) --no-print-directory minikube-deploy-crds-body
+
+minikube-deploy-crds-body:
+ @T2_PROJECT_DIR="$(CURDIR)" T2_PROFILE="$(MINIKUBE_PROFILE)" T2_CONTEXT="$(MINIKUBE_PROFILE)" \
+ T2_SKIP_LOCK=true T2_LOCK_TOKEN="$(T2_LOCK_TOKEN)" \
+ bash scripts/minikube/require-t2-mutation-lock.sh
kubectl --context=$(MINIKUBE_PROFILE) apply -f deploy/base/namespaces.yaml
@if [ "$(MINIKUBE_GFS_MUTATION)" = "false" ]; then \
echo "[minikube-deploy-crds] GFS CRD mutation disabled for this non-T2 gate"; \
@@ -364,9 +381,18 @@ minikube-restart-deploy: ## Restart a single deployment without rebuilding (usag
# Use `make minikube-sync-auth-key` to copy the public key automatically
# from rpc-proxy-secrets into both runtime ConfigMaps after key regeneration.
#
-.PHONY: minikube-gen-keys
+.PHONY: minikube-gen-keys minikube-gen-keys-body
minikube-gen-keys: ## Generate JWT signing keys + auto-sync to mcp-host-config
- @scripts/minikube/generate-keys.sh
+ @T2_PROJECT_DIR="$(CURDIR)" T2_PROFILE="$(MINIKUBE_PROFILE)" T2_CONTEXT="$(MINIKUBE_PROFILE)" \
+ T2_SKIP_LOCK="$(T2_SKIP_LOCK)" T2_LOCK_TOKEN="$(T2_LOCK_TOKEN)" \
+ bash scripts/minikube/with-t2-mutation-lock.sh -- \
+ $(MAKE) --no-print-directory minikube-gen-keys-body
+
+minikube-gen-keys-body:
+ @T2_PROJECT_DIR="$(CURDIR)" T2_PROFILE="$(MINIKUBE_PROFILE)" T2_CONTEXT="$(MINIKUBE_PROFILE)" \
+ T2_SKIP_LOCK=true T2_LOCK_TOKEN="$(T2_LOCK_TOKEN)" \
+ bash scripts/minikube/require-t2-mutation-lock.sh
+ @scripts/minikube/generate-keys.sh
@if [ -f deploy/minikube/secrets/jwt-signing-keys.yaml ]; then \
$(KC) apply -f deploy/minikube/secrets/jwt-signing-keys.yaml; \
else \
@@ -403,11 +429,18 @@ minikube-apply-secrets: ## Apply all secrets to cluster (LLM keys read from .env
minikube-apply-namespaces: ## Create all namespaces
$(KC) apply -f deploy/base/namespaces.yaml
-.PHONY: minikube-sync-auth-key
+.PHONY: minikube-sync-auth-key minikube-sync-auth-key-body
minikube-sync-auth-key: ## Sync JWT public key from rpc-proxy-secrets into runtime ConfigMaps when drift exists
- @if [ -z "$(T2_LOCK_TOKEN)" ]; then \
- echo "[minikube-sync-auth-key] refusing ConfigMap mutation without the owning T2 profile lock" >&2; exit 1; \
- fi
+ @T2_PROJECT_DIR="$(CURDIR)" T2_PROFILE="$(MINIKUBE_PROFILE)" T2_CONTEXT="$(MINIKUBE_PROFILE)" \
+ T2_SKIP_LOCK="$(T2_SKIP_LOCK)" T2_LOCK_TOKEN="$(T2_LOCK_TOKEN)" \
+ MINIKUBE_GFS_MUTATION="$(MINIKUBE_GFS_MUTATION)" \
+ bash scripts/minikube/with-t2-mutation-lock.sh -- \
+ $(MAKE) --no-print-directory minikube-sync-auth-key-body
+
+minikube-sync-auth-key-body:
+ @T2_PROJECT_DIR="$(CURDIR)" T2_PROFILE="$(MINIKUBE_PROFILE)" T2_CONTEXT="$(MINIKUBE_PROFILE)" \
+ T2_SKIP_LOCK=true T2_LOCK_TOKEN="$(T2_LOCK_TOKEN)" \
+ bash scripts/minikube/require-t2-mutation-lock.sh
@if [ "$(MINIKUBE_GFS_MUTATION)" = "true" ]; then \
T2_PROJECT_DIR="$(CURDIR)" T2_PROFILE="$(MINIKUBE_PROFILE)" T2_CONTEXT="$(MINIKUBE_PROFILE)" T2_SKIP_LOCK="$(T2_SKIP_LOCK)" T2_LOCK_TOKEN="$(T2_LOCK_TOKEN)" \
bash scripts/minikube/sync-auth-key.sh --context=$(MINIKUBE_PROFILE); \
@@ -801,8 +834,18 @@ minikube-status: ## Show status of all Clerum services in minikube
minikube-logs: ## Show logs for a service (usage: make minikube-logs SVC=control-api NS=control-plane)
$(KC) logs -n $(NS) deploy/$(SVC) --tail=50
-.PHONY: minikube-db-reset
+.PHONY: minikube-db-reset minikube-db-reset-body
minikube-db-reset: ## Reset control-api postgres (re-enables first-time admin setup)
+ @T2_PROJECT_DIR="$(CURDIR)" T2_PROFILE="$(MINIKUBE_PROFILE)" T2_CONTEXT="$(MINIKUBE_PROFILE)" \
+ T2_SKIP_LOCK="$(T2_SKIP_LOCK)" T2_LOCK_TOKEN="$(T2_LOCK_TOKEN)" \
+ CONTROL_DB_RESET_PVC_UID="$(CONTROL_DB_RESET_PVC_UID)" CONTROL_DB_RESET_RESUME="$(CONTROL_DB_RESET_RESUME)" \
+ bash scripts/minikube/with-t2-mutation-lock.sh -- \
+ $(MAKE) --no-print-directory minikube-db-reset-body
+
+minikube-db-reset-body:
+ @T2_PROJECT_DIR="$(CURDIR)" T2_PROFILE="$(MINIKUBE_PROFILE)" T2_CONTEXT="$(MINIKUBE_PROFILE)" \
+ T2_SKIP_LOCK=true T2_LOCK_TOKEN="$(T2_LOCK_TOKEN)" \
+ bash scripts/minikube/require-t2-mutation-lock.sh
@if [ -z "$(CONTROL_DB_RESET_PVC_UID)" ]; then echo "ERROR: CONTROL_DB_RESET_PVC_UID=<approved UID|none> is required"; exit 1; fi
@reset_args="--expected-pvc-uid $(CONTROL_DB_RESET_PVC_UID)"; \
if [ "$(CONTROL_DB_RESET_PVC_UID)" = "none" ]; then reset_args="--expect-no-pvc"; fi; \
@@ -812,8 +855,10 @@ minikube-db-reset: ## Reset control-api postgres (re-enables first-time admin se
@echo "Scaling up postgres..."
@$(KC) scale deploy/control-postgres --replicas=1 -n control-plane
@$(KC) wait --for=condition=Available deploy/control-postgres -n control-plane --timeout=90s
- @CONTEXT=$(MINIKUBE_PROFILE) bash deploy/scripts/converge-control-db-after-reset.sh \
- --overlay deploy/overlays/minikube --job-name control-api-db-migrate-reset
+ @T2_PROJECT_DIR="$(CURDIR)" T2_PROFILE="$(MINIKUBE_PROFILE)" T2_CONTEXT="$(MINIKUBE_PROFILE)" \
+ T2_SKIP_LOCK=true T2_LOCK_TOKEN="$(T2_LOCK_TOKEN)" CONTEXT=$(MINIKUBE_PROFILE) \
+ bash deploy/scripts/converge-control-db-after-reset.sh \
+ --overlay deploy/overlays/minikube --job-name control-api-db-migrate-reset
@echo "DB reset complete. First-time admin setup is available again."
.PHONY: minikube-seed-test-data
diff --git a/autoresearch.ideas.md b/autoresearch.ideas.md
new file mode 100644
index 000000000..581ad421e
--- /dev/null
+++ b/autoresearch.ideas.md
@@ -0,0 +1,3 @@
+# AutoResearch Ideas
+
+- [ ] Record the next scoped hypothesis after each packet.
diff --git a/autoresearch.jsonl b/autoresearch.jsonl
new file mode 100644
index 000000000..423c18dc1
--- /dev/null
+++ b/autoresearch.jsonl
@@ -0,0 +1,2 @@
+{"asi": {"evidence": "Configuration recorded", "hypothesis": "Session setup", "next_action_hint": "Run doctor, then next.", "rollback_reason": ""}, "baseline_policy": "initial", "baseline_policy_source": "explicit", "benchmark_command": "PYTHONDONTWRITEBYTECODE=1 bash scripts/tests/test-minikube-profile-readiness.sh", "checks_command": "bash scripts/tests/test-minikube-t2-scenarios.sh", "commit_paths": [], "created_at": "2026-08-21T08:47:13+00:00", "delta": null, "direction": "lower", "entry_type": "config", "generation_spine_enabled": true, "goal": "Reduce Minikube startup overhead while preserving strict branch-profile ownership and readiness gates", "hard_gates": {"eval_harness_unchanged": true, "finite_primary_metric": true, "fresh_packet": true, "no_eval_gaming": true, "no_scope_violation": true, "no_secret_leak": true, "tests_pass": true}, "metric": "evenfire_minikube_healthy_start_calls", "minimum_delta": 0.0, "scope": "scripts/minikube/start.sh,scripts/minikube/t2-common.sh,scripts/minikube/profile-readiness.sh,scripts/tests/test-minikube-profile-readiness.sh,scripts/tests/test-minikube-t2-scenarios.sh", "scorecard_id": "ralph_autoresearch_v1", "scorecard_path": "/Users/alfredolopez/Documents/GitHub/codex-ralph-vault-loop/config/scorecards/ralph_autoresearch_v1.yaml", "scorecard_version": 1, "segment_id": "reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z", "status": "config"}
+{"asi": {"evidence": "Logged from latest packet evidence", "hypothesis": "Manual AutoResearch packet", "next_action_hint": "Read state, inspect ASI, and choose the next scoped packet.", "rollback_reason": ""}, "baseline": 0.0, "baseline_policy": "initial", "commit_paths": [], "created_at": "2026-08-21T09:11:18+00:00", "delta": 0.0, "description": "", "direction": "lower", "entry_type": "packet", "hard_gates": {"eval_harness_unchanged": true, "finite_primary_metric": true, "fresh_packet": true, "no_eval_gaming": true, "no_scope_violation": true, "no_secret_leak": true, "tests_pass": true}, "last_run_path": "/Users/alfredolopez/.codex/worktrees/f3d2/evenfire/autoresearch.last-run.json", "metric": "evenfire_minikube_healthy_start_calls", "metrics": {"evenfire_minikube_healthy_start_calls": 0.0, "evenfire_minikube_partial_start_calls": 1.0}, "scorecard_id": "ralph_autoresearch_v1", "scorecard_version": 1, "segment_id": "reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z", "status": "keep"}
diff --git a/autoresearch.last-run.json b/autoresearch.last-run.json
new file mode 100644
index 000000000..c8b8b22c8
--- /dev/null
+++ b/autoresearch.last-run.json
@@ -0,0 +1,62 @@
+{
+ "asi_template": {
+ "evidence": "candidate_patch=captured (tracked_diff_detected); metrics=evenfire_minikube_healthy_start_calls=0.0, evenfire_minikube_partial_start_calls=1.0; baseline=0.0; delta=0.0; hard_gates=all true.",
+ "family": "autoresearch",
+ "hypothesis": "The captured candidate may improve the configured goal: Reduce Minikube startup overhead while preserving strict branch-profile ownership and readiness gates.",
+ "lane": "local",
+ "next_action_hint": "Review the candidate evidence, metric delta, and hard gates before logging a keep/discard decision.",
+ "risk": "candidate_requires_review",
+ "rollback_reason": "Revert the scoped candidate changes if validation fails or the candidate is discarded."
+ },
+ "baseline": 0.0,
+ "baseline_policy": "initial",
+ "baseline_policy_source": "explicit",
+ "candidate_patch": {
+ "decision_required": true,
+ "reason": "tracked_diff_detected",
+ "status": "captured"
+ },
+ "checks": {
+ "returncode": 0
+ },
+ "command_returncode": 0,
+ "cwd": "/Users/alfredolopez/.codex/worktrees/f3d2/evenfire",
+ "delta": 0.0,
+ "freshness_fingerprint": "29e5278281304861c420dafd107ec9356e235561cca873d4810051983cbdc52a",
+ "generation": {
+ "files": {
+ "asi": "/Users/alfredolopez/.codex/worktrees/f3d2/evenfire/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/asi.json",
+ "candidate_patch": "/Users/alfredolopez/.codex/worktrees/f3d2/evenfire/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/candidate.patch",
+ "checks": "/Users/alfredolopez/.codex/worktrees/f3d2/evenfire/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/checks.json",
+ "command": "/Users/alfredolopez/.codex/worktrees/f3d2/evenfire/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/command.json",
+ "decision": "/Users/alfredolopez/.codex/worktrees/f3d2/evenfire/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/decision.json",
+ "hard_gates": "/Users/alfredolopez/.codex/worktrees/f3d2/evenfire/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/hard_gates.json",
+ "improvement": "/Users/alfredolopez/.codex/worktrees/f3d2/evenfire/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/improvement.md",
+ "manifest": "/Users/alfredolopez/.codex/worktrees/f3d2/evenfire/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/manifest.json",
+ "metrics": "/Users/alfredolopez/.codex/worktrees/f3d2/evenfire/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/metrics.json",
+ "scan_report": "/Users/alfredolopez/.codex/worktrees/f3d2/evenfire/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/scan_report.json",
+ "stderr_preview": "/Users/alfredolopez/.codex/worktrees/f3d2/evenfire/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/benchmark.stderr.preview.txt",
+ "stdout_preview": "/Users/alfredolopez/.codex/worktrees/f3d2/evenfire/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/benchmark.stdout.preview.txt",
+ "trace": "/Users/alfredolopez/.codex/worktrees/f3d2/evenfire/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/trace.json"
+ },
+ "generation_id": "gen_001",
+ "path": "/Users/alfredolopez/.codex/worktrees/f3d2/evenfire/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001"
+ },
+ "hard_gates": {
+ "eval_harness_unchanged": true,
+ "finite_primary_metric": true,
+ "fresh_packet": true,
+ "no_eval_gaming": true,
+ "no_scope_violation": true,
+ "no_secret_leak": true,
+ "tests_pass": true
+ },
+ "metric": "evenfire_minikube_healthy_start_calls",
+ "metrics": {
+ "evenfire_minikube_healthy_start_calls": 0.0,
+ "evenfire_minikube_partial_start_calls": 1.0
+ },
+ "ok": true,
+ "primary_metric_present": true,
+ "segment_id": "reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z"
+}
diff --git a/autoresearch.md b/autoresearch.md
new file mode 100644
index 000000000..01f264a52
--- /dev/null
+++ b/autoresearch.md
@@ -0,0 +1,18 @@
+# AutoResearch: Reduce Minikube startup overhead while preserving strict branch-profile ownership and readiness gates
+
+## Objective
+Reduce Minikube startup overhead while preserving strict branch-profile ownership and readiness gates
+
+## Metric
+- Primary: evenfire_minikube_healthy_start_calls (lower is better)
+- Baseline policy: initial
+
+## Scope
+scripts/minikube/start.sh,scripts/minikube/t2-common.sh,scripts/minikube/profile-readiness.sh,scripts/tests/test-minikube-profile-readiness.sh,scripts/tests/test-minikube-t2-scenarios.sh
+
+## Commands
+- Benchmark: `PYTHONDONTWRITEBYTECODE=1 bash scripts/tests/test-minikube-profile-readiness.sh`
+- Checks: `bash scripts/tests/test-minikube-t2-scenarios.sh`
+
+## Safety
+Codex main decides. Scorecards and gates decide keep/discard. RED content must not be logged.
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/asi.json b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/asi.json
new file mode 100644
index 000000000..e552d52bb
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/asi.json
@@ -0,0 +1,9 @@
+{
+ "evidence": "candidate_patch=captured (tracked_diff_detected); metrics=evenfire_minikube_healthy_start_calls=0.0, evenfire_minikube_partial_start_calls=1.0; baseline=0.0; delta=0.0; hard_gates=all true.",
+ "family": "autoresearch",
+ "hypothesis": "The captured candidate may improve the configured goal: Reduce Minikube startup overhead while preserving strict branch-profile ownership and readiness gates.",
+ "lane": "local",
+ "next_action_hint": "Review the candidate evidence, metric delta, and hard gates before logging a keep/discard decision.",
+ "risk": "candidate_requires_review",
+ "rollback_reason": "Revert the scoped candidate changes if validation fails or the candidate is discarded."
+}
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/benchmark.stderr.preview.txt b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/benchmark.stderr.preview.txt
new file mode 100644
index 000000000..e69de29bb
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/benchmark.stdout.preview.txt b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/benchmark.stdout.preview.txt
new file mode 100644
index 000000000..473a509f3
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/benchmark.stdout.preview.txt
@@ -0,0 +1,3 @@
+METRIC evenfire_minikube_healthy_start_calls=0
+METRIC evenfire_minikube_partial_start_calls=1
+PASS: strict profile readiness and healthy-profile startup reuse
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/candidate.patch b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/candidate.patch
new file mode 100644
index 000000000..320c69982
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/candidate.patch
@@ -0,0 +1,16 @@
+Makefile | 73 +++++++++++++++++-----
+ deploy/scripts/converge-control-db-after-reset.sh | 19 ++++++
+ deploy/scripts/provision-gfs-runtime.sh | 6 +-
+ deploy/scripts/reconcile-gfs-deploy-credentials.sh | 18 +++---
+ scripts/minikube/pre-gate-sync.sh | 3 +-
+ scripts/minikube/start.sh | 25 +++++++-
+ scripts/minikube/sync-auth-key.sh | 68 +++++++++++++-------
+ scripts/minikube/t2-common.sh | 28 ++++++---
+ scripts/tests/test-gfs-deploy-contract.sh | 56 ++++++++++++++---
+ scripts/tests/test-minikube-makefile.sh | 9 ++-
+ scripts/tests/test-minikube-pre-gate-shadow.sh | 5 +-
+ .../tests/test-minikube-sync-auth-key-durable.sh | 8 +++
+ scripts/tests/test-minikube-sync-auth-key.sh | 8 +++
+ scripts/tests/test-minikube-t2-contract.sh | 5 +-
+ scripts/tests/test-minikube-t2-scenarios.sh | 9 +++
+ 15 files changed, 269 insertions(+), 71 deletions(-)
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/checks.json b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/checks.json
new file mode 100644
index 000000000..d7fe282f5
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/checks.json
@@ -0,0 +1,6 @@
+{
+ "benchmark_returncode": 0,
+ "checks": {
+ "returncode": 0
+ }
+}
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/command.json b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/command.json
new file mode 100644
index 000000000..7941cc50a
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/command.json
@@ -0,0 +1,10 @@
+{
+ "benchmark_command": "PYTHONDONTWRITEBYTECODE=1 bash scripts/tests/test-minikube-profile-readiness.sh",
+ "checks_command": "bash scripts/tests/test-minikube-t2-scenarios.sh",
+ "cwd": "/Users/alfredolopez/.codex/worktrees/f3d2/evenfire",
+ "env_allowlist": [
+ "PYTHONDONTWRITEBYTECODE",
+ "RALPH_AUTORESEARCH_GENERATION_SPINE"
+ ],
+ "timeout": 120
+}
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/decision.json b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/decision.json
new file mode 100644
index 000000000..d375bbbd9
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/decision.json
@@ -0,0 +1,9 @@
+{
+ "baseline": 0.0,
+ "baseline_policy": "initial",
+ "candidate_patch_status": "captured",
+ "decision_required": true,
+ "delta": 0.0,
+ "reason": "candidate_review_pending",
+ "status": "pending"
+}
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/hard_gates.json b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/hard_gates.json
new file mode 100644
index 000000000..585e58047
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/hard_gates.json
@@ -0,0 +1,9 @@
+{
+ "eval_harness_unchanged": true,
+ "finite_primary_metric": true,
+ "fresh_packet": true,
+ "no_eval_gaming": true,
+ "no_scope_violation": true,
+ "no_secret_leak": true,
+ "tests_pass": true
+}
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/improvement.md b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/improvement.md
new file mode 100644
index 000000000..88142ec07
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/improvement.md
@@ -0,0 +1,25 @@
+# AutoResearch Packet Synthesis
+
+- Goal: Reduce Minikube startup overhead while preserving strict branch-profile ownership and readiness gates
+- Recommendation status: candidate-review-required
+- Candidate patch: `captured` (tracked_diff_detected)
+- Primary metric: `evenfire_minikube_healthy_start_calls=0.0`
+- Emitted metrics: evenfire_minikube_healthy_start_calls=0.0, evenfire_minikube_partial_start_calls=1.0
+- Baseline: 0.0
+- Delta: 0.0
+- Hard gates: all true
+
+## Evidence
+The packet completed the configured benchmark and checks and captured their metric and hard-gate results.
+
+## Expected Benefit
+The generation bundle is self-explanatory: it distinguishes harness validation from an evaluated candidate and carries actionable ASI.
+
+## Risk
+A captured working-tree summary identifies candidate scope but is not proof that the behavior is correct.
+
+## Validation Needed
+Inspect the scoped changes and run the validation required by the target repository before deciding.
+
+## Recommendation
+Review the candidate, metric delta, and hard gates before logging any keep/discard decision.
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/manifest.json b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/manifest.json
new file mode 100644
index 000000000..1206e9aa8
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/manifest.json
@@ -0,0 +1,6 @@
+{
+ "created_at": "2026-08-21T08:47:44+00:00",
+ "generation_id": "gen_000",
+ "schema": "ralph-autoresearch-generation-v1",
+ "segment_id": "reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z"
+}
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/metrics.json b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/metrics.json
new file mode 100644
index 000000000..47153c0ee
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/metrics.json
@@ -0,0 +1,4 @@
+{
+ "evenfire_minikube_healthy_start_calls": 0.0,
+ "evenfire_minikube_partial_start_calls": 1.0
+}
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/scan_report.json b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/scan_report.json
new file mode 100644
index 000000000..10deae609
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/scan_report.json
@@ -0,0 +1,105 @@
+{
+ "created_at": "2026-08-21T08:47:44+00:00",
+ "fail_closed": true,
+ "required_artifacts": [
+ "asi",
+ "candidate_patch",
+ "checks",
+ "command",
+ "decision",
+ "hard_gates",
+ "improvement",
+ "manifest",
+ "metrics",
+ "stderr_preview",
+ "stdout_preview",
+ "trace"
+ ],
+ "scanned_artifacts": {
+ "asi": {
+ "bytes": 710,
+ "path": "asi.json",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "5cf55cc883d4365cc5d5868aa51e4a41044da3fa46434050e4c98473bd833d58"
+ },
+ "candidate_patch": {
+ "bytes": 1031,
+ "path": "candidate.patch",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "fe86c5f7ee9a3465aab0e4d6198b0d629239fff9ee76e9ece211eed059d0923e"
+ },
+ "checks": {
+ "bytes": 71,
+ "path": "checks.json",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "8bc9756109f2b43a0be6ad6876f0545bfbfa89dd1e0d99a50b89193c44ea96d8"
+ },
+ "command": {
+ "bytes": 361,
+ "path": "command.json",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "b36895879c6e14c12abc528d32401d097f8cf3ba46211c177380c788639d3342"
+ },
+ "decision": {
+ "bytes": 202,
+ "path": "decision.json",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "daf35fb6b1984dfb923e7ed47396d308c4a5f115a8a481f8060177b6ca16d49c"
+ },
+ "hard_gates": {
+ "bytes": 198,
+ "path": "hard_gates.json",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "1a8051584b1188c3fd0fc7e6351dcae0bd5bd23b669ad9ef55343d8ada0a0838"
+ },
+ "improvement": {
+ "bytes": 1091,
+ "path": "improvement.md",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "fcbb8b2fce300d5a9f6737fc0215cf678e9debf4dba7c6d736007ab7cb194181"
+ },
+ "manifest": {
+ "bytes": 213,
+ "path": "manifest.json",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "01cf5049eb9b64a05f84d126ae1a01b6d02dc071bc040165128f2b1272ddbfbf"
+ },
+ "metrics": {
+ "bytes": 99,
+ "path": "metrics.json",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "733128802267e24685db0937895e0af2b7c7633645df027484092768ca27e3e9"
+ },
+ "stderr_preview": {
+ "bytes": 0,
+ "path": "benchmark.stderr.preview.txt",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+ },
+ "stdout_preview": {
+ "bytes": 159,
+ "path": "benchmark.stdout.preview.txt",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "5ad037e89fb12913fd50b4440da571c0eb4c0fa0ba3139dde0d1b423c98b45f9"
+ },
+ "trace": {
+ "bytes": 258,
+ "path": "trace.json",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "87c0873bc7f1558f47ac8d3d98da924c670fae3b1244d92c61b33db0a1c8655f"
+ }
+ },
+ "scanner": "sensitive_content.is_red"
+}
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/trace.json b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/trace.json
new file mode 100644
index 000000000..592016706
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_000/trace.json
@@ -0,0 +1,7 @@
+{
+ "candidate_patch_reason": "tracked_diff_detected",
+ "candidate_patch_status": "captured",
+ "freshness_fingerprint": "8a313dbfdcf61f2dd11464915212caa7cd0b7133ba4c3306a5804218eed56179",
+ "output_preview_bytes": 65536,
+ "primary_metric_present": true
+}
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/asi.json b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/asi.json
new file mode 100644
index 000000000..e552d52bb
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/asi.json
@@ -0,0 +1,9 @@
+{
+ "evidence": "candidate_patch=captured (tracked_diff_detected); metrics=evenfire_minikube_healthy_start_calls=0.0, evenfire_minikube_partial_start_calls=1.0; baseline=0.0; delta=0.0; hard_gates=all true.",
+ "family": "autoresearch",
+ "hypothesis": "The captured candidate may improve the configured goal: Reduce Minikube startup overhead while preserving strict branch-profile ownership and readiness gates.",
+ "lane": "local",
+ "next_action_hint": "Review the candidate evidence, metric delta, and hard gates before logging a keep/discard decision.",
+ "risk": "candidate_requires_review",
+ "rollback_reason": "Revert the scoped candidate changes if validation fails or the candidate is discarded."
+}
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/benchmark.stderr.preview.txt b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/benchmark.stderr.preview.txt
new file mode 100644
index 000000000..e69de29bb
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/benchmark.stdout.preview.txt b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/benchmark.stdout.preview.txt
new file mode 100644
index 000000000..473a509f3
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/benchmark.stdout.preview.txt
@@ -0,0 +1,3 @@
+METRIC evenfire_minikube_healthy_start_calls=0
+METRIC evenfire_minikube_partial_start_calls=1
+PASS: strict profile readiness and healthy-profile startup reuse
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/candidate.patch b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/candidate.patch
new file mode 100644
index 000000000..320c69982
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/candidate.patch
@@ -0,0 +1,16 @@
+Makefile | 73 +++++++++++++++++-----
+ deploy/scripts/converge-control-db-after-reset.sh | 19 ++++++
+ deploy/scripts/provision-gfs-runtime.sh | 6 +-
+ deploy/scripts/reconcile-gfs-deploy-credentials.sh | 18 +++---
+ scripts/minikube/pre-gate-sync.sh | 3 +-
+ scripts/minikube/start.sh | 25 +++++++-
+ scripts/minikube/sync-auth-key.sh | 68 +++++++++++++-------
+ scripts/minikube/t2-common.sh | 28 ++++++---
+ scripts/tests/test-gfs-deploy-contract.sh | 56 ++++++++++++++---
+ scripts/tests/test-minikube-makefile.sh | 9 ++-
+ scripts/tests/test-minikube-pre-gate-shadow.sh | 5 +-
+ .../tests/test-minikube-sync-auth-key-durable.sh | 8 +++
+ scripts/tests/test-minikube-sync-auth-key.sh | 8 +++
+ scripts/tests/test-minikube-t2-contract.sh | 5 +-
+ scripts/tests/test-minikube-t2-scenarios.sh | 9 +++
+ 15 files changed, 269 insertions(+), 71 deletions(-)
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/checks.json b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/checks.json
new file mode 100644
index 000000000..d7fe282f5
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/checks.json
@@ -0,0 +1,6 @@
+{
+ "benchmark_returncode": 0,
+ "checks": {
+ "returncode": 0
+ }
+}
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/command.json b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/command.json
new file mode 100644
index 000000000..da7b33536
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/command.json
@@ -0,0 +1,10 @@
+{
+ "benchmark_command": "PYTHONDONTWRITEBYTECODE=1 bash scripts/tests/test-minikube-profile-readiness.sh",
+ "checks_command": "bash scripts/tests/test-minikube-t2-scenarios.sh",
+ "cwd": "/Users/alfredolopez/.codex/worktrees/f3d2/evenfire",
+ "env_allowlist": [
+ "PYTHONDONTWRITEBYTECODE",
+ "RALPH_AUTORESEARCH_GENERATION_SPINE"
+ ],
+ "timeout": 300
+}
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/decision.json b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/decision.json
new file mode 100644
index 000000000..022995aef
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/decision.json
@@ -0,0 +1,7 @@
+{
+ "baseline": 0.0,
+ "baseline_policy": "initial",
+ "delta": 0.0,
+ "logged_at": "2026-08-21T09:11:18+00:00",
+ "status": "keep"
+}
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/hard_gates.json b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/hard_gates.json
new file mode 100644
index 000000000..585e58047
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/hard_gates.json
@@ -0,0 +1,9 @@
+{
+ "eval_harness_unchanged": true,
+ "finite_primary_metric": true,
+ "fresh_packet": true,
+ "no_eval_gaming": true,
+ "no_scope_violation": true,
+ "no_secret_leak": true,
+ "tests_pass": true
+}
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/improvement.md b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/improvement.md
new file mode 100644
index 000000000..88142ec07
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/improvement.md
@@ -0,0 +1,25 @@
+# AutoResearch Packet Synthesis
+
+- Goal: Reduce Minikube startup overhead while preserving strict branch-profile ownership and readiness gates
+- Recommendation status: candidate-review-required
+- Candidate patch: `captured` (tracked_diff_detected)
+- Primary metric: `evenfire_minikube_healthy_start_calls=0.0`
+- Emitted metrics: evenfire_minikube_healthy_start_calls=0.0, evenfire_minikube_partial_start_calls=1.0
+- Baseline: 0.0
+- Delta: 0.0
+- Hard gates: all true
+
+## Evidence
+The packet completed the configured benchmark and checks and captured their metric and hard-gate results.
+
+## Expected Benefit
+The generation bundle is self-explanatory: it distinguishes harness validation from an evaluated candidate and carries actionable ASI.
+
+## Risk
+A captured working-tree summary identifies candidate scope but is not proof that the behavior is correct.
+
+## Validation Needed
+Inspect the scoped changes and run the validation required by the target repository before deciding.
+
+## Recommendation
+Review the candidate, metric delta, and hard gates before logging any keep/discard decision.
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/manifest.json b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/manifest.json
new file mode 100644
index 000000000..bf1fba960
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/manifest.json
@@ -0,0 +1,6 @@
+{
+ "created_at": "2026-08-21T08:53:23+00:00",
+ "generation_id": "gen_001",
+ "schema": "ralph-autoresearch-generation-v1",
+ "segment_id": "reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z"
+}
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/metrics.json b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/metrics.json
new file mode 100644
index 000000000..47153c0ee
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/metrics.json
@@ -0,0 +1,4 @@
+{
+ "evenfire_minikube_healthy_start_calls": 0.0,
+ "evenfire_minikube_partial_start_calls": 1.0
+}
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/scan_report.json b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/scan_report.json
new file mode 100644
index 000000000..03ad07013
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/scan_report.json
@@ -0,0 +1,105 @@
+{
+ "created_at": "2026-08-21T08:53:23+00:00",
+ "fail_closed": true,
+ "required_artifacts": [
+ "asi",
+ "candidate_patch",
+ "checks",
+ "command",
+ "decision",
+ "hard_gates",
+ "improvement",
+ "manifest",
+ "metrics",
+ "stderr_preview",
+ "stdout_preview",
+ "trace"
+ ],
+ "scanned_artifacts": {
+ "asi": {
+ "bytes": 710,
+ "path": "asi.json",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "5cf55cc883d4365cc5d5868aa51e4a41044da3fa46434050e4c98473bd833d58"
+ },
+ "candidate_patch": {
+ "bytes": 1031,
+ "path": "candidate.patch",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "fe86c5f7ee9a3465aab0e4d6198b0d629239fff9ee76e9ece211eed059d0923e"
+ },
+ "checks": {
+ "bytes": 71,
+ "path": "checks.json",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "8bc9756109f2b43a0be6ad6876f0545bfbfa89dd1e0d99a50b89193c44ea96d8"
+ },
+ "command": {
+ "bytes": 361,
+ "path": "command.json",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "f5adf7b6f8a593440747811661474613156ae4c7ecc0729d1f7f9f30e31e94f4"
+ },
+ "decision": {
+ "bytes": 202,
+ "path": "decision.json",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "daf35fb6b1984dfb923e7ed47396d308c4a5f115a8a481f8060177b6ca16d49c"
+ },
+ "hard_gates": {
+ "bytes": 198,
+ "path": "hard_gates.json",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "1a8051584b1188c3fd0fc7e6351dcae0bd5bd23b669ad9ef55343d8ada0a0838"
+ },
+ "improvement": {
+ "bytes": 1091,
+ "path": "improvement.md",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "fcbb8b2fce300d5a9f6737fc0215cf678e9debf4dba7c6d736007ab7cb194181"
+ },
+ "manifest": {
+ "bytes": 213,
+ "path": "manifest.json",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "4a30ddfe2a87c7a43ade1dc3602965cb6faebf831109ff68adefd0060346a782"
+ },
+ "metrics": {
+ "bytes": 99,
+ "path": "metrics.json",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "733128802267e24685db0937895e0af2b7c7633645df027484092768ca27e3e9"
+ },
+ "stderr_preview": {
+ "bytes": 0,
+ "path": "benchmark.stderr.preview.txt",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+ },
+ "stdout_preview": {
+ "bytes": 159,
+ "path": "benchmark.stdout.preview.txt",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "5ad037e89fb12913fd50b4440da571c0eb4c0fa0ba3139dde0d1b423c98b45f9"
+ },
+ "trace": {
+ "bytes": 258,
+ "path": "trace.json",
+ "scan_status": "pass",
+ "scanner": "sensitive_content.is_red",
+ "sha256": "0f9e3d2a8d2b001b560df521c660d4bd09528992f8a036ef53a0214f921c4c3d"
+ }
+ },
+ "scanner": "sensitive_content.is_red"
+}
diff --git a/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/trace.json b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/trace.json
new file mode 100644
index 000000000..246568e15
--- /dev/null
+++ b/autoresearch.runs/reduce-minikube-startup-overhead-while-preservin-2026-08-21T084713Z/gen_001/trace.json
@@ -0,0 +1,7 @@
+{
+ "candidate_patch_reason": "tracked_diff_detected",
+ "candidate_patch_status": "captured",
+ "freshness_fingerprint": "29e5278281304861c420dafd107ec9356e235561cca873d4810051983cbdc52a",
+ "output_preview_bytes": 65536,
+ "primary_metric_present": true
+}
diff --git a/deploy/scripts/converge-control-db-after-reset.sh b/deploy/scripts/converge-control-db-after-reset.sh
index 404d61076..25c77da56 100755
--- a/deploy/scripts/converge-control-db-after-reset.sh
+++ b/deploy/scripts/converge-control-db-after-reset.sh
@@ -35,6 +35,25 @@ done
[ -n "$OVERLAY" ] \
|| { printf '[converge-control-db-after-reset] ERROR: --overlay is required\n' >&2; exit 2; }
+# Reset convergence writes cluster state, scales multiple workloads, and
+# restores GFS credentials. It is a private child of the owning T2/full-setup
+# transition and must prove that lease before the first Kubernetes read/write.
+# The validator also binds the effective profile and context, so CONTEXT alone
+# cannot redirect this recovery path.
+T2_EFFECTIVE_PROFILE="${T2_PROFILE:-${MINIKUBE_PROFILE:-${CONTEXT}}}"
+T2_EFFECTIVE_CONTEXT="${T2_CONTEXT:-${CONTROL_API_REAL_PG_CONTEXT:-${CONTEXT}}}"
+if [[ "${T2_EFFECTIVE_PROFILE}" != "${T2_EFFECTIVE_CONTEXT}" ||
+ "${T2_EFFECTIVE_CONTEXT}" != "${CONTEXT}" ]]; then
+ printf '[converge-control-db-after-reset] ERROR: mutation profile/context does not match CONTEXT\n' >&2
+ exit 1
+fi
+T2_PROJECT_DIR="${T2_PROJECT_DIR:-${ROOT}}" \
+T2_PROFILE="${T2_EFFECTIVE_PROFILE}" \
+T2_CONTEXT="${T2_EFFECTIVE_CONTEXT}" \
+T2_LOCK_TOKEN="${T2_LOCK_TOKEN:-}" \
+T2_LOCK_ROOT="${T2_LOCK_ROOT:-${HOME}/.cache/evenfire/minikube-t2-locks}" \
+bash "$ROOT/scripts/minikube/require-t2-mutation-lock.sh"
+
kc() { kubectl --context="$CONTEXT" "$@"; }
fail() { printf '[converge-control-db-after-reset] ERROR: %s\n' "$*" >&2; exit 1; }
diff --git a/deploy/scripts/provision-gfs-runtime.sh b/deploy/scripts/provision-gfs-runtime.sh
index bcc7f3527..1096f2c42 100755
--- a/deploy/scripts/provision-gfs-runtime.sh
+++ b/deploy/scripts/provision-gfs-runtime.sh
@@ -214,7 +214,11 @@ if [ "$SKIP_SYNC" = "1" ]; then
log "Skipping runtime auth configuration sync"
else
log "Syncing runtime auth configuration"
- bash scripts/minikube/sync-auth-key.sh --context "$CONTEXT" --require-gfs
+ # This entrypoint is the explicit non-local boundary. Carry the same exact
+ # 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
fi
if [ "$SKIP_INSTANCES" = "1" ]; then
diff --git a/deploy/scripts/reconcile-gfs-deploy-credentials.sh b/deploy/scripts/reconcile-gfs-deploy-credentials.sh
index cab7d63a6..2613bc88f 100755
--- a/deploy/scripts/reconcile-gfs-deploy-credentials.sh
+++ b/deploy/scripts/reconcile-gfs-deploy-credentials.sh
@@ -32,18 +32,16 @@ remote_context_allowed() {
return 1
}
-minikube_profile_exists() {
- local status
- status="$(minikube -p "$CONTEXT" status 2>/dev/null || true)"
- [ -n "$status" ] &&
- [[ "$status" != *"does not exist"* && "$status" != *"not found"* && "$status" != *Nonexistent* ]]
-}
-
# The sibling infra deploy path owns its explicit non-local context decision.
-# A local Minikube profile, even if a caller supplies the legacy remote flag,
-# must still use the branch-owned T2 lease below.
+# Remote mode is enabled only by an exact allowlist match. In particular, a
+# failed or empty `minikube status` result is never interpreted as evidence
+# that a target is remote.
REMOTE_RECONCILE=false
-if remote_context_allowed && ! minikube_profile_exists; then
+if [ "${GFS_REMOTE_RECONCILE_AUTHORIZED:-false}" = true ]; then
+ if ! remote_context_allowed; then
+ printf '[reconcile-gfs-deploy] ERROR: remote context is not explicitly allowlisted: %s\n' "$CONTEXT" >&2
+ exit 1
+ fi
REMOTE_RECONCILE=true
fi
diff --git a/scripts/minikube/pre-gate-sync.sh b/scripts/minikube/pre-gate-sync.sh
index 747917c83..84ade574a 100755
--- a/scripts/minikube/pre-gate-sync.sh
+++ b/scripts/minikube/pre-gate-sync.sh
@@ -654,7 +654,8 @@ if [[ "${cluster_changed}" == "true" ]]; then
cd "${PROJECT_DIR}"
gfs_crd_mutation=false
[[ "${GATE_NAME}" == "minikube-t2" ]] && gfs_crd_mutation=true
- MINIKUBE_GFS_MUTATION="${gfs_crd_mutation}" make minikube-deploy-crds
+ T2_SKIP_LOCK=true T2_LOCK_TOKEN="${T2_LOCK_TOKEN}" \
+ MINIKUBE_GFS_MUTATION="${gfs_crd_mutation}" make minikube-deploy-crds
)
if [[ "${GATE_NAME}" == "minikube-t2" ]]; then
CONTEXT="${PROFILE}" bash "${PROJECT_DIR}/deploy/scripts/apply-gfs-writer-secret.sh"
diff --git a/scripts/minikube/profile-readiness.sh b/scripts/minikube/profile-readiness.sh
new file mode 100644
index 000000000..762ac9df3
--- /dev/null
+++ b/scripts/minikube/profile-readiness.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+# Side-effect-free Minikube status predicates shared by startup and T2.
+
+minikube_profile_status_component_is_running() {
+ local status="$1" component="$2" json_component="$3"
+
+ case "$status" in
+ *"${component}: Running"*|*"${json_component}: Running"*) return 0 ;;
+ esac
+ [[ "$status" =~ \"${json_component}\"[[:space:]]*:[[:space:]]*\"Running\" ]]
+}
+
+minikube_profile_status_is_healthy() {
+ local status="$1"
+
+ [ -n "$status" ] || return 1
+ minikube_profile_status_component_is_running "$status" host Host || return 1
+ minikube_profile_status_component_is_running "$status" kubelet Kubelet || return 1
+ minikube_profile_status_component_is_running "$status" apiserver APIServer || return 1
+ [[ "$status" != *Stopped* ]] || return 1
+ [[ "$status" != *Nonexistent* ]] || return 1
+ [[ "$status" != *'does not exist'* ]] || return 1
+ [[ "$status" != *'not found'* ]] || return 1
+}
+
+minikube_profile_status_is_missing_or_stopped() {
+ local status="$1"
+
+ [ -z "$status" ] ||
+ [[ "$status" == *Stopped* ||
+ "$status" == *Nonexistent* ||
+ "$status" == *'does not exist'* ||
+ "$status" == *'not found'* ]]
+}
diff --git a/scripts/minikube/require-t2-mutation-lock.sh b/scripts/minikube/require-t2-mutation-lock.sh
new file mode 100755
index 000000000..7110798dc
--- /dev/null
+++ b/scripts/minikube/require-t2-mutation-lock.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+# Validate an inherited branch-profile mutation lease before a private child
+# mutator performs its first Kubernetes write. The parent transition owns the
+# lease; this boundary never acquires or releases it.
+set -euo pipefail
+
+ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd -P)"
+T2_PROJECT_DIR="${T2_PROJECT_DIR:-${ROOT}}"
+T2_PROFILE="${T2_PROFILE:-${MINIKUBE_PROFILE:-}}"
+T2_CONTEXT="${T2_CONTEXT:-${CONTROL_API_REAL_PG_CONTEXT:-${T2_PROFILE}}}"
+MINIKUBE_PROFILE="${MINIKUBE_PROFILE:-${T2_PROFILE}}"
+CONTROL_API_REAL_PG_CONTEXT="${CONTROL_API_REAL_PG_CONTEXT:-${T2_CONTEXT}}"
+T2_LOCK_TOKEN="${T2_LOCK_TOKEN:-}"
+T2_SKIP_LOCK=true
+T2_GATE_ID="${T2_GATE_ID:-mutation-child}"
+
+if [[ -z "${T2_PROFILE}" || -z "${T2_CONTEXT}" || "${T2_PROFILE}" != "${T2_CONTEXT}" ]]; then
+ printf 'PROFILE_LOCK_REQUIRED: mutation target profile and Kubernetes context must match\n' >&2
+ exit 1
+fi
+
+# shellcheck source=scripts/minikube/t2-common.sh
+source "${ROOT}/scripts/minikube/t2-common.sh"
+# The public wrapper already performed repository/profile/context health checks
+# before acquiring the lease. Children must revalidate the lease identity
+# without doing a second status/readiness transition: this keeps the first
+# child Kubernetes operation behind the same opaque owner token while allowing
+# generated profile status to remain the parent's responsibility.
+actual_root="$(git -C "${T2_PROJECT_DIR}" rev-parse --show-toplevel 2>/dev/null || true)"
+[[ -n "${actual_root}" && "$(cd -- "${actual_root}" && pwd -P)" == "${T2_PROJECT_DIR}" ]] || {
+ printf 'DEVELOPMENT_SCOPE_REQUIRED: mutation child worktree does not match the lease repository\n' >&2
+ exit 1
+}
+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}')"
+[[ -n "${T2_BRANCH}" && -n "${T2_HEAD}" ]] || {
+ printf 'DEVELOPMENT_SCOPE_REQUIRED: mutation child cannot resolve branch and HEAD\n' >&2
+ exit 1
+}
+t2_lock_validate_inherited
diff --git a/scripts/minikube/start.sh b/scripts/minikube/start.sh
index d6b4a86c6..b5d39234b 100755
--- a/scripts/minikube/start.sh
+++ b/scripts/minikube/start.sh
@@ -1,9 +1,13 @@
#!/usr/bin/env bash
-# Start a Clerum minikube profile. Single-node is the default; multi-node is
+# Start an Evenfire minikube profile. Single-node is the default; multi-node is
# opt-in via MINIKUBE_MULTI_NODE=true or MINIKUBE_NODES=<n>.
set -euo pipefail
+START_SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
+# shellcheck source=profile-readiness.sh
+source "$START_SCRIPT_DIR/profile-readiness.sh"
+
PROFILE="${MINIKUBE_PROFILE:-clerum-test}"
MINIKUBE_MULTI_NODE="${MINIKUBE_MULTI_NODE:-false}"
MINIKUBE_NODES="${MINIKUBE_NODES:-}"
@@ -142,22 +146,37 @@ start_args=(
--driver=docker
)
+PROFILE_ACTION=VALIDATE_ONLY
+if [[ "${VALIDATE_ONLY}" != "true" ]]; then
+ profile_status=""
+ if profile_status="$(minikube -p "${PROFILE}" status 2>/dev/null)" &&
+ minikube_profile_status_is_healthy "${profile_status}"; then
+ PROFILE_ACTION=REUSED
+ else
+ PROFILE_ACTION=STARTED
+ fi
+fi
+
if [[ "${MINIKUBE_NODES}" -gt 1 ]]; then
start_args+=(--nodes="${MINIKUBE_NODES}")
if [[ "${VALIDATE_ONLY}" == "true" ]]; then
log "Validating multi-node minikube profile '${PROFILE}' with ${MINIKUBE_NODES} expected nodes"
+ elif [[ "${PROFILE_ACTION}" == "REUSED" ]]; then
+ log "Reusing healthy multi-node minikube profile '${PROFILE}' with ${MINIKUBE_NODES} expected nodes"
else
log "Starting multi-node minikube profile '${PROFILE}' with ${MINIKUBE_NODES} nodes"
fi
else
if [[ "${VALIDATE_ONLY}" == "true" ]]; then
log "Validating single-node minikube profile '${PROFILE}'"
+ elif [[ "${PROFILE_ACTION}" == "REUSED" ]]; then
+ log "Reusing healthy single-node minikube profile '${PROFILE}'"
else
log "Starting single-node minikube profile '${PROFILE}'"
fi
fi
-if [[ "${VALIDATE_ONLY}" != "true" ]]; then
+if [[ "${PROFILE_ACTION}" == "STARTED" ]]; then
minikube "${start_args[@]}"
fi
@@ -177,3 +196,5 @@ if ! minikube -p "${PROFILE}" status >/dev/null; then
fi
ok "Minikube profile '${PROFILE}' is healthy"
+printf 'MINIKUBE_PROFILE_ACTION=%s\n' "${PROFILE_ACTION}"
+printf 'MINIKUBE_PROFILE_READINESS=HEALTHY\n'
diff --git a/scripts/minikube/sync-auth-key.sh b/scripts/minikube/sync-auth-key.sh
index 5a742287a..ef99e2fee 100755
--- a/scripts/minikube/sync-auth-key.sh
+++ b/scripts/minikube/sync-auth-key.sh
@@ -62,28 +62,50 @@ T2_PROFILE="${T2_PROFILE:-${MINIKUBE_PROFILE:-${PROFILE}}}"
T2_CONTEXT="${T2_CONTEXT:-${CONTROL_API_REAL_PG_CONTEXT:-${PROFILE}}}"
T2_LOCK_ROOT="${T2_LOCK_ROOT:-${HOME}/.cache/evenfire/minikube-t2-locks}"
T2_LOCK_TOKEN="${T2_LOCK_TOKEN:-}"
-# 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 live opaque lease here as well as at the public Make boundary so
-# invoking this helper directly cannot bypass profile ownership.
-source "${ROOT}/scripts/minikube/t2-common.sh"
-[[ -n "${T2_LOCK_TOKEN}" ]] || die "canonical T2 profile lock is required for auth-key convergence"
-T2_LOCK_DIR="${T2_LOCK_ROOT}/${T2_PROFILE}.lock"
-[[ -d "${T2_LOCK_DIR}" && ! -L "${T2_LOCK_DIR}" ]] ||
- die "canonical T2 profile lock is missing for ${T2_PROFILE}"
-owner_token="$(t2_lock_owner_value TOKEN || true)"
-owner_pid="$(t2_lock_owner_value PID || true)"
-[[ "${owner_token}" == "${T2_LOCK_TOKEN}" ]] ||
- die "canonical T2 profile lock token does not match"
-[[ "$(t2_lock_owner_value REPOSITORY || true)" == "${T2_PROJECT_DIR}" ]] ||
- die "canonical T2 profile lock belongs to another worktree"
-[[ "$(t2_lock_owner_value PROFILE || true)" == "${T2_PROFILE}" &&
- "$(t2_lock_owner_value CONTEXT || true)" == "${T2_CONTEXT}" ]] ||
- die "canonical T2 profile lock belongs to another profile or context"
-t2_lock_process_matches "${owner_pid}" ||
- die "canonical T2 profile lock owner is no longer a live process"
-
-KCTL=(kubectl --context="${PROFILE}")
+
+remote_context_allowed() {
+ local allowed_context
+ local -a allowed_contexts=()
+ [ "${GFS_REMOTE_RECONCILE_AUTHORIZED:-false}" = true ] || return 1
+ [ -n "${ALLOWED_CONTEXTS:-}" ] || return 1
+ IFS=',' read -r -a allowed_contexts <<<"${ALLOWED_CONTEXTS}"
+ for allowed_context in "${allowed_contexts[@]}"; do
+ [ "${allowed_context}" = "${PROFILE}" ] && return 0
+ done
+ return 1
+}
+
+# The non-local infra entrypoint has already made the explicit context
+# authorization decision. A failed/empty Minikube status must never turn a
+# local ambiguity into a remote write path.
+REMOTE_RECONCILE=false
+if [ "${GFS_REMOTE_RECONCILE_AUTHORIZED:-false}" = true ]; then
+ remote_context_allowed || die "remote auth-key convergence requires an explicit allowlisted context"
+ REMOTE_RECONCILE=true
+fi
+
+[[ "${PROFILE}" == "${T2_PROFILE}" && "${PROFILE}" == "${T2_CONTEXT}" ]] ||
+ die "auth-key convergence target profile and Kubernetes context do not match"
+
+if [ "${REMOTE_RECONCILE}" != 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
+ # worktree, so an opaque token alone cannot authorize a different target.
+ # shellcheck source=scripts/minikube/t2-common.sh
+ source "${ROOT}/scripts/minikube/t2-common.sh"
+ actual_root="$(git -C "${T2_PROJECT_DIR}" rev-parse --show-toplevel 2>/dev/null || true)"
+ [[ -n "${actual_root}" && "$(cd -- "${actual_root}" && pwd -P)" == "${T2_PROJECT_DIR}" ]] ||
+ die "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}')"
+ [[ -n "${T2_BRANCH}" && -n "${T2_HEAD}" ]] || die "auth-key convergence cannot resolve the current branch and HEAD"
+ t2_lock_validate_inherited
+fi
+
+# Always use the verified effective context, not a stale caller-local alias.
+KCTL=(kubectl --context="${T2_CONTEXT}")
SOURCE_SECRET="rpc-proxy-secrets"
SOURCE_NAMESPACE="rpc-proxy"
CONFIGMAP="mcp-host-config"
@@ -539,7 +561,7 @@ sync_gfs() {
selector="app=gfs-controller,clerum.io/gfsc-role=${role}"
log "Restarting ${GFS_NAMESPACE}/${deployment} after auth key drift"
rollout_restart_with_retry "${GFS_NAMESPACE}" "${deployment}" >/dev/null
- if ! rollout_output="$(PATH="${SCRIPT_DIR}/gfs-rollout-shim:${PATH}" CONTEXT="${PROFILE}" \
+ if ! rollout_output="$(PATH="${SCRIPT_DIR}/gfs-rollout-shim:${PATH}" CONTEXT="${T2_CONTEXT}" \
"${KCTL[@]}" rollout status "deployment/${deployment}" -n "${GFS_NAMESPACE}" --timeout=90s 2>&1)"; then
die "gfsc deployment deployment/${deployment} did not become Ready after auth key drift: ${rollout_output}"
fi
diff --git a/scripts/minikube/t2-common.sh b/scripts/minikube/t2-common.sh
index e48bfc47b..e4a77ac28 100755
--- a/scripts/minikube/t2-common.sh
+++ b/scripts/minikube/t2-common.sh
@@ -7,6 +7,8 @@ set +u
T2_SCRIPT_DIR="$T2_SCRIPT_DIR"
if [ -z "$T2_SCRIPT_DIR" ]; then T2_SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"; fi
+# shellcheck source=profile-readiness.sh
+. "$T2_SCRIPT_DIR/profile-readiness.sh"
T2_PROJECT_DIR="$T2_PROJECT_DIR"
if [ -z "$T2_PROJECT_DIR" ]; then T2_PROJECT_DIR="$(cd -- "$T2_SCRIPT_DIR/../.." && pwd -P)"; fi
T2_PROFILE="$T2_PROFILE"
@@ -47,6 +49,7 @@ T2_PLAN_MODE="$T2_PLAN_MODE"
if [ -z "$T2_PLAN_MODE" ]; then T2_PLAN_MODE=false; fi
T2_BOOTSTRAP_REQUIRED=false
T2_PROFILE_HEALTHY=false
+T2_PROFILE_STATUS=unknown
T2_CONTEXT_IDENTITY_VERIFIED=false
T2_UNREADY_DEPLOYMENTS=""
T2_MARKER_MATCHES_HEAD=false
@@ -317,27 +320,31 @@ PY
}
t2_profile_status() {
- local status_json status_text
- status_json="$(t2_mk status --output=json 2>/dev/null || true)"
- status_text="$(t2_mk status 2>/dev/null || true)"
- if [ -z "$status_json" ] && [ -z "$status_text" ]; then
+ local status_text status_rc=0
+ status_text="$(t2_mk status 2>/dev/null)" || status_rc=$?
+ if [ -z "$status_text" ]; then
+ T2_PROFILE_STATUS=missing
T2_BOOTSTRAP_REQUIRED=true
T2_PROFILE_HEALTHY=false
T2_PLAN_STATE=full-bootstrap
T2_PLAN_REASON='profile is missing or uninitialized'
return 0
fi
- if [[ "$status_text" == *Stopped* || "$status_text" == *Nonexistent* || "$status_text" == *'does not exist'* || "$status_text" == *'not found'* || "$status_json" == *'does not exist'* || "$status_json" == *'not found'* ]]; then
+ if minikube_profile_status_is_missing_or_stopped "$status_text"; then
+ T2_PROFILE_STATUS=stopped
T2_BOOTSTRAP_REQUIRED=true
T2_PROFILE_HEALTHY=false
T2_PLAN_STATE=full-bootstrap
T2_PLAN_REASON='profile is missing or stopped'
return 0
fi
- if [[ "$status_text" != *Running* && "$status_json" != *Running* ]]; then
+ if [ "$status_rc" -ne 0 ] || ! minikube_profile_status_is_healthy "$status_text"; then
+ T2_PROFILE_STATUS=unhealthy
+ T2_PROFILE_HEALTHY=false
T2_NEXT_COMMAND="MINIKUBE_PROFILE=$T2_PROFILE make minikube-start"
t2_fail PROFILE_UNHEALTHY "Minikube profile is not healthy: $T2_PROFILE"
fi
+ T2_PROFILE_STATUS=healthy
T2_PROFILE_HEALTHY=true
}
@@ -951,6 +958,7 @@ t2_evidence_write() {
T2_ORIGIN_DEV="$T2_ORIGIN_DEV" T2_MERGE_BASE="$T2_MERGE_BASE" \
T2_WORKTREE_ID="$T2_WORKTREE_ID" T2_RUN_ID="$T2_RUN_ID" T2_GATE_ID="$T2_GATE_ID" \
T2_PROFILE="$T2_PROFILE" T2_CONTEXT="$T2_CONTEXT" T2_CLUSTER_FINGERPRINT="$T2_CLUSTER_FINGERPRINT" \
+ T2_PROFILE_STATUS="$T2_PROFILE_STATUS" T2_PROFILE_HEALTHY="$T2_PROFILE_HEALTHY" \
T2_EVIDENCE_DIR="$T2_EVIDENCE_DIR" \
T2_IMAGE_MANIFEST="$T2_IMAGE_MANIFEST" T2_IMAGE_SOURCE="$T2_IMAGE_SOURCE" T2_IMAGE_TAG="$T2_IMAGE_TAG" \
python3 - "$file" "$T2_EVIDENCE_FILE" <<'PY'
@@ -994,6 +1002,8 @@ prior.update({
"worktree": os.environ.get("T2_PROJECT_DIR", ""),
"profile": os.environ.get("T2_PROFILE", ""),
"context": os.environ.get("T2_CONTEXT", ""),
+ "profileStatus": os.environ.get("T2_PROFILE_STATUS", ""),
+ "profileHealthy": os.environ.get("T2_PROFILE_HEALTHY", "false"),
"clusterFingerprintRef": os.environ.get("T2_CLUSTER_FINGERPRINT", ""),
"imageManifestRef": os.environ.get("T2_IMAGE_MANIFEST", ""),
"localLogDirectory": os.path.join(os.environ.get("T2_EVIDENCE_DIR", ""), "logs"),
@@ -1103,13 +1113,17 @@ t2_write_plan() {
local plan_file="$1"
[ -n "$plan_file" ] || return 0
local tmp_file="$plan_file.tmp.$$"
- PLAN_STATE="$T2_PLAN_STATE" PLAN_REASON="$T2_PLAN_REASON" python3 - "$tmp_file" <<'PY'
+ PLAN_STATE="$T2_PLAN_STATE" PLAN_REASON="$T2_PLAN_REASON" \
+ PLAN_PROFILE_STATUS="$T2_PROFILE_STATUS" PLAN_PROFILE_HEALTHY="$T2_PROFILE_HEALTHY" \
+ python3 - "$tmp_file" <<'PY'
import json
import os
from pathlib import Path
Path(os.sys.argv[1]).write_text(json.dumps({
"state": os.environ.get("PLAN_STATE", ""),
"reason": os.environ.get("PLAN_REASON", ""),
+ "profileStatus": os.environ.get("PLAN_PROFILE_STATUS", ""),
+ "profileHealthy": os.environ.get("PLAN_PROFILE_HEALTHY", "false"),
}, sort_keys=True) + "\n")
PY
mv -- "$tmp_file" "$plan_file"
diff --git a/scripts/minikube/with-t2-mutation-lock.sh b/scripts/minikube/with-t2-mutation-lock.sh
new file mode 100755
index 000000000..3287d1959
--- /dev/null
+++ b/scripts/minikube/with-t2-mutation-lock.sh
@@ -0,0 +1,70 @@
+#!/usr/bin/env bash
+# Run one mutating Minikube command under the canonical branch-profile lease.
+# A nested T2/full-setup/pre-gate child validates the inherited lease instead
+# of acquiring a second lock for the same profile.
+set -euo pipefail
+
+if [[ "${1:-}" != "--" || "$#" -lt 2 ]]; then
+ printf 'usage: %s -- command [args...]\n' "${0##*/}" >&2
+ exit 2
+fi
+shift
+
+# GNU Make executes recipe lines containing $(MAKE) during `make -n` so the
+# recursive make can print its own plan. Never let that dry-run escape hatch
+# enter a mutating wrapper. Match the actual dry-run flags rather than looking
+# for the letter `n`, because normal recursive builds carry --no-print-directory.
+for make_flag in ${MAKEFLAGS:-}; do
+ case "${make_flag}" in
+ -n|n|--just-print|--dry-run) exit 0 ;;
+ esac
+done
+
+ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd -P)"
+T2_PROJECT_DIR="${T2_PROJECT_DIR:-${ROOT}}"
+T2_PROFILE="${T2_PROFILE:-${MINIKUBE_PROFILE:-}}"
+T2_CONTEXT="${T2_CONTEXT:-${CONTROL_API_REAL_PG_CONTEXT:-${T2_PROFILE}}}"
+MINIKUBE_PROFILE="${MINIKUBE_PROFILE:-${T2_PROFILE}}"
+CONTROL_API_REAL_PG_CONTEXT="${CONTROL_API_REAL_PG_CONTEXT:-${T2_CONTEXT}}"
+T2_SKIP_LOCK="${T2_SKIP_LOCK:-false}"
+T2_GATE_ID="${T2_GATE_ID:-mutation-wrapper}"
+
+if [[ -z "${T2_PROFILE}" || -z "${T2_CONTEXT}" || "${T2_PROFILE}" != "${T2_CONTEXT}" ]]; then
+ printf 'PROFILE_LOCK_REQUIRED: mutation target profile and Kubernetes context must match\n' >&2
+ exit 1
+fi
+
+# shellcheck source=scripts/minikube/t2-common.sh
+source "${ROOT}/scripts/minikube/t2-common.sh"
+t2_require_commands
+t2_repo_metadata
+t2_profile_scope
+t2_profile_status
+if [[ "${T2_BOOTSTRAP_REQUIRED}" == true ]]; then
+ T2_NEXT_COMMAND="bootstrap the branch-owned profile, then retry the mutating target"
+ t2_fail DEVELOPMENT_SCOPE_REQUIRED "branch-owned Minikube profile is not bootstrapped: ${T2_PROFILE}"
+fi
+t2_context_check
+t2_profile_context_identity_check
+t2_mutation_lock
+
+export T2_PROJECT_DIR T2_PROFILE T2_CONTEXT T2_PROFILE_ROOT T2_PROFILE_ENV T2_PORTS_ENV \
+ T2_LOCK_ROOT T2_LOCK_TOKEN MINIKUBE_PROFILE CONTROL_API_REAL_PG_CONTEXT
+export T2_SKIP_LOCK=true T2_MUTATION_LOCK_WRAPPED=true
+
+cleanup_wrapper() {
+ local status=$? cleanup_status=0
+ trap - EXIT INT TERM
+ t2_lock_release "${status}" || cleanup_status=$?
+ if [[ "${status}" -eq 0 && "${cleanup_status}" -ne 0 ]]; then
+ status="${cleanup_status}"
+ fi
+ exit "${status}"
+}
+trap cleanup_wrapper EXIT
+trap 'exit 130' INT
+trap 'exit 143' TERM
+
+run_status=0
+"$@" || run_status=$?
+exit "${run_status}"
diff --git a/scripts/tests/test-gfs-deploy-contract.sh b/scripts/tests/test-gfs-deploy-contract.sh
index fefbe5785..e065837e6 100755
--- a/scripts/tests/test-gfs-deploy-contract.sh
+++ b/scripts/tests/test-gfs-deploy-contract.sh
@@ -43,28 +43,68 @@ runtime_script="$(sed '/^[[:space:]]*#/d' deploy/scripts/provision-gfs-runtime.s
|| fail 'post-overlay runtime path does not wait for exact GFSC rollouts'
[[ "$runtime_script" != *'rollout restart'* && "$runtime_script" != *'rotate-writer'* ]] \
|| fail 'post-overlay runtime path rotates or unconditionally restarts GFS'
+# Use a clean, minimal Git fixture so this contract tests the profile/cluster
+# boundary rather than whichever unrelated files a developer has open in the
+# main worktree. The fake Minikube command fails closed with no status output;
+# it must never be interpreted as authorization for a remote mutation.
+T2_FIXTURE_ROOT="$(mktemp -d)"
+T2_PROFILE_ROOT="${T2_FIXTURE_ROOT}/profiles"
+T2_PROFILE="contract-profile"
+T2_CONTEXT="${T2_PROFILE}"
+T2_PROFILE_DIR="${T2_PROFILE_ROOT}/${T2_PROFILE}"
+T2_PROFILE_ENV="${T2_PROFILE_DIR}/profile.env"
+T2_PORTS_ENV="${T2_PROFILE_DIR}/ports.env"
+T2_BIN="${T2_FIXTURE_ROOT}/bin"
+T2_MUTATION_LOG="${T2_FIXTURE_ROOT}/mutations.log"
+trap 'rm -rf "${T2_FIXTURE_ROOT}"' EXIT
+mkdir -p "${T2_PROFILE_DIR}" "${T2_BIN}"
+git init -q "${T2_FIXTURE_ROOT}/repo"
+git -C "${T2_FIXTURE_ROOT}/repo" config user.email [email protected]
+git -C "${T2_FIXTURE_ROOT}/repo" config user.name contract-fixture
+git -C "${T2_FIXTURE_ROOT}/repo" checkout -q -b feat/contract-lock
+git -C "${T2_FIXTURE_ROOT}/repo" remote add origin https://github.com/evenfire-ai/evenfire.git
+git -C "${T2_FIXTURE_ROOT}/repo" commit --allow-empty -qm fixture
+git -C "${T2_FIXTURE_ROOT}/repo" update-ref refs/remotes/origin/dev HEAD
+T2_HEAD_SHORT="$(git -C "${T2_FIXTURE_ROOT}/repo" rev-parse --short HEAD)"
+printf 'PROFILE=%s\nREPO_DIR=%s\nBRANCH=feat/contract-lock\nSHA_SHORT=%s\nDIRTY=false\n' \
+ "${T2_PROFILE}" "${T2_FIXTURE_ROOT}/repo" "${T2_HEAD_SHORT}" >"${T2_PROFILE_ENV}"
+: >"${T2_PORTS_ENV}"
+printf '#!/usr/bin/env bash\nexit 42\n' >"${T2_BIN}/minikube"
+printf '#!/usr/bin/env bash\nprintf "%%s\\n" "$*" >>"$T2_MUTATION_LOG"\nexit 99\n' >"${T2_BIN}/kubectl"
+chmod +x "${T2_BIN}/minikube" "${T2_BIN}/kubectl"
+
reconcile_context_err="$(mktemp)"
-if CONTEXT=unverified-context bash deploy/scripts/reconcile-gfs-deploy-credentials.sh 2>"$reconcile_context_err"; then
+if CONTEXT="${T2_CONTEXT}" T2_PROJECT_DIR="${T2_FIXTURE_ROOT}/repo" \
+ T2_PROFILE="${T2_PROFILE}" T2_CONTEXT="${T2_CONTEXT}" \
+ T2_PROFILE_ROOT="${T2_PROFILE_ROOT}" T2_PROFILE_ENV="${T2_PROFILE_ENV}" \
+ T2_PORTS_ENV="${T2_PORTS_ENV}" PATH="${T2_BIN}:$PATH" \
+ bash deploy/scripts/reconcile-gfs-deploy-credentials.sh 2>"$reconcile_context_err"; then
rm -f "$reconcile_context_err"
fail 'credential reconciliation accepted an unverified Kubernetes context'
fi
-grep -Fq 'worktree is dirty' "$reconcile_context_err" \
- || fail 'credential reconciliation did not fail closed before an unowned worktree could mutate GFS'
+grep -Fq 'DEVELOPMENT_SCOPE_REQUIRED' "$reconcile_context_err" \
+ || fail 'credential reconciliation did not fail closed when the local profile was not bootstrapped'
+[[ ! -s "$T2_MUTATION_LOG" ]] \
+ || fail 'credential reconciliation mutated Kubernetes after Minikube status failed'
rm -f "$reconcile_context_err"
reconcile_remote_context_err="$(mktemp)"
-if CONTEXT=gke_unapproved GFS_REMOTE_RECONCILE_AUTHORIZED=true ALLOWED_CONTEXTS=gke_approved \
+if CONTEXT="${T2_CONTEXT}" GFS_REMOTE_RECONCILE_AUTHORIZED=true ALLOWED_CONTEXTS=other-context \
+ T2_PROJECT_DIR="${T2_FIXTURE_ROOT}/repo" T2_PROFILE="${T2_PROFILE}" T2_CONTEXT="${T2_CONTEXT}" \
+ T2_PROFILE_ROOT="${T2_PROFILE_ROOT}" T2_PROFILE_ENV="${T2_PROFILE_ENV}" \
+ T2_PORTS_ENV="${T2_PORTS_ENV}" PATH="${T2_BIN}:$PATH" \
bash deploy/scripts/reconcile-gfs-deploy-credentials.sh 2>"$reconcile_remote_context_err"; then
rm -f "$reconcile_remote_context_err"
fail 'credential reconciliation accepted a GKE context outside the explicit allowlist'
fi
-grep -Fq 'worktree is dirty' "$reconcile_remote_context_err" \
+grep -Fq 'remote context is not explicitly allowlisted' "$reconcile_remote_context_err" \
|| fail 'credential reconciliation did not fail closed before a protected context could mutate GFS'
+[[ ! -s "$T2_MUTATION_LOG" ]] \
+ || fail 'credential reconciliation mutated Kubernetes after remote allowlist validation failed'
rm -f "$reconcile_remote_context_err"
grep -Fq 't2_mutation_lock' deploy/scripts/reconcile-gfs-deploy-credentials.sh \
|| fail 'GFS reconciliation does not require the canonical profile mutation lock'
-if grep -Fq 'GFS_REMOTE_RECONCILE_AUTHORIZED=true' deploy/scripts/reconcile-gfs-deploy-credentials.sh; then
- fail 'GFS reconciliation still trusts caller-provided remote authorization'
-fi
+! grep -Fq 'minikube_profile_exists' deploy/scripts/reconcile-gfs-deploy-credentials.sh \
+ || fail 'GFS reconciliation still infers remote ownership from Minikube status'
make_block() {
awk -v target="$1" '$0 ~ "^" target ":" {active=1} active && /^\.PHONY:/ {exit} active {print}' Makefile
}
diff --git a/scripts/tests/test-minikube-makefile.sh b/scripts/tests/test-minikube-makefile.sh
index bfe2842d3..40e879d0c 100755
--- a/scripts/tests/test-minikube-makefile.sh
+++ b/scripts/tests/test-minikube-makefile.sh
@@ -51,14 +51,17 @@ assert_make_contains() {
assert_succeeds_dry minikube-start
assert_succeeds_dry minikube-deploy-all
+assert_succeeds_dry minikube-deploy-all-body
assert_succeeds_dry minikube-sync-auth-key-if-present
assert_succeeds_dry minikube-verify-networkpolicies
assert_contains minikube-start "minikube-sync-auth-key-if-present"
assert_contains minikube-start "--context=clerum-test"
-assert_contains minikube-deploy-all "minikube-sync-auth-key"
-assert_contains minikube-sync-auth-key "--context=clerum-test"
-assert_contains minikube-sync-auth-key "scripts/minikube/sync-auth-key.sh"
+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"
+assert_contains minikube-sync-auth-key-body "--context=clerum-test"
+assert_contains minikube-sync-auth-key-body "scripts/minikube/sync-auth-key.sh"
assert_contains minikube-verify-networkpolicies "verify-networkpolicies.sh --overlay minikube"
assert_contains minikube-sync-auth-key-if-present "rpc-proxy-secrets"
diff --git a/scripts/tests/test-minikube-mutation-boundary.sh b/scripts/tests/test-minikube-mutation-boundary.sh
new file mode 100755
index 000000000..5353efc36
--- /dev/null
+++ b/scripts/tests/test-minikube-mutation-boundary.sh
@@ -0,0 +1,67 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+ROOT="$(cd "$(dirname "$0")/../.." && pwd -P)"
+TMP_DIR="$(mktemp -d)"
+trap 'rm -rf "${TMP_DIR}"' EXIT
+
+PROFILE=boundary-profile
+TOKEN=boundary-test-token
+LOCK_ROOT="${TMP_DIR}/locks"
+LOCK_DIR="${LOCK_ROOT}/${PROFILE}.lock"
+LOG="${TMP_DIR}/mutations.log"
+mkdir -p "${LOCK_DIR}"
+
+BRANCH="$(git -C "${ROOT}" branch --show-current)"
+HEAD="$(git -C "${ROOT}" rev-parse --verify HEAD)"
+WORKTREE_ID="$(printf '%s' "${ROOT}" | shasum | awk '{print $1}')"
+LOCK_KEY="$(printf '%s\0%s\0%s\0%s\0%s' "${ROOT}" "${BRANCH}" "${HEAD}" "${PROFILE}" "${PROFILE}" | shasum | awk '{print $1}')"
+cat >"${LOCK_DIR}/owner.env" <<EOF
+REPOSITORY=${ROOT}
+BRANCH=${BRANCH}
+HEAD=${HEAD}
+PROFILE=${PROFILE}
+CONTEXT=${PROFILE}
+WORKTREE_ID=${WORKTREE_ID}
+LOCK_KEY=${LOCK_KEY}
+TOKEN=${TOKEN}
+PID=$$
+PROCESS_START=unavailable
+EOF
+
+run_child() {
+ T2_PROJECT_DIR="${ROOT}" T2_PROFILE="${PROFILE}" T2_CONTEXT="${PROFILE}" \
+ T2_LOCK_ROOT="${LOCK_ROOT}" T2_LOCK_TOKEN="${TOKEN}" \
+ bash "${ROOT}/scripts/minikube/require-t2-mutation-lock.sh" &&
+ printf 'mutation\n' >>"${LOG}"
+}
+
+run_child
+[[ "$(wc -l <"${LOG}" | tr -d ' ')" -eq 1 ]] || {
+ echo 'FAIL: valid inherited lease did not reach the child boundary' >&2
+ exit 1
+}
+
+if T2_PROJECT_DIR="${ROOT}" T2_PROFILE="${PROFILE}" T2_CONTEXT="${PROFILE}" \
+ T2_LOCK_ROOT="${LOCK_ROOT}" T2_LOCK_TOKEN=wrong-token \
+ bash "${ROOT}/scripts/minikube/require-t2-mutation-lock.sh" >/dev/null 2>&1; then
+ echo 'FAIL: random token was accepted by the child mutation boundary' >&2
+ exit 1
+fi
+[[ "$(wc -l <"${LOG}" | tr -d ' ')" -eq 1 ]] || {
+ echo 'FAIL: invalid lease token reached a mutating child' >&2
+ exit 1
+}
+
+if T2_PROJECT_DIR="${ROOT}" T2_PROFILE="${PROFILE}" T2_CONTEXT=wrong-context \
+ T2_LOCK_ROOT="${LOCK_ROOT}" T2_LOCK_TOKEN="${TOKEN}" \
+ bash "${ROOT}/scripts/minikube/require-t2-mutation-lock.sh" >/dev/null 2>&1; then
+ echo 'FAIL: profile/context mismatch was accepted by the child mutation boundary' >&2
+ exit 1
+fi
+[[ "$(wc -l <"${LOG}" | tr -d ' ')" -eq 1 ]] || {
+ echo 'FAIL: mismatched effective context reached a mutating child' >&2
+ exit 1
+}
+
+printf 'PASS: child mutation boundary requires the exact live profile lease and target context\n'
diff --git a/scripts/tests/test-minikube-pre-gate-shadow.sh b/scripts/tests/test-minikube-pre-gate-shadow.sh
index e93568dfb..c662fe945 100755
--- a/scripts/tests/test-minikube-pre-gate-shadow.sh
+++ b/scripts/tests/test-minikube-pre-gate-shadow.sh
@@ -770,7 +770,10 @@ assert_a_re_acquisition_forces_a_full_resync() {
# were never built there -- cluster-wide ImagePullBackOff.
assert_make_deploy_all_renders_the_mode_aware_overlay() {
local out
- out="$(cd "$REPO_ROOT" && make -n minikube-deploy-all 2>&1)"
+ # The public target now wraps its private body with the branch-profile lease;
+ # inspect that body for the overlay resolver while the wrapper contract is
+ # covered by test-minikube-makefile.sh.
+ out="$(cd "$REPO_ROOT" && make -n minikube-deploy-all-body 2>&1)"
if grep -q 'image-mode.sh --render-dir' <<< "$out" \
&& ! grep -q 'kustomize deploy/overlays/minikube |' <<< "$out"; then
pass "make minikube-deploy-all resolves the overlay from the cluster's image mode"
diff --git a/scripts/tests/test-minikube-profile-readiness.sh b/scripts/tests/test-minikube-profile-readiness.sh
new file mode 100644
index 000000000..0b3d861a8
--- /dev/null
+++ b/scripts/tests/test-minikube-profile-readiness.sh
@@ -0,0 +1,121 @@
+#!/usr/bin/env bash
+# Regression coverage for strict profile readiness and startup reuse.
+
+set -euo pipefail
+set +x
+
+ROOT="$(cd -- "$(dirname -- "$0")/../.." && pwd -P)"
+READINESS="$ROOT/scripts/minikube/profile-readiness.sh"
+START="$ROOT/scripts/minikube/start.sh"
+TMP_ROOT="$(printenv TMPDIR || printf '/tmp')"
+tmp="$(mktemp -d "$TMP_ROOT/evenfire-profile-readiness.XXXXXX")"
+cleanup() { rm -rf "$tmp"; }
+trap cleanup EXIT
+
+fail() {
+ printf 'FAIL: %s\n' "$*" >&2
+ exit 1
+}
+
+healthy_text=$'host: Running\nkubelet: Running\napiserver: Running\nkubeconfig: Configured'
+healthy_json='{"Name":"profile","Host":"Running","Kubelet":"Running","APIServer":"Running","Kubeconfig":"Configured"}'
+partial_text=$'host: Running\nkubelet: Stopped\napiserver: Running\nkubeconfig: Configured'
+stopped_text=$'host: Stopped\nkubelet: Stopped\napiserver: Stopped\nkubeconfig: Configured'
+
+# The same predicate must accept the native text and JSON shapes, while a
+# single stopped component must never qualify for profile reuse.
+source "$READINESS"
+minikube_profile_status_is_healthy "$healthy_text" || fail 'healthy text status was rejected'
+minikube_profile_status_is_healthy "$healthy_json" || fail 'healthy JSON status was rejected'
+if minikube_profile_status_is_healthy "$partial_text"; then
+ fail 'partial profile status was accepted as healthy'
+fi
+minikube_profile_status_is_missing_or_stopped "$stopped_text" || fail 'stopped profile was not classified as stopped'
+
+fake_bin="$tmp/bin"
+mkdir -p "$fake_bin"
+cat >"$fake_bin/minikube" <<'EOF'
+#!/usr/bin/env bash
+set -euo pipefail
+
+printf 'minikube %s\n' "$*" >>"$MINIKUBE_CALLS"
+
+if [ "$#" -gt 0 ] && [ "$1" = "-p" ]; then
+ shift 2
+fi
+command_name="$1"
+case "$command_name" in
+ status)
+ if [ -f "$MINIKUBE_STARTED" ] || [ "$TEST_PROFILE_STATE" = healthy ]; then
+ printf '%s\n' 'host: Running' 'kubelet: Running' 'apiserver: Running' 'kubeconfig: Configured'
+ exit 0
+ fi
+ if [ "$TEST_PROFILE_STATE" = partial ]; then
+ printf '%s\n' 'host: Running' 'kubelet: Stopped' 'apiserver: Running' 'kubeconfig: Configured'
+ else
+ printf '%s\n' 'host: Stopped' 'kubelet: Stopped' 'apiserver: Stopped' 'kubeconfig: Configured'
+ fi
+ exit 2
+ ;;
+ start)
+ : >"$MINIKUBE_STARTED"
+ ;;
+ addons)
+ ;;
+ *)
+ ;;
+esac
+EOF
+cat >"$fake_bin/kubectl" <<'EOF'
+#!/usr/bin/env bash
+set -euo pipefail
+
+printf 'kubectl %s\n' "$*" >>"$KUBECTL_CALLS"
+case "$*" in
+ *'get nodes --no-headers'*) printf '%s\n' 'minikube Ready' ;;
+ *'get pods -l k8s-app=calico-node --no-headers'*) printf '%s\n' 'calico-node 1/1 Running' ;;
+ *) ;;
+esac
+EOF
+chmod +x "$fake_bin/minikube" "$fake_bin/kubectl"
+
+run_start() {
+ state="$1"
+ output_file="$2"
+ calls_file="$3"
+ started_file="$4"
+ : >"$calls_file"
+ : >"$KUBECTL_CALLS"
+ rm -f "$started_file"
+ TEST_PROFILE_STATE="$state" \
+ MINIKUBE_PROFILE=evenfire-readiness-test \
+ MINIKUBE_CALLS="$calls_file" \
+ MINIKUBE_STARTED="$started_file" \
+ KUBECTL_CALLS="$KUBECTL_CALLS" \
+ PATH="$fake_bin:$PATH" \
+ bash "$START" >"$output_file"
+}
+
+healthy_output="$tmp/healthy.out"
+healthy_calls="$tmp/healthy.minikube.calls"
+healthy_started="$tmp/healthy.started"
+KUBECTL_CALLS="$tmp/healthy.kubectl.calls"
+run_start healthy "$healthy_output" "$healthy_calls" "$healthy_started"
+grep -Fq 'MINIKUBE_PROFILE_ACTION=REUSED' "$healthy_output" || fail 'healthy profile was not reported as reused'
+if grep -Eq '^minikube start ' "$healthy_calls"; then
+ fail 'healthy profile still invoked minikube start'
+fi
+
+partial_output="$tmp/partial.out"
+partial_calls="$tmp/partial.minikube.calls"
+partial_started="$tmp/partial.started"
+KUBECTL_CALLS="$tmp/partial.kubectl.calls"
+run_start partial "$partial_output" "$partial_calls" "$partial_started"
+grep -Fq 'MINIKUBE_PROFILE_ACTION=STARTED' "$partial_output" || fail 'partial profile was not repaired through startup'
+grep -Eq '^minikube start ' "$partial_calls" || fail 'partial profile did not invoke minikube start'
+
+healthy_start_calls="$(grep -cE '^minikube start ' "$healthy_calls" || true)"
+partial_start_calls="$(grep -cE '^minikube start ' "$partial_calls" || true)"
+printf 'METRIC evenfire_minikube_healthy_start_calls=%s\n' "$healthy_start_calls"
+printf 'METRIC evenfire_minikube_partial_start_calls=%s\n' "$partial_start_calls"
+printf 'PASS: strict profile readiness and healthy-profile startup reuse\n'
diff --git a/scripts/tests/test-minikube-sync-auth-key-durable.sh b/scripts/tests/test-minikube-sync-auth-key-durable.sh
index 3c8ebdb6f..f7e61cdef 100755
--- a/scripts/tests/test-minikube-sync-auth-key-durable.sh
+++ b/scripts/tests/test-minikube-sync-auth-key-durable.sh
@@ -19,11 +19,19 @@ T2_LOCK_ROOT="${TMP_DIR}/locks"
T2_LOCK_TOKEN='auth-sync-test-token'
T2_LOCK_DIR="${T2_LOCK_ROOT}/fake.lock"
T2_PROCESS_START=unavailable
+T2_TEST_BRANCH="$(git -C "${ROOT}" branch --show-current)"
+T2_TEST_HEAD="$(git -C "${ROOT}" rev-parse --verify HEAD)"
+T2_TEST_WORKTREE_ID="$(printf '%s' "${ROOT}" | shasum | awk '{print $1}')"
+T2_TEST_LOCK_KEY="$(printf '%s\0%s\0%s\0%s\0%s' "${ROOT}" "${T2_TEST_BRANCH}" "${T2_TEST_HEAD}" fake fake | shasum | awk '{print $1}')"
mkdir -p "${T2_LOCK_DIR}"
cat >"${T2_LOCK_DIR}/owner.env" <<EOF
REPOSITORY=${ROOT}
+BRANCH=${T2_TEST_BRANCH}
+HEAD=${T2_TEST_HEAD}
PROFILE=fake
CONTEXT=fake
+WORKTREE_ID=${T2_TEST_WORKTREE_ID}
+LOCK_KEY=${T2_TEST_LOCK_KEY}
TOKEN=${T2_LOCK_TOKEN}
PID=$$
PROCESS_START=${T2_PROCESS_START}
diff --git a/scripts/tests/test-minikube-sync-auth-key.sh b/scripts/tests/test-minikube-sync-auth-key.sh
index 5c02f7175..643bdd1ff 100755
--- a/scripts/tests/test-minikube-sync-auth-key.sh
+++ b/scripts/tests/test-minikube-sync-auth-key.sh
@@ -17,11 +17,19 @@ T2_LOCK_ROOT="${TMP_DIR}/locks"
T2_LOCK_TOKEN='auth-sync-test-token'
T2_LOCK_DIR="${T2_LOCK_ROOT}/fake.lock"
T2_PROCESS_START=unavailable
+T2_TEST_BRANCH="$(git -C "${ROOT}" branch --show-current)"
+T2_TEST_HEAD="$(git -C "${ROOT}" rev-parse --verify HEAD)"
+T2_TEST_WORKTREE_ID="$(printf '%s' "${ROOT}" | shasum | awk '{print $1}')"
+T2_TEST_LOCK_KEY="$(printf '%s\0%s\0%s\0%s\0%s' "${ROOT}" "${T2_TEST_BRANCH}" "${T2_TEST_HEAD}" fake fake | shasum | awk '{print $1}')"
mkdir -p "${T2_LOCK_DIR}"
cat >"${T2_LOCK_DIR}/owner.env" <<EOF
REPOSITORY=${ROOT}
+BRANCH=${T2_TEST_BRANCH}
+HEAD=${T2_TEST_HEAD}
PROFILE=fake
CONTEXT=fake
+WORKTREE_ID=${T2_TEST_WORKTREE_ID}
+LOCK_KEY=${T2_TEST_LOCK_KEY}
TOKEN=${T2_LOCK_TOKEN}
PID=$$
PROCESS_START=${T2_PROCESS_START}
diff --git a/scripts/tests/test-minikube-t2-contract.sh b/scripts/tests/test-minikube-t2-contract.sh
index a96e25360..764808d07 100755
--- a/scripts/tests/test-minikube-t2-contract.sh
+++ b/scripts/tests/test-minikube-t2-contract.sh
@@ -16,7 +16,7 @@ TMP_ROOT="$TMPDIR"
if [ -z "$TMP_ROOT" ]; then TMP_ROOT=/tmp; fi
set -u
-for file in "$COMMON" "$PREFLIGHT" "$T2" "$T1" "$T0" \
+for file in "$MINIKUBE_DIR/profile-readiness.sh" "$ROOT/scripts/tests/test-minikube-profile-readiness.sh" "$COMMON" "$PREFLIGHT" "$T2" "$T1" "$T0" \
"$ROOT/scripts/e2e/e2e-np08-hcc-authorization.sh" \
"$ROOT/scripts/minikube/settle-gfs-reader-rollout.sh" \
"$ROOT/scripts/minikube/wait-gfs-reader-ready.sh" \
@@ -30,6 +30,7 @@ for file in "$COMMON" "$PREFLIGHT" "$T2" "$T1" "$T0" \
"$ROOT/scripts/tests/test-minikube-pre-gate-restore.sh" \
"$ROOT/scripts/tests/test-minikube-sync-auth-key.sh" \
"$ROOT/scripts/tests/test-minikube-sync-auth-key-durable.sh" \
+ "$ROOT/scripts/tests/test-minikube-mutation-boundary.sh" \
"$ROOT/scripts/tests/test-minikube-targeted-gfs-sync.sh" \
"$ROOT/scripts/tests/test-minikube-t2-lock-race.sh" \
"$ROOT/scripts/tests/test-minikube-t1-gfs-restore.sh"; do
@@ -550,6 +551,7 @@ if T2_PUBLIC_ROOT="$public_repo" T2_PUBLIC_BASE_REF="$public_base" \
exit 1
fi
bash "$ROOT/scripts/tests/test-minikube-t2-scenarios.sh"
+bash "$ROOT/scripts/tests/test-minikube-profile-readiness.sh"
bash "$ROOT/scripts/tests/test-minikube-settle-gfs-reader-rollout.sh"
bash "$ROOT/scripts/tests/test-minikube-gfs-rollout-shim.sh"
bash "$ROOT/scripts/tests/test-minikube-gfs-provision-order.sh"
@@ -557,6 +559,7 @@ bash "$ROOT/scripts/tests/test-minikube-pre-gate-sync-state.sh"
bash "$ROOT/scripts/tests/test-minikube-pre-gate-restore.sh"
bash "$ROOT/scripts/tests/test-minikube-sync-auth-key.sh"
bash "$ROOT/scripts/tests/test-minikube-sync-auth-key-durable.sh"
+bash "$ROOT/scripts/tests/test-minikube-mutation-boundary.sh"
bash "$ROOT/scripts/tests/test-minikube-targeted-gfs-sync.sh"
bash "$ROOT/scripts/tests/test-minikube-t2-lock-race.sh"
bash "$ROOT/scripts/tests/test-minikube-t1-gfs-restore.sh"
diff --git a/scripts/tests/test-minikube-t2-scenarios.sh b/scripts/tests/test-minikube-t2-scenarios.sh
index a75dc5be5..2d3d7e32d 100755
--- a/scripts/tests/test-minikube-t2-scenarios.sh
+++ b/scripts/tests/test-minikube-t2-scenarios.sh
@@ -138,6 +138,15 @@ expect_code DEVELOPMENT_SCOPE_REQUIRED wrong-profile-identity wrong-profile-iden
missing_profile_state="$(env "${repo_env[@]}" bash -c 'source "$1"; t2_mk(){ printf "%s" "Profile not found"; }; t2_profile_status; printf "%s" "$T2_PLAN_STATE"' bash "$COMMON")"
[ "$missing_profile_state" = full-bootstrap ] || fail "missing profile selected $missing_profile_state instead of full-bootstrap"
+healthy_profile_state="$(env T2_PROJECT_DIR="$repo" MINIKUBE_PROFILE="$profile" T2_CONTEXT="$profile" CONTROL_API_REAL_PG_CONTEXT="$profile" T2_PROFILE_ROOT="$tmp/profiles" T2_PROFILE_ENV="$profile_root/profile.env" T2_PORTS_ENV="$profile_root/ports.env" T2_REQUIRED_DEPLOYMENTS=gfs/gfsc-reader T2_BRANCH=feat/scenario T2_HEAD="$feature_sha" T2_LOCK_ROOT="$tmp/locks" T2_EVIDENCE_ROOT="$tmp/evidence" bash -c 'source "$1"; t2_mk(){ printf "%s" "host: Running\nkubelet: Running\napiserver: Running"; }; t2_profile_status; printf "%s:%s" "$T2_PROFILE_STATUS" "$T2_PROFILE_HEALTHY"' bash "$COMMON")"
+[ "$healthy_profile_state" = healthy:true ] || fail "healthy profile selected $healthy_profile_state instead of healthy:true"
+
+partial_profile_state="$(env T2_PROJECT_DIR="$repo" MINIKUBE_PROFILE="$profile" T2_CONTEXT="$profile" CONTROL_API_REAL_PG_CONTEXT="$profile" T2_PROFILE_ROOT="$tmp/profiles" T2_PROFILE_ENV="$profile_root/profile.env" T2_PORTS_ENV="$profile_root/ports.env" T2_REQUIRED_DEPLOYMENTS=gfs/gfsc-reader T2_BRANCH=feat/scenario T2_HEAD="$feature_sha" T2_LOCK_ROOT="$tmp/locks" T2_EVIDENCE_ROOT="$tmp/evidence" bash -c 'source "$1"; t2_mk(){ printf "%s" "host: Running\nkubelet: Stopped\napiserver: Running"; return 1; }; t2_profile_status; printf "%s:%s:%s" "$T2_PLAN_STATE" "$T2_PROFILE_STATUS" "$T2_PROFILE_HEALTHY"' bash "$COMMON")"
+[ "$partial_profile_state" = full-bootstrap:stopped:false ] || fail "partial stopped profile selected $partial_profile_state instead of full-bootstrap:stopped:false"
+
+expect_code PROFILE_UNHEALTHY incomplete-profile-status incomplete-profile-status \
+ env T2_PROJECT_DIR="$repo" MINIKUBE_PROFILE="$profile" T2_CONTEXT="$profile" CONTROL_API_REAL_PG_CONTEXT="$profile" T2_PROFILE_ROOT="$tmp/profiles" T2_PROFILE_ENV="$profile_root/profile.env" T2_PORTS_ENV="$profile_root/ports.env" T2_REQUIRED_DEPLOYMENTS=gfs/gfsc-reader T2_BRANCH=feat/scenario T2_HEAD="$feature_sha" T2_LOCK_ROOT="$tmp/locks" T2_EVIDENCE_ROOT="$tmp/evidence" bash -c 'source "$1"; t2_mk(){ printf "%s" "host: Running\nkubelet: Unknown\napiserver: Running"; return 1; }; t2_profile_status' bash "$COMMON"
+
ownership_env=("${repo_env[@]}" T2_PROFILE_ENV="$tmp/ownership.env")
printf 'PROFILE=%s\nBRANCH=feat/scenario\nSHA_SHORT=%s\nDIRTY=false\nREPO_DIR=%s\n' \
"$profile" "$(git -C "$repo" rev-parse --short=8 HEAD)" "$tmp/other" >"$tmp/ownership.env"