Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(minikube): verify the images the cluster actually holds
Jose Ramirez31c4e7e2d584
diff --git a/.github/workflows/ci-public.yml b/.github/workflows/ci-public.ymlindex 6f7ab0ca5..2d550b255 100644--- a/.github/workflows/ci-public.yml+++ b/.github/workflows/ci-public.yml@@ -366,6 +366,9 @@ jobs:- name: Test the minikube image pullerrun: bash scripts/tests/test-minikube-pull-images.sh+ - name: Test the minikube image verifier (recorded mode, E2E fixtures)+ run: bash scripts/tests/test-minikube-verify-images.sh+- name: Test minikube Makefile targetsrun: bash scripts/tests/test-minikube-makefile.shdiff --git a/Makefile b/Makefileindex 62197f359..da6d7bc30 100644--- a/Makefile+++ b/Makefile@@ -193,8 +193,9 @@ minikube-build-custom-coordinator-fixture: ## Build only the custom coordinator@scripts/minikube/build-images.sh --only=workflow-custom-sdk-e2e.PHONY: minikube-verify-images-minikube-verify-images: ## Verify every image the cluster runs is present (checks ghcr refs in ghcr mode, clerum/* in local mode)+minikube-verify-images: ## Verify every image the cluster runs is present. The mode comes from deploy/minikube/.image-manifest.json (what was actually built/pulled), not from IMAGE_SOURCE; SEED_PROFILE=e2e also checks the two E2E fixtures.@IMAGE_SOURCE="$(IMAGE_SOURCE)" MINIKUBE_IMAGE_TAG="$(MINIKUBE_IMAGE_TAG)" \+ MINIKUBE_SEED_PROFILE="$(SEED_PROFILE)" \scripts/minikube/build-images.sh --verify-only.PHONY: minikube-verifydiff --git a/deploy/images.json b/deploy/images.jsonindex 70d61f40f..79395a40e 100644--- a/deploy/images.json+++ b/deploy/images.json@@ -260,13 +260,15 @@"name": "workflow-custom-sdk-e2e","path": "tests/e2e/fixtures/custom-workflow-coordinator","published": false,- "deployed_to_minikube": true+ "deployed_to_minikube": true,+ "e2e_only": true},{"name": "workflow-plugin-sdk-e2e","path": "tests/e2e/fixtures/workflow-plugin-sdk-e2e","published": false,- "deployed_to_minikube": true+ "deployed_to_minikube": true,+ "e2e_only": true},{"name": "doc-generator-mcp",diff --git a/scripts/minikube/build-images.sh b/scripts/minikube/build-images.shindex be0607e01..927cd25df 100755--- a/scripts/minikube/build-images.sh+++ b/scripts/minikube/build-images.sh@@ -32,6 +32,12 @@# --only=<svc> Build only the image(s) whose tag matches the substring <svc># (e.g. --only=control-api, --only=workflow-recipes). Skips# public-image pulls and manifest regeneration.+# --include-e2e-fixtures+# --verify-only: also demand the two E2E-only fixtures+# (workflow-custom-sdk-e2e, workflow-plugin-sdk-e2e) in ghcr+# mode. Only `make minikube-setup-e2e` builds them there, so+# the default ghcr verify set leaves them out.+# MINIKUBE_SEED_PROFILE=e2e implies this.# --include-desktop-image# Include clerum/mcp-host-desktop:test in full builds.# --include-playwright-mcp-image@@ -93,6 +99,12 @@ esac# always builds clerum/* locally when asked to build. In ghcr mode the cluster# runs ghcr.io/evenfire-ai/* refs (deploy/components/ghcr-images), so verifying# clerum/* would report "all images present" against images no pod references.+#+# This env var is only the FALLBACK for --verify-only. What a cluster actually+# runs is decided by whichever writer last performed a full image acquisition,+# and that is recorded in .image-manifest.json (see recorded_image_source+# below). Trusting the env default here is what made `make minikube-verify-+# images` report "25 of 28 images missing" on a healthy locally built cluster.IMAGE_SOURCE="${IMAGE_SOURCE:-ghcr}"case "$IMAGE_SOURCE" inghcr|local) ;;@@ -101,6 +113,38 @@ esacGHCR_NAMESPACE="ghcr.io/evenfire-ai"GHCR_COMPONENT="${PROJECT_DIR}/deploy/components/ghcr-images/kustomization.yaml"+# Written by this script's manifest writer and by pull-images.sh; read back by+# --verify-only. Declared here, not next to the writer at the bottom, because+# the verify path (which exits before the writer) needs it too.+MANIFEST_FILE="${PROJECT_DIR}/deploy/minikube/.image-manifest.json"++# The mode the cluster's images were actually acquired in. Prints nothing when+# the manifest is absent, unparseable, or records anything other than+# ghcr|local -- callers then fall back to the IMAGE_SOURCE env var.+recorded_image_source() {+ [ -f "$MANIFEST_FILE" ] || return 0+ node -e '+ const fs = require("node:fs")+ let parsed+ try {+ parsed = JSON.parse(fs.readFileSync(process.argv[1], "utf8"))+ } catch {+ process.exit(0)+ }+ if (parsed.imageSource === "ghcr" || parsed.imageSource === "local") {+ process.stdout.write(parsed.imageSource)+ }+ ' "$MANIFEST_FILE"+}++# The two E2E-only fixtures are built by `make minikube-setup-e2e` alone, which+# sets SEED_PROFILE=e2e. Honour that as well as the explicit flag so a verify+# run after an e2e setup checks what that setup actually built.+INCLUDE_E2E_FIXTURES=false+if [ "${MINIKUBE_SEED_PROFILE:-}" = "e2e" ]; then+ INCLUDE_E2E_FIXTURES=true+fi+# The effective ghcr tag: MINIKUBE_IMAGE_TAG if set (a render-time operator# lever), otherwise the committed pin, which is the single source of truth.resolve_ghcr_tag() {@@ -124,6 +168,7 @@ for arg in "$@"; do--verify-only) VERIFY_ONLY=true ;;--public-only) PUBLIC_ONLY=true ;;--only=*) ONLY_SVC="${arg#--only=}" ;;+ --include-e2e-fixtures) INCLUDE_E2E_FIXTURES=true ;;--include-desktop-image) MINIKUBE_BUILD_DESKTOP_IMAGE=true ;;--include-playwright-mcp-image) MINIKUBE_BUILD_PLAYWRIGHT_MCP_IMAGE=true ;;esac@@ -342,15 +387,39 @@ fi# The verify set is NOT ALL_IMAGES. ALL_IMAGES is the BUILD list (its ordering# and Dockerfile arguments are hand-written per call). What must be verified is# the ref each pod will actually pull, which splits on `published`, not on the-# mode: a published+deployed image runs from ghcr in ghcr mode, and every-# unpublished one (doc-generator-mcp, workflow-custom-sdk-e2e,-# workflow-plugin-sdk-e2e) is built and verified locally in BOTH modes.+# mode: a published+deployed image runs from ghcr in ghcr mode, and the+# unpublished ones are built locally and verified under their clerum/* ref.+#+# doc-generator-mcp is unpublished but built on BOTH paths (full-setup.sh runs+# `--only=doc-generator-mcp` before the pull), so it is always verified. The+# two e2e_only fixtures are NOT: on the ghcr path nothing builds them, so+# demanding them there fails a healthy default cluster with a remedy that can+# never supply them (they are published:false, so no pull can fetch them). They+# come back with --include-e2e-fixtures / MINIKUBE_SEED_PROFILE=e2e, and in+# local mode, where a full build builds every fixture.if [ "$VERIFY_ONLY" = true ]; then+ # What the cluster RUNS decides what gets verified. The env var is only a+ # fallback for a cluster nothing has built or pulled into yet.+ VERIFY_SOURCE_ORIGIN="the IMAGE_SOURCE environment variable (no image manifest yet)"+ RECORDED_IMAGE_SOURCE="$(recorded_image_source)"+ if [ -n "$RECORDED_IMAGE_SOURCE" ]; then+ if [ "$RECORDED_IMAGE_SOURCE" != "$IMAGE_SOURCE" ]; then+ log "deploy/minikube/.image-manifest.json records imageSource=${RECORDED_IMAGE_SOURCE};"+ log "verifying that, not the '${IMAGE_SOURCE}' this shell would have used."+ fi+ IMAGE_SOURCE="$RECORDED_IMAGE_SOURCE"+ VERIFY_SOURCE_ORIGIN="deploy/minikube/.image-manifest.json"+ fi+echo -e "\n${BOLD}=== Verifying Images in Minikube (IMAGE_SOURCE=${IMAGE_SOURCE}) ===${NC}"+ log "mode from ${VERIFY_SOURCE_ORIGIN}"GHCR_TAG=""if [ "$IMAGE_SOURCE" = ghcr ]; thenGHCR_TAG="$(resolve_ghcr_tag)"+ if [ "$INCLUDE_E2E_FIXTURES" = false ]; then+ log "excluding the E2E-only fixtures; 'make minikube-setup-e2e' builds them (SEED_PROFILE=e2e to check them)"+ fifiVERIFY_IMAGES=()@@ -359,21 +428,16 @@ if [ "$VERIFY_ONLY" = true ]; thenVERIFY_IMAGES+=("$ref")done < <(node -e 'import("'"$PROJECT_DIR"'/scripts/release/images-manifest.mjs").then(m => {- const mode = process.argv[1]- const tag = process.argv[2]- const ghcr = new Set(m.pullInGhcrMode().map(i => i.name))- for (const image of m.IMAGES) {- if (!image.deployed_to_minikube) continue- if (mode === "ghcr" && ghcr.has(image.name)) {- process.stdout.write(`ghcr.io/evenfire-ai/${image.name}:${tag}\n`)- } else {- process.stdout.write(`${m.localRef(image)}\n`)- }- }+ const refs = m.minikubeVerifyRefs({+ mode: process.argv[1],+ tag: process.argv[2],+ includeE2eFixtures: process.argv[3] === "true",+ })+ for (const ref of refs) process.stdout.write(`${ref}\n`)}).catch(err => {process.stderr.write(`images-manifest read failed: ${err.message}\n`)process.exit(1)- })' "$IMAGE_SOURCE" "$GHCR_TAG")+ })' "$IMAGE_SOURCE" "$GHCR_TAG" "$INCLUDE_E2E_FIXTURES")# An empty verify set means the manifest read failed or the mode is wrong.# "0 of 0 images missing" is not a pass.@@ -412,8 +476,11 @@ if [ "$VERIFY_ONLY" = true ]; thenecho -e "${GREEN}${BOLD}All ${#VERIFY_IMAGES[@]} images present in minikube.${NC}"elseecho -e "${RED}${BOLD}${fail_count} of ${#VERIFY_IMAGES[@]} images missing!${NC}"+ # The remedy follows the mode this cluster was actually built in. Telling a+ # locally built cluster to pull would replace its clerum/*:test tags with+ # release images -- a fix that breaks exactly what it claims to repair.if [ "$IMAGE_SOURCE" = ghcr ]; then- echo -e "${RED}Run: make minikube-pull-images${NC}"+ echo -e "${RED}Run: make minikube-pull-images (tag ${GHCR_TAG})${NC}"elseecho -e "${RED}Run: make minikube-build-images${NC}"fi@@ -732,13 +799,33 @@ if [ "$SKIP_PUBLIC" = false ]; thenfi# ---- Generate build manifest JSON -----MANIFEST_FILE="${PROJECT_DIR}/deploy/minikube/.image-manifest.json"+# MANIFEST_FILE is declared at the top of the script; the verify path needs it+# too and exits long before this point.mkdir -p "$(dirname "$MANIFEST_FILE")"echo -e "\n${BOLD}=== Generating Image Manifest ===${NC}"++# How this cluster's images were acquired, read back by --verify-only.+# pull-images.sh writes "ghcr"; this script only ever BUILDS, so a full run+# writes "local" regardless of the IMAGE_SOURCE env var, which describes what+# the cluster renders, not what just happened here.+#+# A partial run (--only=<svc>, and --public-only, which sets ONLY_SVC) acquires+# a subset and must not redefine the mode: `make minikube-setup-e2e` builds two+# fixtures with --only AFTER the ghcr pull, and `make minikube-setup` builds+# doc-generator-mcp with --only BEFORE it. Carry the recorded value forward+# instead, and fall back to the env var only when nothing is recorded yet.+MANIFEST_IMAGE_SOURCE="local"+if [ -n "$ONLY_SVC" ]; then+ MANIFEST_IMAGE_SOURCE="$(recorded_image_source)"+ if [ -z "$MANIFEST_IMAGE_SOURCE" ]; then+ MANIFEST_IMAGE_SOURCE="$IMAGE_SOURCE"+ fi+fi{echo "{"echo " \"generated\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\","echo " \"profile\": \"${PROFILE}\","+ echo " \"imageSource\": \"${MANIFEST_IMAGE_SOURCE}\","echo " \"images\": {"count=0total=${#ALL_IMAGES[@]}diff --git a/scripts/minikube/full-setup.sh b/scripts/minikube/full-setup.shindex cab001fd7..9d85df75f 100755--- a/scripts/minikube/full-setup.sh+++ b/scripts/minikube/full-setup.sh@@ -768,7 +768,9 @@ elif [ "$IMAGE_SOURCE" = ghcr ]; then# --only= runs (its header comment claims otherwise; the code at the bottom# of the script is unconditional). So every build-images.sh call has to come# BEFORE the pull, or it clobbers the puller's manifest -- the one file the- # --skip-build staleness check reads -- with a mostly-NOT_BUILT map.+ # --skip-build staleness check reads -- with a mostly-NOT_BUILT map. (The+ # `imageSource` key survives that clobber either way: an --only= run carries+ # the recorded value forward rather than claiming the cluster is local.)## No clerum image build runs on this path, so nothing else pulls the public# third-party images (postgres, redis, nginx, ...) into the daemon.diff --git a/scripts/minikube/pull-images.sh b/scripts/minikube/pull-images.shindex 067c9a762..75622c9a5 100755--- a/scripts/minikube/pull-images.sh+++ b/scripts/minikube/pull-images.sh@@ -220,6 +220,12 @@ fi# Same shape build-images.sh writes. scripts/minikube/full-setup.sh:608 uses# this file as a `find -newer` staleness marker, and its absence makes the ghcr# path look like "images were never built".+#+# `imageSource` is not decoration: `build-images.sh --verify-only` reads it back+# to decide whether to verify ghcr.io/evenfire-ai/* or clerum/* refs. Without a+# recorded mode it falls back to the IMAGE_SOURCE env default (ghcr), which is+# how a locally built cluster came to be reported as "25 of 28 images missing".+# This writer only ever pulls, so the value is always "ghcr".MANIFEST_FILE="${PROJECT_DIR}/deploy/minikube/.image-manifest.json"mkdir -p "$(dirname "$MANIFEST_FILE")"{diff --git a/scripts/release/images-manifest.mjs b/scripts/release/images-manifest.mjsindex fd4ebebf1..e7a0ddc04 100644--- a/scripts/release/images-manifest.mjs+++ b/scripts/release/images-manifest.mjs@@ -44,6 +44,22 @@ function load() {if (typeof image.deployed_to_minikube !== 'boolean') {throw new Error(`${MANIFEST_PATH}: ${image.name} must set deployed_to_minikube explicitly`)}+ // e2e_only marks a fixture that ONLY `make minikube-setup-e2e` acquires.+ // Optional, so absent means false, but a present value must be a real+ // boolean: `"e2e_only": "false"` is truthy and would silently drop the+ // image from the default verify set.+ if ('e2e_only' in image && typeof image.e2e_only !== 'boolean') {+ throw new Error(`${MANIFEST_PATH}: ${image.name} sets a non-boolean e2e_only`)+ }+ // A published image is pulled on the default path, so it is never an+ // E2E-only fixture. The pair would make minikubeVerifyRefs() drop a ref+ // the cluster actually runs.+ if (image.published && image.e2e_only) {+ throw new Error(+ `${MANIFEST_PATH}: ${image.name} is published AND e2e_only -- a published image is ` ++ `acquired on the default path and must stay in the verify set`+ )+ }if ('pull_in_ghcr_mode' in image) {throw new Error(`${MANIFEST_PATH}: ${image.name} stores pull_in_ghcr_mode; it is derived ` +@@ -87,3 +103,44 @@ export function pullInGhcrMode() {export function localRef(image) {return `clerum/${image.local_name ?? image.name}:${image.local_tag ?? 'test'}`}++export const GHCR_NAMESPACE = 'ghcr.io/evenfire-ai'++// The refs `build-images.sh --verify-only` must find in the cluster.+//+// This is NOT the build list (ALL_IMAGES in build-images.sh): that list is+// hand-ordered with per-image Dockerfile arguments. It is the set of refs the+// pods actually pull, which is why it splits on `published` -- a+// published+deployed image runs from ghcr in ghcr mode, an unpublished one is+// built locally and runs under its clerum/* ref in BOTH modes.+//+// `mode` must describe how the cluster's images were ACQUIRED, not what+// IMAGE_SOURCE happens to default to in the caller's shell. Verifying ghcr+// refs on a locally built cluster reports every image missing; verifying+// clerum/* on a ghcr cluster reports "all present" against images no pod+// references. Both are worse than no check.+export function minikubeVerifyRefs({ mode, tag, includeE2eFixtures = false } = {}) {+ if (mode !== 'ghcr' && mode !== 'local') {+ throw new Error(`minikubeVerifyRefs: mode must be 'ghcr' or 'local', got '${mode}'`)+ }+ if (mode === 'ghcr' && !tag) {+ throw new Error('minikubeVerifyRefs: ghcr mode needs a tag to build a ref from')+ }+ const fromGhcr = new Set(pullInGhcrMode().map(i => i.name))+ const refs = []+ for (const image of IMAGES) {+ if (!image.deployed_to_minikube) continue+ // The E2E-only fixtures are published:false, so ghcr cannot supply them,+ // and the default ghcr setup path does not build them either -- only+ // `make minikube-setup-e2e` does. Demanding them there fails a healthy+ // cluster with a remedy that can never work. The local path is different:+ // a full build_images run builds every fixture, so they stay in the set.+ if (image.e2e_only && mode === 'ghcr' && !includeE2eFixtures) continue+ if (mode === 'ghcr' && fromGhcr.has(image.name)) {+ refs.push(`${GHCR_NAMESPACE}/${image.name}:${tag}`)+ } else {+ refs.push(localRef(image))+ }+ }+ return refs+}diff --git a/scripts/tests/test-images-manifest.sh b/scripts/tests/test-images-manifest.shindex defe19283..5e49b18dd 100755--- a/scripts/tests/test-images-manifest.sh+++ b/scripts/tests/test-images-manifest.sh@@ -536,26 +536,22 @@ assert_all_three_image_lists_agree() {# fed `while read` nothing, `missing` stayed empty, and this case could never# fail -- verified by commenting out an invocation and seeing it still print# PASS while under-reporting its own invoked count.-# build-images.sh --verify-only must check the ref the CLUSTER will run, which-# depends on IMAGE_SOURCE. Checking clerum/* in ghcr mode reports "all images-# present" against images no pod references, which is worse than no check.-assert_verify_only_resolves_the_ref_per_mode() {- local sh out- sh="$REPO_ROOT/scripts/minikube/build-images.sh"- out=""- grep -q 'IMAGE_SOURCE' "$sh" || out+="build-images.sh does not read IMAGE_SOURCE; "- grep -q 'pullInGhcrMode' "$sh" || out+="build-images.sh does not derive its verify set from pullInGhcrMode(); "- grep -q 'VERIFY_IMAGES' "$sh" || out+="build-images.sh has no separate VERIFY_IMAGES set; "- if [ -z "$out" ]; then- pass "build-images.sh derives a mode-aware verify set from the manifest"- else- fail "$out"- fi-}+# NOTE: the case that used to sit here grepped build-images.sh for the strings+# IMAGE_SOURCE, pullInGhcrMode and VERIFY_IMAGES. It died the moment the+# derivation moved into minikubeVerifyRefs() -- while `if (false && ...)` around+# the same derivation would have left it green. Its intent, "--verify-only+# checks the ref the CLUSTER runs", is now covered by execution instead: the+# derivation by the minikubeVerifyRefs cases below, and the end-to-end+# behaviour (including which mode is chosen) by+# scripts/tests/test-minikube-verify-images.sh, which runs the real script+# against a stubbed daemon holding one mode's refs only.-# The rule has to hold in BOTH modes, not just ghcr: doc-generator-mcp,-# workflow-custom-sdk-e2e and workflow-plugin-sdk-e2e are published:false, so-# they are locally built and locally verified even when IMAGE_SOURCE=ghcr.+# The rule has to hold in BOTH modes, not just ghcr: the published:false images+# have no ghcr counterpart at all, so whenever they are verified they are+# verified under their local clerum/* ref, IMAGE_SOURCE notwithstanding.+# (WHETHER each one is verified in ghcr mode is a separate question, settled by+# e2e_only in the cases below: doc-generator-mcp is built on both paths, the two+# sdk-e2e fixtures only by `make minikube-setup-e2e`.)assert_the_verify_set_splits_on_published_not_on_mode() {local output rcoutput="$(node -e '@@ -584,6 +580,150 @@ assert_the_verify_set_splits_on_published_not_on_mode() {fi}+# `make minikube-setup` (default ghcr, SEED_PROFILE=minimal) builds exactly one+# unpublished image, doc-generator-mcp. The two sdk-e2e fixtures are built by+# `make minikube-setup-e2e` alone and no pull can supply them (published:false),+# so demanding them on the default path fails a healthy cluster with a remedy+# that can never work.+#+# The expected refs are spelled out rather than re-derived from the manifest:+# a test that recomputes minikubeVerifyRefs()'s own rule proves nothing.+assert_the_default_ghcr_verify_set_omits_only_the_e2e_fixtures() {+ local output rc+ output="$(node -e '+ import("'"$REPO_ROOT"'/scripts/release/images-manifest.mjs").then(m => {+ const refs = m.minikubeVerifyRefs({ mode: "ghcr", tag: "vTEST" })+ const problems = []+ const deployed = m.IMAGES.filter(i => i.deployed_to_minikube).length+ for (const gone of ["workflow-custom-sdk-e2e", "workflow-plugin-sdk-e2e"]) {+ if (refs.some(r => r.includes(gone))) problems.push(`${gone} is still demanded in ghcr mode`)+ }+ if (!refs.includes("clerum/doc-generator-mcp:v1")) {+ problems.push("doc-generator-mcp dropped; it IS built on the default ghcr path")+ }+ if (!refs.includes("ghcr.io/evenfire-ai/control-api:vTEST")) {+ problems.push("a published image is not verified at its ghcr ref")+ }+ if (refs.length !== deployed - 2) {+ problems.push(`expected ${deployed - 2} refs, got ${refs.length}`)+ }+ console.log(problems.join("; "))+ }).catch(err => {+ console.log(`PARSE_ERROR: ${err.message}`)+ process.exit(1)+ })' 2>&1)"+ rc=$?+ if [ "$rc" -ne 0 ]; then+ fail "verify-set derivation failed: $output"+ elif [ -z "$output" ]; then+ pass "the default ghcr verify set drops the two E2E fixtures and nothing else"+ else+ fail "$output"+ fi+}++# The exclusion is an opt-out, not a deletion. `make minikube-setup-e2e` builds+# both fixtures, and a full LOCAL build builds every fixture unconditionally --+# origin/dev verified them, and dropping them there would lose real coverage.+assert_the_e2e_opt_in_and_local_mode_both_keep_the_fixtures() {+ local output rc+ output="$(node -e '+ import("'"$REPO_ROOT"'/scripts/release/images-manifest.mjs").then(m => {+ const problems = []+ const wanted = ["clerum/workflow-custom-sdk-e2e:test", "clerum/workflow-plugin-sdk-e2e:test"]+ const optedIn = m.minikubeVerifyRefs({ mode: "ghcr", tag: "vTEST", includeE2eFixtures: true })+ for (const ref of wanted) {+ if (!optedIn.includes(ref)) problems.push(`ghcr+opt-in is missing ${ref}`)+ }+ const local = m.minikubeVerifyRefs({ mode: "local" })+ for (const ref of wanted) {+ if (!local.includes(ref)) problems.push(`local mode is missing ${ref}`)+ }+ if (local.some(r => r.startsWith("ghcr.io/"))) problems.push("local mode emitted a ghcr ref")+ if (local.length !== m.IMAGES.filter(i => i.deployed_to_minikube).length) {+ problems.push(`local mode dropped an image: ${local.length} refs`)+ }+ console.log(problems.join("; "))+ }).catch(err => {+ console.log(`PARSE_ERROR: ${err.message}`)+ process.exit(1)+ })' 2>&1)"+ rc=$?+ if [ "$rc" -ne 0 ]; then+ fail "verify-set derivation failed: $output"+ elif [ -z "$output" ]; then+ pass "both the e2e opt-in and local mode keep the E2E fixtures in the verify set"+ else+ fail "$output"+ fi+}++# A mode this function cannot serve must throw, not fall through to some+# default: a silent fallback would emit `...:undefined` refs, and every one of+# them would then be reported MISSING against a healthy cluster.+assert_verify_refs_refuses_a_mode_or_tag_it_cannot_serve() {+ local output rc+ output="$(node -e '+ import("'"$REPO_ROOT"'/scripts/release/images-manifest.mjs").then(m => {+ const problems = []+ const mustThrow = (label, fn) => {+ try {+ const refs = fn()+ problems.push(`${label} returned ${refs.length} refs instead of throwing`)+ } catch {+ /* expected */+ }+ }+ mustThrow("an unknown mode", () => m.minikubeVerifyRefs({ mode: "gcr", tag: "vTEST" }))+ mustThrow("a missing mode", () => m.minikubeVerifyRefs({}))+ mustThrow("ghcr with no tag", () => m.minikubeVerifyRefs({ mode: "ghcr" }))+ console.log(problems.join("; "))+ }).catch(err => {+ console.log(`PARSE_ERROR: ${err.message}`)+ process.exit(1)+ })' 2>&1)"+ rc=$?+ if [ "$rc" -ne 0 ]; then+ fail "verify-set derivation failed: $output"+ elif [ -z "$output" ]; then+ pass "an unknown mode and a tagless ghcr call both throw"+ else+ fail "$output"+ fi+}++# e2e_only removes a ref from the default verify set, so a published image must+# never carry it -- that would silently stop verifying an image every cluster+# pulls.+assert_e2e_only_images_are_unpublished_minikube_fixtures() {+ local output rc+ output="$(node -e '+ import("'"$REPO_ROOT"'/scripts/release/images-manifest.mjs").then(m => {+ const flagged = m.IMAGES.filter(i => i.e2e_only)+ const problems = []+ const names = flagged.map(i => i.name).sort().join(",")+ if (names !== "workflow-custom-sdk-e2e,workflow-plugin-sdk-e2e") {+ problems.push(`unexpected e2e_only set: ${names || "<none>"}`)+ }+ for (const i of flagged) {+ if (i.published) problems.push(`${i.name} is published AND e2e_only`)+ if (!i.deployed_to_minikube) problems.push(`${i.name} is e2e_only but not deployed_to_minikube`)+ }+ console.log(problems.join("; "))+ }).catch(err => {+ console.log(`PARSE_ERROR: ${err.message}`)+ process.exit(1)+ })' 2>&1)"+ rc=$?+ if [ "$rc" -ne 0 ]; then+ fail "e2e_only read failed: $output"+ elif [ -z "$output" ]; then+ pass "e2e_only marks exactly the two unpublished minikube E2E fixtures"+ else+ fail "$output"+ fi+}+assert_every_defined_case_is_invoked() {local self defined invoked missingself="$REPO_ROOT/scripts/tests/test-images-manifest.sh"@@ -608,8 +748,11 @@ assert_matrix_fields_match_manifestassert_every_matrix_image_has_a_manifest_rowassert_source_paths_match_filtersassert_all_three_image_lists_agree-assert_verify_only_resolves_the_ref_per_modeassert_the_verify_set_splits_on_published_not_on_mode+assert_the_default_ghcr_verify_set_omits_only_the_e2e_fixtures+assert_the_e2e_opt_in_and_local_mode_both_keep_the_fixtures+assert_verify_refs_refuses_a_mode_or_tag_it_cannot_serve+assert_e2e_only_images_are_unpublished_minikube_fixturesassert_every_defined_case_is_invokedexit $FAILdiff --git a/scripts/tests/test-minikube-pull-images.sh b/scripts/tests/test-minikube-pull-images.shindex 088633e45..9120ffb7a 100755--- a/scripts/tests/test-minikube-pull-images.sh+++ b/scripts/tests/test-minikube-pull-images.sh@@ -203,6 +203,10 @@ assert_it_writes_the_image_manifest_consumers_read() {const problems = []if (typeof j.generated !== "string" || !j.generated) problems.push("generated")if (typeof j.profile !== "string" || !j.profile) problems.push("profile")+ // Not decoration: build-images.sh --verify-only reads imageSource back to+ // decide whether to check ghcr.io/evenfire-ai/* or clerum/* refs. Without+ // it, verify falls back to the IMAGE_SOURCE env default.+ if (j.imageSource !== "ghcr") problems.push(`imageSource=${JSON.stringify(j.imageSource)}`)if (!j.images || typeof j.images !== "object") problems.push("images")else {const keys = Object.keys(j.images)diff --git a/scripts/tests/test-minikube-verify-images.sh b/scripts/tests/test-minikube-verify-images.shnew file mode 100755index 000000000..34c5c9e3f--- /dev/null+++ b/scripts/tests/test-minikube-verify-images.sh@@ -0,0 +1,496 @@+#!/usr/bin/env bash+set -u+FAIL=0++# `build-images.sh --verify-only` decides WHICH refs a cluster must have. Two+# ways it got that wrong, both reproduced on a real cluster:+#+# 1. It read the IMAGE_SOURCE env var, which defaults to ghcr. After+# `make minikube-setup-local` (whose IMAGE_SOURCE=local is scoped to that+# one sub-make) `make minikube-verify-images` reported "25 of 28 images+# missing!" on a healthy cluster, and told the user to pull -- which would+# have overwritten their local clerum/*:test tags with release images.+#+# 2. Its ghcr verify set demanded the two E2E-only fixtures that the default+# ghcr path never builds and no pull can supply (they are published:false).+#+# Every case runs the real script against PATH stubs for docker/minikube/kubectl+# (same technique as scripts/tests/test-minikube-pull-images.sh), so nothing+# here needs a cluster or a network. The stubbed daemon's contents are declared+# per case, which is what makes these assertions fail on inverted LOGIC rather+# than on a renamed identifier: a case that expects clerum/* refs is run against+# a daemon that holds ONLY clerum/* refs, so checking the other mode's refs+# fails it.++REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"+GHCR_COMPONENT="$REPO_ROOT/deploy/components/ghcr-images/kustomization.yaml"++pass() { echo "PASS: $1"; }+fail() { echo "FAIL: $1"; FAIL=1; }++PIN_TAG="$(sed -n 's/^[[:space:]]*newTag:[[:space:]]*\([^[:space:]]*\)[[:space:]]*$/\1/p' "$GHCR_COMPONENT" | sort -u)"+if [ -z "$PIN_TAG" ] || [ "$(printf '%s\n' "$PIN_TAG" | wc -l | tr -d ' ')" != "1" ]; then+ echo "FAIL: could not read a single committed pin from $GHCR_COMPONENT (got '$PIN_TAG')"+ exit 1+fi++# The ref lists are derived from IMAGES/localRef/pullInGhcrMode -- deliberately+# NOT from minikubeVerifyRefs(), which is the function under test. Deriving the+# expectation from the implementation would make every case below tautological.+all_local_refs() {+ node -e '+ import("'"$REPO_ROOT"'/scripts/release/images-manifest.mjs").then(m => {+ for (const i of m.IMAGES) if (i.deployed_to_minikube) console.log(m.localRef(i))+ }).catch(e => { console.error(e.message); process.exit(1) })'+}++all_ghcr_refs() {+ node -e '+ import("'"$REPO_ROOT"'/scripts/release/images-manifest.mjs").then(m => {+ for (const i of m.pullInGhcrMode()) console.log(`ghcr.io/evenfire-ai/${i.name}:'"$PIN_TAG"'`)+ }).catch(e => { console.error(e.message); process.exit(1) })'+}++# The payload the stubbed `minikube image ls --format=json` serves. Each ref is+# listed under its plain and docker.io-prefixed spellings because+# minikube_image_id() normalises a ref before matching it.+write_present_json() {+ local out=$1 refs=$2+ printf '%s' "$refs" | node -e '+ const fs = require("node:fs")+ const refs = fs.readFileSync(0, "utf8").split("\n").map(s => s.trim()).filter(Boolean)+ const items = refs.map((ref, i) => ({+ id: `deadbeef${String(i).padStart(4, "0")}cafe`,+ repoTags: [ref, `docker.io/${ref}`, `docker.io/library/${ref}`],+ }))+ fs.writeFileSync(process.argv[1], JSON.stringify(items))+ ' "$out"+}++make_stubs() {+ local d=$1+ mkdir -p "$d/bin"+ cat > "$d/bin/minikube" <<'STUB'+#!/usr/bin/env bash+printf 'minikube %s\n' "$*" >>"${TEST_LOG_FILE:?}"+case "$*" in+ *docker-env*) echo 'export DOCKER_HOST="tcp://127.0.0.1:2376"'; exit 0 ;;+ *"image ls"*--format=json*) cat "${TEST_PRESENT_JSON:?}"; exit 0 ;;+esac+exit 0+STUB+ cat > "$d/bin/kubectl" <<'STUB'+#!/usr/bin/env bash+case "$*" in+ *"get nodes"*) echo "minikube Ready control-plane 1d v1.30.0"; exit 0 ;;+esac+exit 0+STUB+ cat > "$d/bin/docker" <<'STUB'+#!/usr/bin/env bash+printf '%s\n' "$*" >>"${TEST_LOG_FILE:?}"+case "${1:-}" in+ inspect) echo "sha256:deadbeef0000cafedeadbeef0000cafedeadbeef" ;;+ images) echo "sha256:deadbeef0000" ;;+esac+exit 0+STUB+ chmod +x "$d/bin/minikube" "$d/bin/kubectl" "$d/bin/docker"+}++# An isolated PROJECT_DIR that is a copy of the real repo's deploy/ + scripts/,+# so the script reads the REAL deploy/images.json and the REAL committed pin+# rather than a fixture that could drift from them.+prepare_repo() {+ local d=$1+ make_stubs "$d"+ mkdir -p "$d/repo"+ cp -R "$REPO_ROOT/deploy" "$d/repo/deploy"+ cp -R "$REPO_ROOT/scripts" "$d/repo/scripts"+ rm -rf "$d/repo/deploy/minikube"+}++# $2 is the newline-separated set of refs the stubbed daemon holds.+run_verify() {+ local d=$1 present=$2; shift 2+ write_present_json "$d/present.json" "$present"+ PATH="$d/bin:$PATH" \+ TEST_LOG_FILE="$d/ops.log" \+ TEST_PRESENT_JSON="$d/present.json" \+ bash "$d/repo/scripts/minikube/build-images.sh" --verify-only "$@" 2>&1+}++write_recorded_manifest() {+ local d=$1 body=$2+ mkdir -p "$d/repo/deploy/minikube"+ printf '%s' "$body" > "$d/repo/deploy/minikube/.image-manifest.json"+}++# ---------------------------------------------------------------------------+# FINDING A -- the mode comes from what the cluster actually holds+# ---------------------------------------------------------------------------++# The headline regression. IMAGE_SOURCE is unset, so the script's own default+# (ghcr) applies, and the daemon holds ONLY clerum/* refs -- exactly the state+# `make minikube-setup-local` leaves behind. Reading the env instead of the+# recorded mode reports every published image missing.+assert_a_recorded_local_build_is_verified_locally_despite_the_ghcr_default() {+ local d out rc+ d="$(mktemp -d)"+ prepare_repo "$d"+ write_recorded_manifest "$d" '{"generated":"x","profile":"clerum-test","imageSource":"local","images":{}}'+ out="$(run_verify "$d" "$(all_local_refs)")"; rc=$?+ if [ "$rc" -eq 0 ] \+ && grep -q 'clerum/control-api:test' <<< "$out" \+ && ! grep -q 'ghcr\.io/evenfire-ai/control-api' <<< "$out" \+ && grep -q 'All .* images present' <<< "$out"; then+ pass "a recorded local build is verified against clerum/* even with IMAGE_SOURCE unset"+ else+ fail "expected a clean local-mode verify (rc=0, clerum/ refs, no ghcr refs); got rc=$rc: $out"+ fi+ rm -rf "$d"+}++# The other direction, so the fix cannot be "always verify local refs": the+# daemon holds the ghcr refs (plus doc-generator-mcp, which is built locally on+# both paths) and IMAGE_SOURCE=local is explicitly in the environment.+assert_a_recorded_ghcr_pull_is_verified_against_ghcr_despite_a_local_env() {+ local d out rc present+ d="$(mktemp -d)"+ prepare_repo "$d"+ write_recorded_manifest "$d" '{"generated":"x","profile":"clerum-test","imageSource":"ghcr","images":{}}'+ present="$(all_ghcr_refs)"$'\n'"clerum/doc-generator-mcp:v1"+ out="$(IMAGE_SOURCE=local run_verify "$d" "$present")"; rc=$?+ if [ "$rc" -eq 0 ] \+ && grep -q "ghcr\.io/evenfire-ai/control-api:${PIN_TAG}" <<< "$out" \+ && ! grep -q 'clerum/control-api:test' <<< "$out"; then+ pass "a recorded ghcr pull is verified against ghcr refs even when IMAGE_SOURCE=local"+ else+ fail "expected a ghcr-mode verify (rc=0, ghcr refs, no clerum/control-api); got rc=$rc: $out"+ fi+ rm -rf "$d"+}++# Nothing has been built or pulled here yet, so there is no cluster state to+# read and the env var is the only signal left.+assert_the_env_is_the_fallback_when_no_manifest_exists() {+ local d out rc+ d="$(mktemp -d)"+ prepare_repo "$d"+ out="$(IMAGE_SOURCE=local run_verify "$d" "$(all_local_refs)")"; rc=$?+ if [ "$rc" -eq 0 ] && grep -q 'clerum/control-api:test' <<< "$out"; then+ pass "IMAGE_SOURCE is honoured when no image manifest exists"+ else+ fail "expected the env fallback to select local mode; got rc=$rc: $out"+ fi+ rm -rf "$d"+}++# A manifest written before this key existed, and a truncated one, must not+# abort the verify or silently pin the mode to a garbage value.+assert_a_manifest_with_no_usable_mode_falls_back_to_the_env() {+ local d out rc bad=""+ for body in \+ '{"generated":"x","profile":"clerum-test","images":{}}' \+ '{"generated":"x","imageSource":"gcr","images":{}}' \+ '{"generated": "truncated"'; do+ d="$(mktemp -d)"+ prepare_repo "$d"+ write_recorded_manifest "$d" "$body"+ out="$(IMAGE_SOURCE=local run_verify "$d" "$(all_local_refs)")"; rc=$?+ if [ "$rc" -ne 0 ] || ! grep -q 'clerum/control-api:test' <<< "$out"; then+ bad+="[$body -> rc=$rc] "+ fi+ rm -rf "$d"+ done+ if [ -z "$bad" ]; then+ pass "a manifest with no usable imageSource falls back to the env instead of failing"+ else+ fail "these manifests did not fall back cleanly: $bad"+ fi+}++# The remedy is part of the diagnostic. Telling a locally built cluster to pull+# replaces its clerum/*:test tags with release images.+assert_a_local_cluster_is_never_told_to_pull() {+ local d out rc present+ d="$(mktemp -d)"+ prepare_repo "$d"+ write_recorded_manifest "$d" '{"generated":"x","profile":"clerum-test","imageSource":"local","images":{}}'+ present="$(all_local_refs | grep -v '^clerum/control-api:test$')"+ out="$(run_verify "$d" "$present")"; rc=$?+ if [ "$rc" -ne 0 ] \+ && grep -q 'MISSING: clerum/control-api:test' <<< "$out" \+ && grep -q 'make minikube-build-images' <<< "$out" \+ && ! grep -q 'minikube-pull-images' <<< "$out"; then+ pass "a locally built cluster is told to rebuild, never to pull"+ else+ fail "expected a build remedy and no pull advice; got rc=$rc: $out"+ fi+ rm -rf "$d"+}++# The complement: a pulled cluster IS told to pull, and the tag it should pull+# is named (the pin can legitimately point at a tag that is not promoted yet).+assert_a_pulled_cluster_is_told_to_pull_at_the_named_tag() {+ local d out rc present+ d="$(mktemp -d)"+ prepare_repo "$d"+ write_recorded_manifest "$d" '{"generated":"x","profile":"clerum-test","imageSource":"ghcr","images":{}}'+ present="$(all_ghcr_refs | grep -v "^ghcr.io/evenfire-ai/control-api:${PIN_TAG}\$")"$'\n'"clerum/doc-generator-mcp:v1"+ out="$(run_verify "$d" "$present")"; rc=$?+ if [ "$rc" -ne 0 ] \+ && grep -q "MISSING: ghcr\.io/evenfire-ai/control-api:${PIN_TAG}" <<< "$out" \+ && grep -q 'minikube-pull-images' <<< "$out" \+ && grep -q "$PIN_TAG" <<< "$out"; then+ pass "a pulled cluster is told to pull, and the remedy names the tag"+ else+ fail "expected a pull remedy naming ${PIN_TAG}; got rc=$rc: $out"+ fi+ rm -rf "$d"+}++# ---------------------------------------------------------------------------+# FINDING A -- both writers record the mode+# ---------------------------------------------------------------------------++# End-to-end across the two scripts: the puller writes the manifest, the+# verifier reads it back. IMAGE_SOURCE=local is in the environment for the+# verify run, so a pass here can only come from the recorded value.+assert_the_puller_records_ghcr_and_the_verifier_reads_it_back() {+ local d out rc pull_rc present+ d="$(mktemp -d)"+ prepare_repo "$d"+ PATH="$d/bin:$PATH" TEST_LOG_FILE="$d/ops.log" \+ bash "$d/repo/scripts/minikube/pull-images.sh" >"$d/pull.out" 2>&1+ pull_rc=$?+ if [ "$pull_rc" -ne 0 ]; then+ fail "the stubbed pull run failed: $(cat "$d/pull.out")"; rm -rf "$d"; return 0+ fi+ present="$(all_ghcr_refs)"$'\n'"clerum/doc-generator-mcp:v1"+ out="$(IMAGE_SOURCE=local run_verify "$d" "$present")"; rc=$?+ if [ "$rc" -eq 0 ] && grep -q "ghcr\.io/evenfire-ai/control-api:${PIN_TAG}" <<< "$out"; then+ pass "pull-images.sh records ghcr and --verify-only verifies ghcr refs off it"+ else+ fail "after a pull, verify did not resolve ghcr mode; got rc=$rc: $out"+ fi+ rm -rf "$d"+}++# The build-side writer. The copied PROJECT_DIR has no service source trees, so+# every build_image call skips and only the manifest writer runs -- which is the+# part under test. IMAGE_SOURCE is left at its ghcr default to prove the writer+# records what it DID, not what the env says.+assert_a_full_build_records_local_and_the_verifier_reads_it_back() {+ local d build_rc out rc recorded+ d="$(mktemp -d)"+ prepare_repo "$d"+ write_present_json "$d/present.json" "$(all_local_refs)"+ PATH="$d/bin:$PATH" TEST_LOG_FILE="$d/ops.log" TEST_PRESENT_JSON="$d/present.json" \+ MINIKUBE_PRELOAD_BASE_IMAGES=false \+ bash "$d/repo/scripts/minikube/build-images.sh" --skip-public >"$d/build.out" 2>&1+ build_rc=$?+ if [ "$build_rc" -ne 0 ]; then+ fail "the stubbed full build failed: $(tail -20 "$d/build.out")"; rm -rf "$d"; return 0+ fi+ recorded="$(node -e '+ const j = require("node:fs").readFileSync(process.argv[1], "utf8")+ process.stdout.write(String(JSON.parse(j).imageSource))+ ' "$d/repo/deploy/minikube/.image-manifest.json" 2>&1)"+ out="$(run_verify "$d" "$(all_local_refs)")"; rc=$?+ if [ "$recorded" = "local" ] && [ "$rc" -eq 0 ] && grep -q 'clerum/control-api:test' <<< "$out"; then+ pass "a full build records imageSource=local and --verify-only verifies clerum/* off it"+ else+ fail "expected imageSource=local (got '$recorded') and a local-mode verify (rc=$rc): $out"+ fi+ rm -rf "$d"+}++# A partial build acquires a subset and must NOT redefine the mode:+# `make minikube-setup-e2e` runs two --only builds AFTER the ghcr pull, and+# `make minikube-setup` runs one BEFORE it.+assert_an_only_build_carries_the_recorded_mode_forward() {+ local d build_rc recorded+ d="$(mktemp -d)"+ prepare_repo "$d"+ write_recorded_manifest "$d" '{"generated":"x","profile":"clerum-test","imageSource":"ghcr","images":{}}'+ write_present_json "$d/present.json" "$(all_local_refs)"+ PATH="$d/bin:$PATH" TEST_LOG_FILE="$d/ops.log" TEST_PRESENT_JSON="$d/present.json" \+ MINIKUBE_PRELOAD_BASE_IMAGES=false \+ bash "$d/repo/scripts/minikube/build-images.sh" --only=workflow-custom-sdk-e2e \+ >"$d/build.out" 2>&1+ build_rc=$?+ if [ "$build_rc" -ne 0 ]; then+ fail "the stubbed --only build failed: $(tail -20 "$d/build.out")"; rm -rf "$d"; return 0+ fi+ recorded="$(node -e '+ const j = require("node:fs").readFileSync(process.argv[1], "utf8")+ process.stdout.write(String(JSON.parse(j).imageSource))+ ' "$d/repo/deploy/minikube/.image-manifest.json" 2>&1)"+ if [ "$recorded" = "ghcr" ]; then+ pass "an --only build preserves the recorded mode instead of claiming the cluster is local"+ else+ fail "an --only build rewrote imageSource to '$recorded'; a ghcr cluster would be verified as local"+ fi+ rm -rf "$d"+}++# ---------------------------------------------------------------------------+# FINDING B -- the E2E-only fixtures+# ---------------------------------------------------------------------------++# The exact reported reproduction: default ghcr setup, SEED_PROFILE=minimal, so+# the daemon has every pulled image plus doc-generator-mcp and NEITHER fixture.+# No pod references either fixture, and no pull could supply them+# (published:false), so demanding them is a lying diagnostic.+assert_the_default_ghcr_verify_passes_without_the_e2e_fixtures() {+ local d out rc present+ d="$(mktemp -d)"+ prepare_repo "$d"+ write_recorded_manifest "$d" '{"generated":"x","profile":"clerum-test","imageSource":"ghcr","images":{}}'+ present="$(all_ghcr_refs)"$'\n'"clerum/doc-generator-mcp:v1"+ out="$(run_verify "$d" "$present")"; rc=$?+ if [ "$rc" -eq 0 ] \+ && ! grep -q 'workflow-custom-sdk-e2e' <<< "$out" \+ && ! grep -q 'workflow-plugin-sdk-e2e' <<< "$out" \+ && grep -q 'clerum/doc-generator-mcp:v1' <<< "$out"; then+ pass "the default ghcr verify set omits the E2E fixtures and still checks doc-generator-mcp"+ else+ fail "expected a clean ghcr verify with no fixture refs but with doc-generator-mcp; got rc=$rc: $out"+ fi+ rm -rf "$d"+}++# The exclusion is an opt-out, not a deletion: after `make minikube-setup-e2e`+# (SEED_PROFILE=e2e) the fixtures ARE part of what the cluster runs, and a+# missing one must still be reported.+assert_the_e2e_seed_profile_puts_the_fixtures_back() {+ local d out rc present+ d="$(mktemp -d)"+ prepare_repo "$d"+ write_recorded_manifest "$d" '{"generated":"x","profile":"clerum-test","imageSource":"ghcr","images":{}}'+ present="$(all_ghcr_refs)"$'\n'"clerum/doc-generator-mcp:v1"+ out="$(MINIKUBE_SEED_PROFILE=e2e run_verify "$d" "$present")"; rc=$?+ if [ "$rc" -ne 0 ] \+ && grep -q 'MISSING: clerum/workflow-custom-sdk-e2e:test' <<< "$out" \+ && grep -q 'MISSING: clerum/workflow-plugin-sdk-e2e:test' <<< "$out"; then+ pass "MINIKUBE_SEED_PROFILE=e2e restores both fixtures to the ghcr verify set"+ else+ fail "expected both fixtures reported missing under SEED_PROFILE=e2e; got rc=$rc: $out"+ fi+ rm -rf "$d"+}++assert_the_include_flag_puts_the_fixtures_back() {+ local d out rc present+ d="$(mktemp -d)"+ prepare_repo "$d"+ write_recorded_manifest "$d" '{"generated":"x","profile":"clerum-test","imageSource":"ghcr","images":{}}'+ present="$(all_ghcr_refs)"$'\n'"clerum/doc-generator-mcp:v1"+ out="$(run_verify "$d" "$present" --include-e2e-fixtures)"; rc=$?+ if [ "$rc" -ne 0 ] && grep -q 'MISSING: clerum/workflow-custom-sdk-e2e:test' <<< "$out"; then+ pass "--include-e2e-fixtures restores the fixtures to the ghcr verify set"+ else+ fail "expected --include-e2e-fixtures to demand the fixtures; got rc=$rc: $out"+ fi+ rm -rf "$d"+}++# Local mode is NOT exempt: a full local build builds both fixtures, and+# origin/dev verified them. Dropping them there would lose real coverage.+assert_local_mode_still_demands_the_e2e_fixtures() {+ local d out rc present+ d="$(mktemp -d)"+ prepare_repo "$d"+ write_recorded_manifest "$d" '{"generated":"x","profile":"clerum-test","imageSource":"local","images":{}}'+ present="$(all_local_refs | grep -v 'sdk-e2e')"+ out="$(run_verify "$d" "$present")"; rc=$?+ if [ "$rc" -ne 0 ] \+ && grep -q 'MISSING: clerum/workflow-custom-sdk-e2e:test' <<< "$out" \+ && grep -q 'MISSING: clerum/workflow-plugin-sdk-e2e:test' <<< "$out"; then+ pass "local mode still verifies both E2E fixtures"+ else+ fail "expected local mode to report both fixtures missing; got rc=$rc: $out"+ fi+ rm -rf "$d"+}++# ---------------------------------------------------------------------------++# The verify set has to come from deploy/images.json through the one reader, not+# from a list hand-copied into the script. Adding a row to the copied manifest+# must change what the script demands; a hardcoded list would ignore it.+assert_the_verify_set_is_read_from_the_manifest_not_hardcoded() {+ local d out rc+ d="$(mktemp -d)"+ prepare_repo "$d"+ node -e '+ const fs = require("node:fs")+ const p = process.argv[1]+ const j = JSON.parse(fs.readFileSync(p, "utf8"))+ j.images.push({+ name: "synthetic-verify-probe",+ path: "tests/fixtures/synthetic",+ published: false,+ deployed_to_minikube: true,+ })+ fs.writeFileSync(p, JSON.stringify(j, null, 2))+ ' "$d/repo/deploy/images.json"+ # The daemon does NOT hold the probe, so a manifest-driven verify must fail+ # naming it. Present-but-ignored would be indistinguishable from a hardcoded+ # list.+ out="$(IMAGE_SOURCE=local run_verify "$d" "$(all_local_refs)")"; rc=$?+ if [ "$rc" -ne 0 ] && grep -q 'MISSING: clerum/synthetic-verify-probe:test' <<< "$out"; then+ pass "a row added to deploy/images.json changes what --verify-only demands"+ else+ fail "the verify set ignored a new manifest row; got rc=$rc: $out"+ fi+ rm -rf "$d"+}++# An empty verify set would make every case above pass vacuously.+assert_an_empty_verify_set_is_a_failure_not_a_pass() {+ local d out rc+ d="$(mktemp -d)"+ prepare_repo "$d"+ printf '{"images":[]}' > "$d/repo/deploy/images.json"+ out="$(IMAGE_SOURCE=local run_verify "$d" "clerum/control-api:test")"; rc=$?+ if [ "$rc" -ne 0 ] && grep -qi 'zero images to verify' <<< "$out"; then+ pass "an empty verify set fails loudly instead of reporting success"+ else+ fail "expected a hard failure on an empty verify set; got rc=$rc: $out"+ fi+ rm -rf "$d"+}++assert_every_defined_case_is_invoked() {+ local self defined invoked missing+ self="$REPO_ROOT/scripts/tests/test-minikube-verify-images.sh"+ defined="$(grep -oE '^assert_[a-z_]+\(\) \{' "$self" | sed -E 's/\(\) \{$//' | sort -u)"+ invoked="$(grep -oE '^assert_[a-z_]+$' "$self" | sort -u)"+ missing="$(comm -23 <(printf '%s\n' "$defined") <(printf '%s\n' "$invoked"))"+ if [ -z "$missing" ]; then+ pass "every defined assert_ case is invoked in the call block"+ else+ fail "defined but never invoked: $(printf '%s ' $missing)"+ fi+}++assert_a_recorded_local_build_is_verified_locally_despite_the_ghcr_default+assert_a_recorded_ghcr_pull_is_verified_against_ghcr_despite_a_local_env+assert_the_env_is_the_fallback_when_no_manifest_exists+assert_a_manifest_with_no_usable_mode_falls_back_to_the_env+assert_a_local_cluster_is_never_told_to_pull+assert_a_pulled_cluster_is_told_to_pull_at_the_named_tag+assert_the_puller_records_ghcr_and_the_verifier_reads_it_back+assert_a_full_build_records_local_and_the_verifier_reads_it_back+assert_an_only_build_carries_the_recorded_mode_forward+assert_the_default_ghcr_verify_passes_without_the_e2e_fixtures+assert_the_e2e_seed_profile_puts_the_fixtures_back+assert_the_include_flag_puts_the_fixtures_back+assert_local_mode_still_demands_the_e2e_fixtures+assert_the_verify_set_is_read_from_the_manifest_not_hardcoded+assert_an_empty_verify_set_is_a_failure_not_a_pass+assert_every_defined_case_is_invoked++exit $FAIL