Skip to content

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

TypeScript

fix: restore NOLOGIN GFS reader during T2 full-setup

Alfredo Lopez55bd5bcbdd66
diff --git a/.cursor/rules/minikube-t2-harness.mdc b/.cursor/rules/minikube-t2-harness.mdc
index 1b2bba18a..b2ae6968c 100644
--- a/.cursor/rules/minikube-t2-harness.mdc
+++ b/.cursor/rules/minikube-t2-harness.mdc
@@ -37,6 +37,9 @@ Invariants that must never regress:
`GFS_RESTORE_ACTIVE_NOLOGIN=true` (armed only once suites started), and
`pre-gate-sync.sh` `provision_gfs_serving` passes the same opt-in and runs
in every sync plan, restarting an unready `gfsc-reader` after restore.
+ `full-setup.sh` REUSE_DB / T2 full-reconcile also passes the opt-in on both
+ GFS reconcile calls — setup runs before pre-gate-sync and must not abort
+ on a NOLOGIN reader left by T1.
- T1 stays fail-loud (no green on unavailable DSN or zero tests); the JSON
reporter is the suite verdict, not a leftover Vitest process exit after a
complete green reporter. Role-reset suites keep the throwaway Postgres 16.
diff --git a/.cursor/skills/minikube-t0-t1-t2/SKILL.md b/.cursor/skills/minikube-t0-t1-t2/SKILL.md
index d541a0fb0..55aa65530 100644
--- a/.cursor/skills/minikube-t0-t1-t2/SKILL.md
+++ b/.cursor/skills/minikube-t0-t1-t2/SKILL.md
@@ -91,7 +91,9 @@ T1 runs inside `make minikube-t2`, or explicitly via
- T1 restores branch-profile GFS credentials on exit (canonical
`reconcile-gfs-deploy-credentials.sh` with `GFS_RESTORE_ACTIVE_NOLOGIN=true`,
same as the GFS T1 gate), so a T1 run cannot leave `gfsc-reader` NOLOGIN
- and poison the T2 preflight. Do not run that restore by hand.
+ and poison the T2 preflight. Do not run that restore by hand. T2
+ full-reconcile reaches `full-setup.sh` before pre-gate-sync; that REUSE_DB
+ path must pass the same opt-in on both GFS reconcile calls.
## Step 4 — Verdict and evidence reporting
diff --git a/docs/testing/minikube-t2-runbook.md b/docs/testing/minikube-t2-runbook.md
index cca6adeba..569f57790 100644
--- a/docs/testing/minikube-t2-runbook.md
+++ b/docs/testing/minikube-t2-runbook.md
@@ -140,7 +140,10 @@ or interrupt) using the canonical
`GFS_RESTORE_ACTIVE_NOLOGIN=true` — the same contract as the standalone GFS
T1 gate. `pre-gate-sync` provisions GFS serving with the same opt-in in every
sync plan (including "no cluster sync required") and restarts an unready
-`gfsc-reader` after a successful restore. The recovery helper restores a
+`gfsc-reader` after a successful restore. `full-setup.sh` on the REUSE_DB /
+T2 full-reconcile path passes the same opt-in on both GFS reconcile calls,
+because setup runs before pre-gate-sync and must not abort on a NOLOGIN
+reader. The recovery helper restores a
NOLOGIN role only from the committed Secret DSN and still fails loud when
that credential cannot authenticate; no password is ever invented and no DSN
is printed.
diff --git a/scripts/minikube/full-setup.sh b/scripts/minikube/full-setup.sh
index 1824c8bd1..ace16883d 100755
--- a/scripts/minikube/full-setup.sh
+++ b/scripts/minikube/full-setup.sh
@@ -978,7 +978,11 @@ else
exit 1
fi
log "Existing GFS writer detected — reconciling credentials before overlay upgrade"
- CONTEXT="${PROFILE}" bash "${PROJECT_DIR}/deploy/scripts/reconcile-gfs-deploy-credentials.sh"
+ # REUSE_DB / T2 full-reconcile reaches this before pre-gate-sync. A prior T1
+ # can leave gfs_controller_reader NOLOGIN; restore from the committed
+ # Secret DSN (same opt-in as the GFS T1 gate). Still fail-loud on auth.
+ GFS_RESTORE_ACTIVE_NOLOGIN=true CONTEXT="${PROFILE}" \
+ bash "${PROJECT_DIR}/deploy/scripts/reconcile-gfs-deploy-credentials.sh"
else
log "Fresh bootstrap detected — reader staging deferred until migrations; GFSC remains fail-closed"
fi
@@ -1040,7 +1044,8 @@ else
# the split writer/reader templates; reconciling before that lands leaves
# the staged reader credential rollout-pending and fails the final verify.
CONTEXT="${PROFILE}" bash "${PROJECT_DIR}/deploy/scripts/wait-gfsc-secret-references.sh"
- CONTEXT="${PROFILE}" bash "${PROJECT_DIR}/deploy/scripts/reconcile-gfs-deploy-credentials.sh"
+ GFS_RESTORE_ACTIVE_NOLOGIN=true CONTEXT="${PROFILE}" \
+ bash "${PROJECT_DIR}/deploy/scripts/reconcile-gfs-deploy-credentials.sh"
ok "GFS credentials reconciled and writer bootstrap verified"
fi
diff --git a/scripts/tests/test-minikube-full-setup.sh b/scripts/tests/test-minikube-full-setup.sh
index 55dc27d5d..2e8c0e30e 100755
--- a/scripts/tests/test-minikube-full-setup.sh
+++ b/scripts/tests/test-minikube-full-setup.sh
@@ -282,7 +282,7 @@ assert_gfs_provisioning_follows_migrations_and_core_readiness() {
grep -q 'scale deployment/gfsc-reader --replicas="\$RESET_READER_REPLICAS"' <<<"$reset_block" && \
grep -q 'scale deployment/host-context-controller --replicas="\$RESET_HCC_REPLICAS"' <<<"$reset_block" && \
! grep -q 'delete pvc control-postgres-data' scripts/minikube/full-setup.sh && \
- ! grep -q 'GFS_RESTORE_ACTIVE_NOLOGIN=true' scripts/minikube/full-setup.sh && \
+ [[ "$(grep -c 'GFS_RESTORE_ACTIVE_NOLOGIN=true CONTEXT="${PROFILE}"' scripts/minikube/full-setup.sh)" -ge 2 ]] && \
[[ "$core_block" != *"gfs-controller"* ]]; then
pass "full-setup centralizes explicit UID-bound reset and never auto-deletes on WAL logs"
else
diff --git a/scripts/tests/test-minikube-t2-contract.sh b/scripts/tests/test-minikube-t2-contract.sh
index c918f077a..9a154d499 100755
--- a/scripts/tests/test-minikube-t2-contract.sh
+++ b/scripts/tests/test-minikube-t2-contract.sh
@@ -102,6 +102,10 @@ if ! sed -n '/No cluster sync required before/,$p' "$PRE_GATE" | grep -Fq 'provi
exit 1
fi
grep -Fq 'converge_gfs_reader_after_restore' "$PRE_GATE"
+if [[ "$(grep -c 'GFS_RESTORE_ACTIVE_NOLOGIN=true CONTEXT="${PROFILE}"' "$ROOT/scripts/minikube/full-setup.sh")" -lt 2 ]]; then
+ echo 'FAIL: full-setup REUSE_DB path must restore a NOLOGIN GFS role before and after overlay' >&2
+ exit 1
+fi
if grep -Eq 'make minikube-pre-gate-sync|pre-gate-sync\.sh' "$PREFLIGHT"; then
echo 'FAIL: preflight invokes pre-gate-sync' >&2
diff --git a/scripts/tests/test-minikube-t2-scenarios.sh b/scripts/tests/test-minikube-t2-scenarios.sh
index bf694c9ce..7f4b07b4a 100755
--- a/scripts/tests/test-minikube-t2-scenarios.sh
+++ b/scripts/tests/test-minikube-t2-scenarios.sh
@@ -276,6 +276,7 @@ grep -Fq 'Real PostgreSQL suite failed in $package ($lane)' "$ROOT/scripts/e2e/m
grep -Fq 'restore_gfs_runtime_credentials' "$ROOT/scripts/e2e/minikube-real-postgres.sh" || fail 'T1 must restore branch-profile GFS credentials on exit'
grep -Fq 'GFS_RESTORE_ACTIVE_NOLOGIN=true' "$ROOT/scripts/e2e/minikube-real-postgres.sh" || fail 'T1 GFS restore must opt into the NOLOGIN recovery contract'
grep -Fq 'GFS_RESTORE_ACTIVE_NOLOGIN=true' "$ROOT/scripts/minikube/pre-gate-sync.sh" || fail 'pre-gate-sync must restore a NOLOGIN GFS role from the committed Secret DSN'
+[[ "$(grep -c 'GFS_RESTORE_ACTIVE_NOLOGIN=true CONTEXT="${PROFILE}"' "$ROOT/scripts/minikube/full-setup.sh")" -ge 2 ]] || fail 'full-setup REUSE_DB must restore a NOLOGIN GFS role on both reconcile calls'
grep -Fq 'T2_LOCK_ROOT' "$COMMON"
grep -Fq 'trap t2_lock_release EXIT INT TERM' "$COMMON"
grep -Fq 'PORT_FORWARD_CONFLICT' "$COMMON"