Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(minikube): make the bootstrap contract assertions able to fail
Jose Ramirezfe4bb2419ae2
diff --git a/.github/workflows/ci-public.yml b/.github/workflows/ci-public.ymlindex 753781fe9..b0333af4e 100644--- a/.github/workflows/ci-public.yml+++ b/.github/workflows/ci-public.yml@@ -62,7 +62,6 @@ jobs:- external-rest-api- profile-ui- desktop-app- - profile-ui- mcp-servers- packages/desktop-app-links- packages/workflow-runtime-corediff --git a/desktop-app/package.json b/desktop-app/package.jsonindex b11d21ddf..8a8ae1760 100644--- a/desktop-app/package.json+++ b/desktop-app/package.json@@ -82,6 +82,9 @@"vitest": "^3.2.4","wait-on": "^8.0.5"},+ "engines": {+ "node": "24.x"+ },"overrides": {"@tootallnate/once": "^3.0.1","tmp": "^0.2.4",diff --git a/scripts/e2e/minimal-bootstrap-contract.sh b/scripts/e2e/minimal-bootstrap-contract.shindex 561307339..099070c0b 100755--- a/scripts/e2e/minimal-bootstrap-contract.sh+++ b/scripts/e2e/minimal-bootstrap-contract.sh@@ -27,6 +27,21 @@ clerum_initial_setup_link_matches() {[ "${4}" = "${5}" ]}+# The Desktop identity must be the bootstrap admin identity. Any divergence+# would mint an ordinary /admin/users member with no initial_setup operator+# link. full-setup.sh and seed-e2e-data.sh both enforce this, so the decision+# and its message live here once and stay testable without a cluster.+clerum_minimal_identity_matches() {+ local admin_email="${1-}" desktop_email="${2-}"+ [ -n "$admin_email" ] && [ -n "$desktop_email" ] && [ "$admin_email" = "$desktop_email" ]+}++clerum_minimal_identity_error() {+ local desktop_email="${1-}" admin_email="${2-}"+ printf 'SEED_PROFILE=minimal requires the Desktop identity email (%s) to equal the bootstrap admin email (%s); refusing to create an unlinked ordinary member' \+ "${desktop_email:-missing}" "${admin_email:-missing}"+}+clerum_minimal_setup_outcome() {case "${1:-}" in2[0-9][0-9]) printf '%s' setup_succeeded ;;diff --git a/scripts/e2e/seed-e2e-data.sh b/scripts/e2e/seed-e2e-data.shindex 1afa9fee8..4ca57e6c4 100755--- a/scripts/e2e/seed-e2e-data.sh+++ b/scripts/e2e/seed-e2e-data.sh@@ -116,8 +116,8 @@ if [ "$SEED_PROFILE" = "minimal" ]; thenelseDEV_EMAIL="$(clerum_minimal_desktop_email "$ADMIN_EMAIL" "" false)"fi- if [ "$DEV_EMAIL" != "$ADMIN_EMAIL" ]; then- printf '%s\n' " ERROR — SEED_PROFILE=minimal requires the Desktop identity email (${DEV_EMAIL}) to equal the bootstrap admin email (${ADMIN_EMAIL}); refusing to create an unlinked ordinary member" >&2+ if ! clerum_minimal_identity_matches "$ADMIN_EMAIL" "$DEV_EMAIL"; then+ printf ' ERROR: %s\n' "$(clerum_minimal_identity_error "$DEV_EMAIL" "$ADMIN_EMAIL")" >&2exit 1fiif [ -z "${E2E_DEV_LOGIN_NAME:-}" ]; thendiff --git a/scripts/minikube/full-setup.sh b/scripts/minikube/full-setup.shindex 1baa901d1..068976d72 100755--- a/scripts/minikube/full-setup.sh+++ b/scripts/minikube/full-setup.sh@@ -1445,8 +1445,9 @@ elseSEED_USER_EMAIL="${CLERUM_SEED_USER_EMAIL:-${CLERUM_TEST_USER_EMAIL:-${E2E_DEV_LOGIN_EMAIL:-${SEED_USER_DEFAULT_EMAIL}}}}"fiSEED_USER_NAME="${E2E_DEV_LOGIN_NAME:-${SEED_USER_DEFAULT_NAME}}"- if [ "$SEED_PROFILE" = "minimal" ] && [ "$SEED_USER_EMAIL" != "$ADMIN_EMAIL" ]; then- err "SEED_PROFILE=minimal requires the Desktop identity email (${SEED_USER_EMAIL}) to equal the bootstrap admin email (${ADMIN_EMAIL}); refusing to create an unlinked ordinary member"+ if [ "$SEED_PROFILE" = "minimal" ] \+ && ! clerum_minimal_identity_matches "$ADMIN_EMAIL" "$SEED_USER_EMAIL"; then+ err "$(clerum_minimal_identity_error "$SEED_USER_EMAIL" "$ADMIN_EMAIL")"exit 1filog "Seeding test user ${SEED_USER_EMAIL} → agent=chatllm, context=context1"diff --git a/scripts/tests/test-minikube-full-setup.sh b/scripts/tests/test-minikube-full-setup.shindex 50af50d78..55dc27d5d 100755--- a/scripts/tests/test-minikube-full-setup.sh+++ b/scripts/tests/test-minikube-full-setup.sh@@ -570,18 +570,22 @@ assert_minimal_bootstrap_contract_runs_on_system_bash() {fail "minimal bootstrap scripts are not parseable by the system Bash"returnfi+ # `! cmd` is explicitly exempt from set -e, so a bare `! predicate` line can+ # never fail this suite. refute() runs the predicate inside an `if` and exits+ # non-zero on unexpected success, which set -e does propagate.output="$(/bin/bash -c 'set -esource "$1"+ refute() { if "$@"; then printf "unexpected success: %s\n" "$*" >&2; exit 1; fi; }[ "$(clerum_canonical_email "[email protected]")" = "[email protected]" ][ "$(clerum_minimal_desktop_email "[email protected]" "" false)" = "[email protected]" ][ "$(clerum_minimal_desktop_email "[email protected]" "[email protected]" true)" = "[email protected]" ]clerum_initial_setup_link_matches active initial_setup desktop-id admin-id admin-id- ! clerum_initial_setup_link_matches revoked initial_setup desktop-id admin-id admin-id- ! clerum_initial_setup_link_matches active revoked desktop-id admin-id admin-id- ! clerum_initial_setup_link_matches active initial_setup desktop-id "" admin-id- ! clerum_initial_setup_link_matches active initial_setup "" admin-id admin-id- ! clerum_initial_setup_link_matches active initial_setup desktop-id other-admin admin-id+ refute clerum_initial_setup_link_matches revoked initial_setup desktop-id admin-id admin-id+ refute clerum_initial_setup_link_matches active revoked desktop-id admin-id admin-id+ refute clerum_initial_setup_link_matches active initial_setup desktop-id "" admin-id+ refute clerum_initial_setup_link_matches active initial_setup "" admin-id admin-id+ refute clerum_initial_setup_link_matches active initial_setup desktop-id other-admin admin-id[ "$(clerum_minimal_setup_outcome 201)" = setup_succeeded ][ "$(clerum_minimal_setup_outcome 409)" = setup_already_consumed ][ "$(clerum_minimal_setup_outcome 401)" = setup_failed ]@@ -609,14 +613,44 @@ assert_minimal_seed_rejects_a_divergent_identity() {}assert_minimal_setup_requires_admin_identity_email() {- if grep -Fq 'SEED_PROFILE=minimal requires the Desktop identity email' \- "$REPO_ROOT/scripts/minikube/full-setup.sh" && \- grep -Fq 'SEED_USER_DEFAULT_EMAIL="$ADMIN_EMAIL"' \- "$REPO_ROOT/scripts/minikube/full-setup.sh"; then- pass "minimal setup refuses a second unlinked Desktop identity"- else- fail "minimal setup can still create a Desktop identity different from the bootstrap admin"+ local contract="$REPO_ROOT/scripts/e2e/minimal-bootstrap-contract.sh"+ local output++ # Exercise the decision both call sites now share, rather than grepping for+ # the source line that expresses it. A grep passes on any refactor that keeps+ # the text and changes the meaning.+ if ! output="$(/bin/bash -c '+ set -e+ source "$1"+ refute() { if "$@"; then printf "unexpected success: %s\n" "$*" >&2; exit 1; fi; }+ clerum_minimal_identity_matches [email protected] [email protected]+ refute clerum_minimal_identity_matches [email protected] [email protected]+ refute clerum_minimal_identity_matches [email protected] ""+ refute clerum_minimal_identity_matches "" [email protected]+ refute clerum_minimal_identity_matches "" ""+ case "$(clerum_minimal_identity_error [email protected] [email protected])" in+ *"Desktop identity email ([email protected])"*"bootstrap admin email ([email protected])"*) ;;+ *) exit 1 ;;+ esac+ printf ok+ ' bash "$contract")"; then+ fail "minimal identity guard does not accept the admin identity and reject every divergence"+ return+ fi+ if [ "$output" != "ok" ]; then+ fail "minimal identity guard contract did not complete (output=$output)"+ return+ fi+ # Both enforcement points must route through the shared guard, so a fix in+ # one cannot silently leave the other permissive.+ if ! grep -Fq 'clerum_minimal_identity_matches "$ADMIN_EMAIL" "$SEED_USER_EMAIL"' \+ "$REPO_ROOT/scripts/minikube/full-setup.sh" ||+ ! grep -Fq 'clerum_minimal_identity_matches "$ADMIN_EMAIL" "$DEV_EMAIL"' \+ "$REPO_ROOT/scripts/e2e/seed-e2e-data.sh"; then+ fail "a minimal enforcement point does not use the shared identity guard"+ returnfi+ pass "minimal setup refuses a second unlinked Desktop identity"}assert_an_unknown_image_source_is_a_hard_error() {diff --git a/scripts/tests/test-minikube-t2-scenarios.sh b/scripts/tests/test-minikube-t2-scenarios.shindex 647d26fe7..deb366c58 100755--- a/scripts/tests/test-minikube-t2-scenarios.sh+++ b/scripts/tests/test-minikube-t2-scenarios.sh@@ -159,6 +159,16 @@ expect_code IMAGE_MANIFEST_MISMATCH not-built-local not-built-local \env "${repo_env[@]}" T2_IMAGE_MANIFEST="$not_built_local_manifest" T2_IMAGE_SOURCE=local T2_IMAGE_TAG= \bash -c 'source "$1"; T2_IMAGE_SOURCE=local; T2_IMAGE_TAG=""; t2_image_check' bash "$COMMON"+# The multi-node writer records minikube_image_id output, which is NOT_FOUND+# when an image is absent from the node. Single-node records docker inspect's+# NOT_BUILT. Both sentinels must be rejected, so cover the multi-node one too.+not_found_local_manifest="$tmp/not-found-local-image-manifest.json"+printf '{"imageSource":"local","imageTag":"","images":{"clerum/control-api:test":"NOT_FOUND"}}+' >"$not_found_local_manifest"+expect_code IMAGE_MANIFEST_MISMATCH not-found-local not-found-local \+ env "${repo_env[@]}" T2_IMAGE_MANIFEST="$not_found_local_manifest" T2_IMAGE_SOURCE=local T2_IMAGE_TAG= \+ bash -c 'source "$1"; T2_IMAGE_SOURCE=local; T2_IMAGE_TAG=""; t2_image_check' bash "$COMMON"+short_local_manifest="$tmp/short-local-image-manifest.json"printf '{"imageSource":"local","imageTag":"","images":{"clerum/control-api:test":"sha256:0123456789abcdef0123456789abcdef"}}\n' >"$short_local_manifest"expect_code IMAGE_MANIFEST_MISMATCH short-local short-local \