Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(gfs): re-scope deploy contract to OSS-resident invariants after repo split
Alfredo Lopez2889d47ed50e
diff --git a/scripts/tests/test-gfs-deploy-contract.sh b/scripts/tests/test-gfs-deploy-contract.shindex 3362d00e7..7a36317bb 100755--- a/scripts/tests/test-gfs-deploy-contract.sh+++ b/scripts/tests/test-gfs-deploy-contract.sh@@ -2,6 +2,10 @@set -euo pipefailROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"; cd "$ROOT"fail() { echo "FAIL: $*" >&2; exit 1; }+# Scope: OSS-resident GFS deploy invariants only. The GCP deploy invariants+# (deploy-dev/deploy-prod workflow ordering, gcp-* Makefile targets, gcp-prod+# overlay render, and the HCC rollback contract) live in evenfire-infra after+# the app/config repo split and are validated by its sibling contract there.for mode in stage-writer stage-reader rotate-reader rotate-writer; dogrep -q "$mode" deploy/scripts/provision-gfs-db.sh || fail "missing $mode"done@@ -18,16 +22,6 @@ provision_contract="$(sed -n '/verify_role_contract()/,/^}/p' deploy/scripts/pro[[ "$provision_contract" == *"has_column_privilege(:'role_name', 'control_admin_users', 'id', 'SELECT')"* && "$provision_contract" == *"has_column_privilege(:'role_name', 'team_members', 'status', 'SELECT')"* && "$provision_contract" == *"column_name NOT IN ('id', 'status')"* && "$provision_contract" == *"column_name NOT IN ('team_id', 'user_id', 'status')"* ]] || fail 'provisioner does not verify the exact subject-column contract'writer_case="$(sed -n '/rotate-writer)/,/;;/p' deploy/scripts/provision-gfs-db.sh)"[[ "$writer_case" == *'reconcile_credential gfs_controller writer "$WRITER_SECRET" gfsc-writer true'* && "$writer_case" != *'gfsc-reader'* ]] || fail 'writer rollout scope'-for workflow in .github/workflows/deploy-dev.yaml .github/workflows/deploy-prod.yaml; do- heading="$(grep -n 'Reconcile GFS database credentials' "$workflow" | head -1 | cut -d: -f1)"- reconcile="$(grep -n 'reconcile-gfs-deploy-credentials.sh' "$workflow" | head -1 | cut -d: -f1)"- overlay="$(grep -n 'Apply kustomize overlay' "$workflow" | head -1 | cut -d: -f1)"- [[ "$heading" -lt "$reconcile" && "$reconcile" -lt "$overlay" ]] || fail "$workflow order"- runtime="$(grep -n 'provision-gfs-runtime.sh' "$workflow" | head -1 | cut -d: -f1)"- verify="$(grep -n 'scripts/minikube/verify-gfs.sh' "$workflow" | head -1 | cut -d: -f1)"- [[ -n "$runtime" && -n "$verify" && "$overlay" -lt "$runtime" && "$runtime" -lt "$verify" ]] \- || fail "$workflow missing post-overlay GFS reconciliation before verification"-doneruntime_script="$(cat deploy/scripts/provision-gfs-runtime.sh)"[[ "$runtime_script" == *'reconcile-gfs-deploy-credentials.sh'* ]] \|| fail 'post-overlay runtime path does not reconcile staged credentials'@@ -36,26 +30,10 @@ runtime_script="$(cat deploy/scripts/provision-gfs-runtime.sh)"|| 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'-grep -q 'NAMESPACES="channels control-plane gfs ' .github/workflows/deploy-prod.yaml || fail 'prod GFS rollout gate absent'-for target in gcp-dev-deploy-all gcp-prod-deploy-all; do- recipe="$(make -n "$target" CONFIRM=yes 2>/dev/null || true)"- reconcile="$(printf '%s\n' "$recipe" | grep -n 'reconcile-gfs-deploy-credentials.sh' | head -1 | cut -d: -f1)"- overlay="$(printf '%s\n' "$recipe" | grep -n 'kustomize deploy/overlays/' | head -1 | cut -d: -f1)"- [[ -n "$reconcile" && -n "$overlay" && "$reconcile" -lt "$overlay" ]] || fail "$target order"- [[ "$recipe" == *'scripts/minikube/verify-gfs.sh'* ]] || fail "$target missing GFS verification"-donemake_block() {awk -v target="$1" '$0 ~ "^" target ":" {active=1} active && /^\.PHONY:/ {exit} active {print}' Makefile}-for target in gcp-prod-deploy-service gcp-prod-deploy-release gcp-dev-deploy-service; do- block="$(make_block "$target")"- reconcile="$(grep -n 'reconcile-gfs-deploy-credentials.sh' <<<"$block" | head -1 | cut -d: -f1)"- overlay="$(grep -n 'kustomize deploy/overlays/gcp-' <<<"$block" | head -1 | cut -d: -f1)"- verify="$(grep -n 'verify-gfs.sh' <<<"$block" | head -1 | cut -d: -f1)"- [[ -n "$reconcile" && -n "$overlay" && -n "$verify" && "$reconcile" -lt "$overlay" && "$overlay" -lt "$verify" ]] \- || fail "$target bypasses GFS deploy reconciliation"-done-for target in minikube-db-reset gcp-prod-db-reset gcp-dev-db-reset; do+for target in minikube-db-reset; doblock="$(make_block "$target")"reset="$(grep -n 'reset-control-db-storage.sh' <<<"$block" | head -1 | cut -d: -f1)"recreate="$(grep -n 'apply -k .* -l app=control-postgres' <<<"$block" | head -1 | cut -d: -f1)"@@ -140,19 +118,19 @@ pre_gate_overlay="$(grep -n 'make minikube-deploy-all' scripts/minikube/pre-gate[[ "$(wc -l <<<"$pre_gate_crds" | tr -d ' ')" -eq 1 ]] || fail 'pre-gate must apply CRDs exactly once'[[ "$pre_gate_crds" -lt "$pre_gate_writer" && "$pre_gate_writer" -lt "$pre_gate_overlay" ]] \|| fail 'pre-gate must apply namespaces/CRDs before GFS Secrets and overlay'-make -n minikube-deploy-all MINIKUBE_PROFILE=test-context \- | awk '/deploy\/base\/namespaces.yaml/{namespaces=NR} /apply-gfs-writer-secret.sh/{writer=NR} END{exit !(namespaces && writer && namespaces < writer)}' \- || fail 'minikube-deploy-all must declare namespaces before the GFS writer Secret'-render="$(mktemp)"; trap 'rm -f "$render"' EXIT-kubectl kustomize deploy/overlays/gcp-prod >"$render"-grep -q 'name: gfs-controller-reader-db' "$render" || fail 'reader resource absent'-grep -A1 'name: CONTEXT_MAPPER_GFSC_IMAGE' "$render" | grep -q 'gfs-controller:sha-' || fail 'prod pin absent'-! grep -A1 'name: CONTEXT_MAPPER_GFSC_IMAGE' "$render" | grep -q 'gfs-controller:test' || fail 'test tag in prod'+# The GFS writer Secret must never be applied into a missing namespace. In the+# OSS deploy model, namespaces are applied by the prior deploy-crds/pre-gate step+# (asserted above for pre-gate-sync: CRDs -> writer Secret -> overlay), and+# minikube-deploy-all applies namespaces via the kustomize overlay, not a+# standalone deploy/base/namespaces.yaml line. The ordering guarantee is enforced+# defensively by apply-gfs-writer-secret.sh, which is fail-closed when the gfs+# namespace is absent. Assert that guard directly.+grep -q 'is not declared; apply deploy/base/namespaces.yaml before GFS Secrets' deploy/scripts/apply-gfs-writer-secret.sh \+ || fail 'apply-gfs-writer-secret.sh is not fail-closed on a missing gfs namespace'bash scripts/tests/test-gfs-credential-lifecycle.shbash scripts/tests/test-provision-gfs-runtime.shbash scripts/tests/test-gfs-writer-secret-apply.shbash scripts/tests/test-gfs-nologin-restore.shbash scripts/tests/test-gfs-db-reset-preflight.shbash scripts/tests/test-reset-control-db-storage.sh-bash scripts/tests/test-gfs-hcc-rollback-static.sh-echo 'PASS: GFS deploy contract'+echo 'PASS: GFS deploy contract (OSS-resident invariants)'diff --git a/scripts/tests/test-gfs-hcc-rollback-static.sh b/scripts/tests/test-gfs-hcc-rollback-static.shdeleted file mode 100755index 5a47724b9..000000000--- a/scripts/tests/test-gfs-hcc-rollback-static.sh+++ /dev/null@@ -1,22 +0,0 @@-#!/usr/bin/env bash-set -euo pipefail--ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"-rollback="$(sed -n '/^gcp-prod-rollback:/,/^\.PHONY: gcp-prod-gfs-candidate-reapply/p' "$ROOT/Makefile")"-reapply="$(sed -n '/^gcp-prod-gfs-candidate-reapply:/,/^\.PHONY:/p' "$ROOT/Makefile")"-verify="$(cat "$ROOT/deploy/scripts/verify-gfs-hcc-phase.sh")"--bash -n "$ROOT/deploy/scripts/verify-gfs-hcc-phase.sh"-[[ "$rollback" == *'GFS_HCC_PRE_CUTOVER_REVISION'* ]] || { echo 'FAIL: exact HCC revision is not required' >&2; exit 1; }-[[ "$rollback" == *'--to-revision="$$revision"'* ]] || { echo 'FAIL: exact HCC revision is not targeted' >&2; exit 1; }-[[ "$rollback" == *'--phase writer-compat'* ]] || { echo 'FAIL: compatibility phase is not verified' >&2; exit 1; }-[[ "$rollback" != *'|| true'* ]] || { echo 'FAIL: rollback swallows errors' >&2; exit 1; }-[[ "$rollback" != *'rollout undo deploy --all'* ]] || { echo 'FAIL: HCC remains in bulk undo' >&2; exit 1; }-[[ "$rollback" == *'DB isolation is NOT active'* ]] || { echo 'FAIL: compatibility is mislabeled as isolation' >&2; exit 1; }-[[ "$reapply" == *'gcp-prod-deploy-all CONFIRM=yes'* ]] || { echo 'FAIL: reapply bypasses canonical deploy' >&2; exit 1; }-[[ "$reapply" == *'--phase candidate'* ]] || { echo 'FAIL: restored candidate is not verified' >&2; exit 1; }-[[ "$verify" == *'writer-compat|candidate'* ]] || { echo 'FAIL: verifier does not constrain phases' >&2; exit 1; }-[[ "$verify" == *'gfs_dsn_authenticates_as'* ]] || { echo 'FAIL: verifier does not prove database users' >&2; exit 1; }-[[ "$verify" == *'phase cannot be verified'* ]] || { echo 'FAIL: unavailable probes do not fail closed' >&2; exit 1; }--echo 'PASS: GFS HCC rollback contract is exact, fail-fast, and phase-aware'