Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(hcc): allow exact-head proof on reused profile
Alfredo Lopez4db3d208f15a
diff --git a/scripts/e2e/_lib/hcc-watch-recovery-fixture.sh b/scripts/e2e/_lib/hcc-watch-recovery-fixture.shindex 4bb8f891d..a02098b28 100755--- a/scripts/e2e/_lib/hcc-watch-recovery-fixture.sh+++ b/scripts/e2e/_lib/hcc-watch-recovery-fixture.sh@@ -15,7 +15,7 @@ profile_env_value() {require_branch_owned_hcc_gate() {local marker_namespace="${1:-control-plane}"local actual_worktree_id actual_head actual_cluster_fingerprint actual_gate- local worktree_dirty expected_short_head expected_branch profile_env+ local worktree_dirty expected_branch profile_envlocal pre_gate_state_root cluster_fingerprint_file expected_cluster_fingerprintis_branch_scoped_e2e_context "$E2E_KUBECONTEXT" ||@@ -31,7 +31,6 @@ require_branch_owned_hcc_gate() {printf '%s' "$HCC_BRANCH_GATE_REPO_ROOT" | shasum | awk '{print $1}')"HCC_BRANCH_GATE_EXPECTED_HEAD="$(git -C "$HCC_BRANCH_GATE_REPO_ROOT" rev-parse HEAD)"- expected_short_head="$(git -C "$HCC_BRANCH_GATE_REPO_ROOT" rev-parse --short=8 HEAD)"expected_branch="$(git -C "$HCC_BRANCH_GATE_REPO_ROOT" branch --show-current)"[ -n "$expected_branch" ] ||die "branch-owned runtime proof requires a named branch, not detached HEAD"@@ -47,8 +46,6 @@ require_branch_owned_hcc_gate() {die "branch-profile helper output belongs to a different worktree"[ "$(profile_env_value BRANCH "$profile_env")" = "$expected_branch" ] ||die "branch-profile helper output belongs to a different branch"- [ "$(profile_env_value SHA_SHORT "$profile_env")" = "$expected_short_head" ] ||- die "branch-profile helper output belongs to a different HEAD"[ "$(profile_env_value DIRTY "$profile_env")" = false ] ||die "branch-profile helper recorded a dirty worktree; refresh it after committing"diff --git a/scripts/tests/test-hcc-watch-recovery-gate.sh b/scripts/tests/test-hcc-watch-recovery-gate.shindex 1f6350138..eac5367f1 100755--- a/scripts/tests/test-hcc-watch-recovery-gate.sh+++ b/scripts/tests/test-hcc-watch-recovery-gate.sh@@ -65,7 +65,7 @@ if [[ "$fixture_gate_function" == *'expected_branch="$(git -C "$HCC_BRANCH_GATE_[[ "$fixture_gate_function" == *'profile_env_value PROFILE'* ]] &&[[ "$fixture_gate_function" == *'profile_env_value REPO_DIR'* ]] &&[[ "$fixture_gate_function" == *'profile_env_value BRANCH'* ]] &&- [[ "$fixture_gate_function" == *'profile_env_value SHA_SHORT'* ]] &&+ [[ "$fixture_gate_function" != *'profile_env_value SHA_SHORT'* ]] &&[[ "$fixture_gate_function" == *'profile_env_value DIRTY'* ]] &&[[ "$fixture_gate_function" == *'cluster_fingerprint_file='* ]] &&[[ "$fixture_gate_function" == *'.data.clusterFingerprint'* ]] &&@@ -117,7 +117,7 @@ run_branch_gate_case() (profile-name) profile="clerum-other-profile-1234abcd" ;;profile-repo) profile_repo="${repo_root}-other" ;;profile-branch) profile_branch="codex/other" ;;- profile-sha) profile_sha="aaaaaaaa" ;;+ reused-profile) profile_sha="aaaaaaaa" ;;profile-dirty) profile_dirty=true ;;dirty-worktree) mock_worktree_dirty=" M changed.ts" ;;fingerprint) marker_fingerprint="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ;;@@ -173,8 +173,13 @@ if run_branch_gate_case success; thenelsefail "shared branch gate rejects matching branch-profile evidence"fi+if run_branch_gate_case reused-profile; then+ pass "shared branch gate accepts a reused same-branch profile after an exact-head pre-gate sync"+else+ fail "shared branch gate rejects a reused same-branch profile despite exact-head pre-gate evidence"+fifor case_name in detached minikube-profile-missing minikube-profile profile-name profile-repo profile-branch \- profile-sha profile-dirty dirty-worktree fingerprint gate; do+ profile-dirty dirty-worktree fingerprint gate; doif run_branch_gate_case "$case_name" >/dev/null 2>&1; thenfail "shared branch gate accepted mismatched ${case_name} evidence"else