Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
feat(ci): local-remote parity lanes — artifact-flow smoke, glibc floor, Defender-ON everywhere
Martin Vogel0a40fe8bea2a
diff --git a/.github/workflows/_build.yml b/.github/workflows/_build.ymlindex b7dfc6f23..72196f2f2 100644--- a/.github/workflows/_build.yml+++ b/.github/workflows/_build.yml@@ -79,15 +79,10 @@ jobs:if: startsWith(matrix.os, 'macos')run: codesign --sign - --force build/c/codebase-memory-mcp- - name: Archive standard binary- env:- GOOS: ${{ matrix.goos }}- GOARCH: ${{ matrix.goarch }}- run: |- cp LICENSE install.sh build/c/- scripts/gen-third-party-notices.sh build/c/THIRD_PARTY_NOTICES.md- tar -czf "codebase-memory-mcp-${GOOS}-${GOARCH}.tar.gz" \- -C build/c codebase-memory-mcp LICENSE install.sh THIRD_PARTY_NOTICES.md+ # Archive layout/name live in the ONE canonical script the local+ # artifact-flow smoke lane also runs (venue-parity contract).+ - name: Archive standard binary (canonical package-release.sh)+ run: scripts/package-release.sh ${{ matrix.goos }} ${{ matrix.goarch }}- name: Attest standard binary provenanceif: ${{ inputs.attest }}@@ -115,15 +110,8 @@ jobs:if: matrix.goos == 'linux' && matrix.goarch == 'amd64'run: scripts/security-ui.sh- - name: Archive UI binary- env:- GOOS: ${{ matrix.goos }}- GOARCH: ${{ matrix.goarch }}- run: |- cp LICENSE install.sh build/c/- scripts/gen-third-party-notices.sh build/c/THIRD_PARTY_NOTICES.md- tar -czf "codebase-memory-mcp-ui-${GOOS}-${GOARCH}.tar.gz" \- -C build/c codebase-memory-mcp LICENSE install.sh THIRD_PARTY_NOTICES.md+ - name: Archive UI binary (canonical package-release.sh)+ run: scripts/package-release.sh ${{ matrix.goos }} ${{ matrix.goarch }} --variant ui- name: Attest UI binary provenanceif: ${{ inputs.attest }}@@ -167,18 +155,11 @@ jobs:scripts/build.sh CC=clang CXX=clang++fi- - name: Archive standard binary+ # Archive layout/name live in the ONE canonical script the local+ # artifact-flow smoke lane also runs (venue-parity contract).+ - name: Archive standard binary (canonical package-release.sh)shell: msys2 {0}- run: |- make -f Makefile.cbm build/c/codebase-memory-mcp-launcher.exe CC=clang CXX=clang++- PAYLOAD=build/c/codebase-memory-mcp- [ -f "${PAYLOAD}.exe" ] && PAYLOAD="${PAYLOAD}.exe"- cp build/c/codebase-memory-mcp-launcher.exe codebase-memory-mcp.exe- cp "$PAYLOAD" codebase-memory-mcp.payload.exe- scripts/gen-third-party-notices.sh THIRD_PARTY_NOTICES.md- zip codebase-memory-mcp-windows-amd64.zip \- codebase-memory-mcp.exe codebase-memory-mcp.payload.exe \- LICENSE install.ps1 THIRD_PARTY_NOTICES.md+ run: scripts/package-release.sh windows amd64 CC=clang CXX=clang++- name: Attest standard binary provenanceif: ${{ inputs.attest }}@@ -197,18 +178,9 @@ jobs:scripts/build.sh --with-ui CC=clang CXX=clang++fi- - name: Archive UI binary+ - name: Archive UI binary (canonical package-release.sh)shell: msys2 {0}- run: |- make -f Makefile.cbm build/c/codebase-memory-mcp-launcher.exe CC=clang CXX=clang++- PAYLOAD=build/c/codebase-memory-mcp- [ -f "${PAYLOAD}.exe" ] && PAYLOAD="${PAYLOAD}.exe"- cp build/c/codebase-memory-mcp-launcher.exe codebase-memory-mcp.exe- cp "$PAYLOAD" codebase-memory-mcp.payload.exe- scripts/gen-third-party-notices.sh THIRD_PARTY_NOTICES.md- zip codebase-memory-mcp-ui-windows-amd64.zip \- codebase-memory-mcp.exe codebase-memory-mcp.payload.exe \- LICENSE install.ps1 THIRD_PARTY_NOTICES.md+ run: scripts/package-release.sh windows amd64 --variant ui CC=clang CXX=clang++- name: Attest UI binary provenanceif: ${{ inputs.attest }}@@ -256,18 +228,9 @@ jobs:scripts/build.sh CC=clang CXX=clang++fi- - name: Archive standard binary+ - name: Archive standard binary (canonical package-release.sh)shell: msys2 {0}- run: |- make -f Makefile.cbm build/c/codebase-memory-mcp-launcher.exe CC=clang CXX=clang++- PAYLOAD=build/c/codebase-memory-mcp- [ -f "${PAYLOAD}.exe" ] && PAYLOAD="${PAYLOAD}.exe"- cp build/c/codebase-memory-mcp-launcher.exe codebase-memory-mcp.exe- cp "$PAYLOAD" codebase-memory-mcp.payload.exe- scripts/gen-third-party-notices.sh THIRD_PARTY_NOTICES.md- zip codebase-memory-mcp-windows-arm64.zip \- codebase-memory-mcp.exe codebase-memory-mcp.payload.exe \- LICENSE install.ps1 THIRD_PARTY_NOTICES.md+ run: scripts/package-release.sh windows arm64 CC=clang CXX=clang++- name: Attest standard binary provenanceif: ${{ inputs.attest }}@@ -286,18 +249,9 @@ jobs:scripts/build.sh --with-ui CC=clang CXX=clang++fi- - name: Archive UI binary+ - name: Archive UI binary (canonical package-release.sh)shell: msys2 {0}- run: |- make -f Makefile.cbm build/c/codebase-memory-mcp-launcher.exe CC=clang CXX=clang++- PAYLOAD=build/c/codebase-memory-mcp- [ -f "${PAYLOAD}.exe" ] && PAYLOAD="${PAYLOAD}.exe"- cp build/c/codebase-memory-mcp-launcher.exe codebase-memory-mcp.exe- cp "$PAYLOAD" codebase-memory-mcp.payload.exe- scripts/gen-third-party-notices.sh THIRD_PARTY_NOTICES.md- zip codebase-memory-mcp-ui-windows-arm64.zip \- codebase-memory-mcp.exe codebase-memory-mcp.payload.exe \- LICENSE install.ps1 THIRD_PARTY_NOTICES.md+ run: scripts/package-release.sh windows arm64 --variant ui CC=clang CXX=clang++- name: Attest UI binary provenanceif: ${{ inputs.attest }}@@ -348,14 +302,8 @@ jobs:file build/c/codebase-memory-mcpldd build/c/codebase-memory-mcp 2>&1 | grep -q "not a dynamic executable" || ldd build/c/codebase-memory-mcp 2>&1 | grep -q "statically linked"- - name: Archive standard binary- env:- ARCH: ${{ matrix.arch }}- run: |- cp LICENSE install.sh build/c/- scripts/gen-third-party-notices.sh build/c/THIRD_PARTY_NOTICES.md- tar -czf "codebase-memory-mcp-linux-${ARCH}-portable.tar.gz" \- -C build/c codebase-memory-mcp LICENSE install.sh THIRD_PARTY_NOTICES.md+ - name: Archive standard binary (canonical package-release.sh)+ run: scripts/package-release.sh linux ${{ matrix.arch }}-portable- name: Attest standard binary provenanceif: ${{ inputs.attest }}@@ -373,14 +321,8 @@ jobs:scripts/build.sh --with-ui CC=gcc CXX=g++ STATIC=1fi- - name: Archive UI binary- env:- ARCH: ${{ matrix.arch }}- run: |- cp LICENSE install.sh build/c/- scripts/gen-third-party-notices.sh build/c/THIRD_PARTY_NOTICES.md- tar -czf "codebase-memory-mcp-ui-linux-${ARCH}-portable.tar.gz" \- -C build/c codebase-memory-mcp LICENSE install.sh THIRD_PARTY_NOTICES.md+ - name: Archive UI binary (canonical package-release.sh)+ run: scripts/package-release.sh linux ${{ matrix.arch }}-portable --variant ui- name: Attest UI binary provenanceif: ${{ inputs.attest }}diff --git a/.github/workflows/_smoke.yml b/.github/workflows/_smoke.ymlindex 1ef35f101..98781f144 100644--- a/.github/workflows/_smoke.yml+++ b/.github/workflows/_smoke.yml@@ -172,6 +172,10 @@ jobs:steps:- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0+ - name: Ensure Windows Defender is active (venue parity)+ shell: pwsh+ run: scripts/ci/ensure-defender.ps1+- uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2with:msystem: ${{ matrix.arch == 'arm64' && 'CLANGARM64' || 'CLANG64' }}@@ -254,7 +258,9 @@ jobs:if ($code -eq 2) {Write-Host "BLOCKED: Windows Defender flagged $binary!"; exit 1} elseif ($code -ne 0) {- Write-Host "::warning::Windows Defender scan could not run for $binary (exit $code) - skipping AV gate on this runner"+ # ensure-defender gates this job earlier, so the engine MUST be+ # available here: an engine failure is a red gate, never a skip.+ Write-Host "BLOCKED: Defender scan engine could not run for $binary (exit $code) - Defender-ON parity violated"; exit 1} else {Write-Host "=== Windows Defender: $binary clean ==="}diff --git a/.github/workflows/_soak.yml b/.github/workflows/_soak.ymlindex 7c1ed16f3..5ce37ce44 100644--- a/.github/workflows/_soak.yml+++ b/.github/workflows/_soak.yml@@ -92,6 +92,10 @@ jobs:timeout-minutes: 560steps:- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0++ - name: Ensure Windows Defender is active (venue parity)+ shell: pwsh+ run: scripts/ci/ensure-defender.ps1- uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2with:msystem: CLANG64@@ -148,6 +152,10 @@ jobs:timeout-minutes: 560steps:- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0++ - name: Ensure Windows Defender is active (venue parity)+ shell: pwsh+ run: scripts/ci/ensure-defender.ps1- uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2with:msystem: CLANGARM64@@ -262,6 +270,10 @@ jobs:timeout-minutes: 240steps:- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0++ - name: Ensure Windows Defender is active (venue parity)+ shell: pwsh+ run: scripts/ci/ensure-defender.ps1- uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2with:msystem: CLANG64diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.ymlindex 270e541f4..2cd90cfe4 100644--- a/.github/workflows/_test.yml+++ b/.github/workflows/_test.yml@@ -247,6 +247,12 @@ jobs:steps:- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0+ # Defender parity: every Windows venue (local VM and runner alike) tests+ # with real-time protection ACTIVE — enabled + verified, never skipped.+ - name: Ensure Windows Defender is active (venue parity)+ shell: pwsh+ run: scripts/ci/ensure-defender.ps1+- uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2with:msystem: ${{ matrix.msystem }}@@ -375,6 +381,10 @@ jobs:steps:- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0+ - name: Ensure Windows Defender is active (venue parity)+ shell: pwsh+ run: scripts/ci/ensure-defender.ps1+- uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2with:msystem: CLANG64diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.ymlindex 5a05399c5..0fa95567b 100644--- a/.github/workflows/pr.yml+++ b/.github/workflows/pr.yml@@ -84,6 +84,11 @@ jobs:steps:- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0+ - name: Ensure Windows Defender is active (venue parity)+ if: matrix.os == 'windows-latest'+ shell: pwsh+ run: scripts/ci/ensure-defender.ps1+- name: Install deps (Ubuntu)if: matrix.os == 'ubuntu-latest'run: sudo apt-get update && sudo apt-get install -y zlib1g-dev ccachediff --git a/scripts/ci/ensure-defender.ps1 b/scripts/ci/ensure-defender.ps1new file mode 100644index 000000000..0aba3e4f0--- /dev/null+++ b/scripts/ci/ensure-defender.ps1@@ -0,0 +1,59 @@+# ensure-defender.ps1 — Windows Defender real-time protection must be ACTIVE+# on every Windows venue: the local test VM and every GitHub Windows runner+# alike. The AV interaction surface (file locks on fresh binaries, scan-on-+# first-execute latency, quarantine behavior) is part of what the Windows legs+# test; a venue with Defender off is testing a different operating system.+#+# GitHub's runner images ship with Defender disabled, so this script ENABLES+# it, then VERIFIES it is actually running — and fails closed if it cannot be+# made active. No silent skip: a leg that cannot get Defender on must go red,+# not quietly measure the wrong environment. (Same doctrine as the smoke+# no-skip rules: a gate that can be skipped is not a gate.)+#+# Canonical entry: local VM preflight (win.sh) and the Windows CI jobs all run+# THIS file — venue parity by construction.++$ErrorActionPreference = 'Stop'++function Try-Step {+ param([string]$What, [scriptblock]$Action)+ try {+ & $Action+ Write-Host "ensure-defender: $What - ok"+ } catch {+ # Individual enable steps may legitimately no-op (already enabled,+ # service already running); only the final verification gates.+ Write-Host "ensure-defender: $What - $($_.Exception.Message)"+ }+}++Try-Step "WinDefend service startup type" {+ Set-Service -Name WinDefend -StartupType Automatic+}+Try-Step "WinDefend service start" {+ Start-Service -Name WinDefend+}+Try-Step "enable real-time monitoring" {+ Set-MpPreference -DisableRealtimeMonitoring $false+}++$status = $null+try {+ $status = Get-MpComputerStatus+} catch {+ Write-Host "ensure-defender: FAIL - Defender engine unavailable: $($_.Exception.Message)"+ exit 1+}++if (-not $status.AntivirusEnabled) {+ Write-Host "ensure-defender: FAIL - antivirus engine is not enabled on this venue"+ exit 1+}+if (-not $status.RealTimeProtectionEnabled) {+ Write-Host "ensure-defender: FAIL - real-time protection is OFF and could not be enabled"+ exit 1+}++Write-Host ("=== ensure-defender: ACTIVE (engine {0}, signatures {1}, RTP on) ===" -f `+ $status.AMEngineVersion, $status.AntivirusSignatureVersion)+exit 0diff --git a/scripts/ci/smoke-artifact.sh b/scripts/ci/smoke-artifact.shnew file mode 100644index 000000000..6f9cf81de--- /dev/null+++ b/scripts/ci/smoke-artifact.sh@@ -0,0 +1,119 @@+#!/usr/bin/env bash+# smoke-artifact.sh — the local ARTIFACT-FLOW smoke lane. The release venue+# smokes the shipped archive (download → extract → canonical wrapper); before+# this lane existed, local CI only ever smoked source builds, so the whole+# packaging/archive-layout bug class could first appear in a release dry run.+#+# This driver reproduces the release flow end to end with local bytes:+# scripts/build.sh → scripts/package-release.sh → extract →+# the SAME canonical wrapper the remote venue runs, in artifact mode+# (CBM_SMOKE_ARTIFACT_DIR), whose completeness checks make a broken or+# incomplete archive a loud failure.++set -euo pipefail++ROOT="$(cd "$(dirname "$0")/../.." && pwd)"+cd "$ROOT"++usage() {+ cat <<'EOF'+Usage: scripts/ci/smoke-artifact.sh <goos> <goarch> [--variant standard|ui]+ [VAR=VAL ...]++Build → package (scripts/package-release.sh) → extract → smoke the EXTRACTED+artifact through the canonical wrapper, exactly like the release venue:+ unix: scripts/smoke-local.sh with CBM_SMOKE_ARTIFACT_DIR+ windows: test-infrastructure/vm/vm-smoke.sh with CBM_SMOKE_ARTIFACT_DIR+ (run inside the VM/CI msys2 shell)++ --variant ui builds --with-ui and smokes the ui archive (Phase 15 embedded+ assets become mandatory — a standard binary cannot pass a ui run).++Make passthrough (VAR=VAL): CC= CXX= STATIC=1 ... forwarded to build steps.+Environment: BUILD_DIR (default build/c) — build tree used for the archive.+On failure the work directory is preserved for post-mortem (path printed).+EOF+}++GOOS=""+GOARCH=""+VARIANT="standard"+BUILD_ARGS=()+expect_value=""+for arg in "$@"; do+ if [ "$expect_value" = "variant" ]; then+ VARIANT="$arg"; expect_value=""; continue+ fi+ case "$arg" in+ -h | --help) usage; exit 0 ;;+ --variant) expect_value="variant" ;;+ --variant=*) VARIANT="${arg#--variant=}" ;;+ -*)+ echo "smoke-artifact: unknown option '$arg'. Please consult --help." >&2+ exit 2+ ;;+ *=*) BUILD_ARGS+=("$arg") ;;+ *)+ if [ -z "$GOOS" ]; then GOOS="$arg"+ elif [ -z "$GOARCH" ]; then GOARCH="$arg"+ else+ echo "smoke-artifact: unexpected argument '$arg'. Please consult --help." >&2+ exit 2+ fi+ ;;+ esac+done+[ -n "$GOOS" ] && [ -n "$GOARCH" ] || { usage >&2; exit 2; }+case "$VARIANT" in+standard) SUFFIX=""; UI_FLAG=() ;;+ui) SUFFIX="-ui"; UI_FLAG=(--with-ui) ;;+*) echo "smoke-artifact: variant must be 'standard' or 'ui'. Please consult --help." >&2; exit 2 ;;+esac+case "$GOARCH" in+*-portable) BUILD_ARGS+=("STATIC=1") ;;+esac++BUILD_DIR="${BUILD_DIR:-build/c}"+export BUILD_DIR++scripts/build.sh ${UI_FLAG[@]+"${UI_FLAG[@]}"} \+ BUILD_DIR="$BUILD_DIR" ${BUILD_ARGS[@]+"${BUILD_ARGS[@]}"}+if [ "$GOOS" = "darwin" ]; then+ codesign --sign - --force "$BUILD_DIR/codebase-memory-mcp"+fi++WORK_DIR="$(mktemp -d "${TMPDIR:-/tmp}/cbm-smoke-artifact.XXXXXX")"+cleanup() {+ local status=$?+ trap - EXIT+ if [ "$status" -eq 0 ]; then+ rm -rf "$WORK_DIR"+ else+ echo "smoke-artifact: preserved failed lane root at $WORK_DIR" >&2+ fi+ exit "$status"+}+trap cleanup EXIT++scripts/package-release.sh "$GOOS" "$GOARCH" --variant "$VARIANT" \+ --out-dir "$WORK_DIR" ${BUILD_ARGS[@]+"${BUILD_ARGS[@]}"}++NAME="codebase-memory-mcp${SUFFIX}-${GOOS}-${GOARCH}"+EXTRACT_DIR="$WORK_DIR/extract"+mkdir -p "$EXTRACT_DIR"+if [ "$GOOS" = "windows" ]; then+ unzip -q -o "$WORK_DIR/$NAME.zip" -d "$EXTRACT_DIR"+ test -s "$EXTRACT_DIR/codebase-memory-mcp.exe"+ test -s "$EXTRACT_DIR/codebase-memory-mcp.payload.exe"+ echo "=== smoke-artifact: smoking EXTRACTED $NAME.zip via vm-smoke.sh ==="+ SMOKE_ARCH="$GOARCH" SMOKE_VARIANT="$VARIANT" \+ CBM_SMOKE_ARTIFACT_DIR="$EXTRACT_DIR" \+ bash test-infrastructure/vm/vm-smoke.sh+else+ tar -xzf "$WORK_DIR/$NAME.tar.gz" -C "$EXTRACT_DIR"+ chmod +x "$EXTRACT_DIR/codebase-memory-mcp"+ echo "=== smoke-artifact: smoking EXTRACTED $NAME.tar.gz via smoke-local.sh ==="+ CBM_SMOKE_ARTIFACT_DIR="$EXTRACT_DIR" \+ scripts/smoke-local.sh "$EXTRACT_DIR/codebase-memory-mcp" "$VARIANT"+fi+echo "=== smoke-artifact: $NAME passed ==="diff --git a/scripts/package-release.sh b/scripts/package-release.shnew file mode 100644index 000000000..eb349ad73--- /dev/null+++ b/scripts/package-release.sh@@ -0,0 +1,124 @@+#!/usr/bin/env bash+# package-release.sh — THE canonical release-archive step. Every venue that+# turns built binaries into a release archive (release/_build.yml, the local+# artifact-flow smoke lane) runs this file; workflows provide only+# checkout/toolchain/upload around it. Archive names and contents are defined+# HERE, nowhere else, so a local artifact smoke provably exercises the same+# bytes-layout the release publishes.+#+# This script ARCHIVES what scripts/build.sh already produced — it never+# builds the product itself (the Windows launcher image is the one deliberate+# exception: it is part of the archive, not of the product build).++set -euo pipefail++ROOT="$(cd "$(dirname "$0")/.." && pwd)"+cd "$ROOT"++usage() {+ cat <<'EOF'+Usage: scripts/package-release.sh <goos> <goarch> [--variant standard|ui]+ [--out-dir DIR] [VAR=VAL ...]++The canonical release-archive step: identical in the release build and the+local artifact-flow smoke lane.++ goos linux | darwin | windows+ goarch arch label used verbatim in the archive name (amd64, arm64,+ arm64-portable, ...)+ --variant standard (default) | ui — selects the archive NAME prefix; the+ matching binary must already have been built (--with-ui for ui).+ --out-dir where to place the archive (default: repository root).++Make passthrough (VAR=VAL, forwarded to the Windows launcher build):+ CC= CXX= compiler override, e.g. CC=clang CXX=clang++.++Environment:+ BUILD_DIR build tree to archive from (default build/c).++Archive contents (defined here, canonical):+ unix: codebase-memory-mcp LICENSE install.sh THIRD_PARTY_NOTICES.md (.tar.gz)+ windows: codebase-memory-mcp.exe (launcher) codebase-memory-mcp.payload.exe+ LICENSE install.ps1 THIRD_PARTY_NOTICES.md (.zip)+EOF+}++GOOS=""+GOARCH=""+VARIANT="standard"+OUT_DIR="$ROOT"+MAKE_ARGS=()+expect_value=""+for arg in "$@"; do+ case "$expect_value" in+ variant) VARIANT="$arg"; expect_value=""; continue ;;+ out-dir) OUT_DIR="$arg"; expect_value=""; continue ;;+ esac+ case "$arg" in+ -h | --help) usage; exit 0 ;;+ --variant) expect_value="variant" ;;+ --variant=*) VARIANT="${arg#--variant=}" ;;+ --out-dir) expect_value="out-dir" ;;+ --out-dir=*) OUT_DIR="${arg#--out-dir=}" ;;+ -*)+ echo "package-release: unknown option '$arg'. Please consult --help." >&2+ exit 2+ ;;+ *=*) MAKE_ARGS+=("$arg") ;;+ *)+ if [ -z "$GOOS" ]; then GOOS="$arg"+ elif [ -z "$GOARCH" ]; then GOARCH="$arg"+ else+ echo "package-release: unexpected argument '$arg'. Please consult --help." >&2+ exit 2+ fi+ ;;+ esac+done+[ -n "$GOOS" ] && [ -n "$GOARCH" ] || { usage >&2; exit 2; }+case "$GOOS" in+linux | darwin | windows) ;;+*) echo "package-release: goos must be linux, darwin or windows." >&2; exit 2 ;;+esac+case "$VARIANT" in+standard) SUFFIX="" ;;+ui) SUFFIX="-ui" ;;+*) echo "package-release: variant must be 'standard' or 'ui'." >&2; exit 2 ;;+esac+[ -n "$expect_value" ] && { echo "package-release: --$expect_value needs a value." >&2; exit 2; }++BUILD_DIR="${BUILD_DIR:-build/c}"+OUT_DIR="$(mkdir -p "$OUT_DIR" && cd "$OUT_DIR" && pwd)"+NAME="codebase-memory-mcp${SUFFIX}-${GOOS}-${GOARCH}"++if [ "$GOOS" = "windows" ]; then+ # The launcher is part of the ARCHIVE layout (launcher fronts the payload),+ # so it is built here, exactly as the release venue does.+ make -f Makefile.cbm "$BUILD_DIR/codebase-memory-mcp-launcher.exe" \+ BUILD_DIR="$BUILD_DIR" ${MAKE_ARGS[@]+"${MAKE_ARGS[@]}"}+ PAYLOAD="$BUILD_DIR/codebase-memory-mcp"+ [ -f "${PAYLOAD}.exe" ] && PAYLOAD="${PAYLOAD}.exe"+ [ -f "$PAYLOAD" ] || { echo "package-release: build first; missing $PAYLOAD" >&2; exit 2; }+ PACK_DIR="$(mktemp -d "${TMPDIR:-/tmp}/cbm-package.XXXXXX")"+ trap 'rm -rf "$PACK_DIR"' EXIT+ cp "$BUILD_DIR/codebase-memory-mcp-launcher.exe" "$PACK_DIR/codebase-memory-mcp.exe"+ cp "$PAYLOAD" "$PACK_DIR/codebase-memory-mcp.payload.exe"+ cp LICENSE install.ps1 "$PACK_DIR/"+ scripts/gen-third-party-notices.sh "$PACK_DIR/THIRD_PARTY_NOTICES.md"+ (+ cd "$PACK_DIR"+ rm -f "$OUT_DIR/$NAME.zip"+ zip -q "$OUT_DIR/$NAME.zip" \+ codebase-memory-mcp.exe codebase-memory-mcp.payload.exe \+ LICENSE install.ps1 THIRD_PARTY_NOTICES.md+ )+ echo "=== package-release: $OUT_DIR/$NAME.zip ==="+else+ [ -f "$BUILD_DIR/codebase-memory-mcp" ] ||+ { echo "package-release: build first; missing $BUILD_DIR/codebase-memory-mcp" >&2; exit 2; }+ cp LICENSE install.sh "$BUILD_DIR/"+ scripts/gen-third-party-notices.sh "$BUILD_DIR/THIRD_PARTY_NOTICES.md"+ tar -czf "$OUT_DIR/$NAME.tar.gz" -C "$BUILD_DIR" \+ codebase-memory-mcp LICENSE install.sh THIRD_PARTY_NOTICES.md+ echo "=== package-release: $OUT_DIR/$NAME.tar.gz ==="+fidiff --git a/test-infrastructure/Dockerfile.glibc22 b/test-infrastructure/Dockerfile.glibc22new file mode 100644index 000000000..131bbff7c--- /dev/null+++ b/test-infrastructure/Dockerfile.glibc22@@ -0,0 +1,24 @@+# Dockerfile.glibc22 — the glibc-FLOOR venue (ubuntu-22.04, glibc 2.35).+#+# Mirrors CI's broad-matrix ubuntu-22.04 legs: the OLDEST userland we claim+# the portable (musl-static) binary runs on. Two assertions live here:+# 1. the portable binary passes the full canonical smoke on glibc 2.35;+# 2. the DYNAMIC binary refuses to start (its glibc 2.38+ floor is by+# design — old-glibc coverage is the portable binary's job, and a+# dynamic binary that silently ran here would mask a floor regression).+FROM ubuntu:22.04++RUN apt-get update && apt-get install -y --no-install-recommends \+ bash \+ ca-certificates \+ coreutils \+ curl \+ file \+ git \+ python3 \+ tar \+ zlib1g \+ && rm -rf /var/lib/apt/lists/*++WORKDIR /src+ENTRYPOINT ["bash"]diff --git a/test-infrastructure/docker-compose.yml b/test-infrastructure/docker-compose.ymlindex 600abbbc1..b4d4e04a4 100644--- a/test-infrastructure/docker-compose.yml+++ b/test-infrastructure/docker-compose.yml@@ -239,6 +239,49 @@ services:echo "=== Verified: statically linked ===" &&scripts/smoke-local.sh ./build/alpine/codebase-memory-mcp+ # ── Artifact-flow smoke (package → extract → wrapper) ──────+ # The release venue smokes the shipped archive; this lane reproduces that+ # flow with local bytes via the canonical package-release.sh ++ # smoke-local.sh artifact mode, so archive-layout bugs surface locally.+ smoke-artifact:+ build:+ context: ..+ dockerfile: test-infrastructure/Dockerfile+ platform: linux/arm64+ volumes:+ - ..:/src+ entrypoint: ["/bin/bash", "-c"]+ command:+ - |+ BUILD_DIR=build/linux-arm64 \+ scripts/ci/smoke-artifact.sh linux arm64 CC=gcc CXX=g++++ # ── glibc floor (ubuntu-22.04, glibc 2.35) ─────────────────+ # Mirrors CI's broad-matrix 22.04 legs: the portable (musl-static) binary+ # must pass the canonical smoke on the oldest supported userland, and the+ # dynamic binary must REFUSE to start (glibc 2.38+ floor is by design).+ smoke-glibc-floor:+ build:+ context: ..+ dockerfile: test-infrastructure/Dockerfile.glibc22+ platform: linux/arm64+ volumes:+ - ..:/src+ entrypoint: ["/bin/bash", "-c"]+ command:+ - |+ set -e+ file build/alpine/codebase-memory-mcp | grep -q "statically linked"+ echo "=== glibc-floor: portable binary smoke on glibc 2.35 ==="+ scripts/smoke-local.sh ./build/alpine/codebase-memory-mcp+ echo "=== glibc-floor: dynamic binary must refuse (glibc 2.38+ floor) ==="+ if build/linux-arm64/codebase-memory-mcp --version 2>/tmp/dynamic-floor.err; then+ echo "ERROR: dynamic binary ran on glibc 2.35 — floor contract broken"+ exit 1+ fi+ grep -qi 'GLIBC' /tmp/dynamic-floor.err+ echo "=== Verified: dynamic binary refuses with a GLIBC floor error ==="+# ── Lint ────────────────────────────────────────────────────lint:build:diff --git a/test-infrastructure/run.sh b/test-infrastructure/run.shindex e15e0fa87..ade190935 100755--- a/test-infrastructure/run.sh+++ b/test-infrastructure/run.sh@@ -77,6 +77,8 @@ Legs:perf arm64 incremental-perf leg (CBM_SKIP_PERF unset)shell|shell-alpine interactive debug shell inside the imageportable|portable-test Alpine musl static build legs+ smoke-artifact arm64 artifact-flow smoke: package -> extract -> wrapper+ glibc-floor ubuntu-22.04 (glibc 2.35): portable smoke + dynamic refusalsoak-linux both CI soak legs (quick + #581 query-leak) viascripts/soak-legs.sh; CBM_SOAK_MINUTES per leg (default 10)soak-windows delegates to the real-Windows VM (win.sh soak 10)@@ -140,6 +142,10 @@ case "${1:-full}" in$COMPOSE run --rm smokeecho "=== Linux portable: Alpine static build + smoke ==="$COMPOSE run --rm smoke-portable+ echo "=== Linux arm64: artifact-flow smoke ==="+ $COMPOSE run --rm smoke-artifact+ echo "=== Linux glibc-floor (ubuntu-22.04): portable smoke + dynamic refusal ==="+ $COMPOSE run --rm smoke-glibc-floorecho "=== Windows: cross-compile ==="$COMPOSE run --rm build-windowsprint_real_windows_gate@@ -185,6 +191,16 @@ case "${1:-full}" inecho "=== Linux portable: Alpine static build + smoke ==="$COMPOSE run --rm smoke-portable;;+ smoke-artifact)+ echo "=== Linux arm64: artifact-flow smoke (package -> extract -> wrapper) ==="+ $COMPOSE run --rm smoke-artifact+ ;;+ glibc-floor)+ echo "=== Linux glibc-floor (ubuntu-22.04): portable smoke + dynamic refusal ==="+ $COMPOSE run --rm build+ $COMPOSE run --rm build-portable+ $COMPOSE run --rm smoke-glibc-floor+ ;;portable-test)echo "=== Linux portable: Alpine test (ASan + LeakSan) ==="$COMPOSE run --rm -e CBM_SKIP_PERF=1 test-portable@@ -213,6 +229,10 @@ case "${1:-full}" in# run it with `run.sh tsan-amd64` on real amd64. GitHub CI gates it.echo "=== Linux portable: Alpine static build + smoke ==="$COMPOSE run --rm smoke-portable+ echo "=== Linux arm64: artifact-flow smoke ==="+ $COMPOSE run --rm smoke-artifact+ echo "=== Linux glibc-floor (ubuntu-22.04): portable smoke + dynamic refusal ==="+ $COMPOSE run --rm smoke-glibc-floorecho "=== Linux amd64: test + build + smoke ==="$COMPOSE run --rm -e CBM_SKIP_PERF=1 test-amd64$COMPOSE run --rm build-amd64diff --git a/test-infrastructure/vm/README.md b/test-infrastructure/vm/README.mdindex 4551501bf..12510b223 100644--- a/test-infrastructure/vm/README.md+++ b/test-infrastructure/vm/README.md@@ -110,3 +110,23 @@ cleans stale build outputs, and rebuilds.- VM results complement, never replace, the CI matrix on the final SHA.- Everything runs over the local UTM/host network only — nothing about theVM loop touches the internet except the VM's own package/repo downloads.++## Ephemerality & Defender posture (venue parity)++A GitHub runner is ephemeral (fresh image, known-free disk, every job); this+VM is long-lived. The gap is closed by construction where possible and+documented honestly where not:++- **Preflight, every venue-grade command:** `clean-test-residue.ps1` sweeps+ temp roots/staged binaries and asserts a runner-like free-disk floor, then+ `scripts/ci/ensure-defender.ps1` (the SAME script every Windows CI job runs)+ enables + verifies Defender real-time protection. Defender posture is+ matched ON on all venues — the runners enable it too; a venue where it+ cannot be activated goes red, never silently tests a different OS shape.+- **Snapshot-revert is NOT scriptable via utmctl** (its verb set is+ version/list/status/start/suspend/stop — no snapshot support), so per-run+ revert-to-clean is not wired. The honest fallback is the sweep preflight+ above. Opt-in alternative for a truly fresh start: shut the VM down and+ manage qcow2 snapshots of the .utm disk offline (`qemu-img snapshot`) —+ DESTRUCTIVE to VM state, so it is a deliberate manual step, never part of+ the automated loop. `provision-windows.sh` remains the one-command rebuild.diff --git a/test-infrastructure/vm/win.sh b/test-infrastructure/vm/win.shindex 6d9d781d5..ed9179a49 100755--- a/test-infrastructure/vm/win.sh+++ b/test-infrastructure/vm/win.sh@@ -13,6 +13,7 @@# win.sh test <suite...> # run test-runner suites (native ARM64)# win.sh guards # clean UI product build + Windows guards# win.sh smoke-install # real managed-install E2E (Phase 8 class)+# win.sh smoke-artifact # release-archive flow (package+extract+smoke)# win.sh soak [minutes] # both CI soak legs: quick + #581 query-leak# win.sh sh <command...> # arbitrary command in CLANGARM64 env# win.sh push-file <local> <vm> # scp one file into the VM (WIP iteration)@@ -48,6 +49,8 @@ Commands (venue-grade — canonical entries, preflight enforced):guards clean UI product build + Windows guard suite (CI shape)smoke-install scripts/build.sh + vm-smoke.sh — exactly PR CI'swindows smoke job+ smoke-artifact package-release.sh → extract → vm-smoke.sh artifact+ mode — the release archive flow with local bytessoak [minutes] both CI soak legs via scripts/soak-legs.sh (default 10)Sanitizer variants (documented iteration tools; direct-runner mode):@@ -133,6 +136,11 @@ vm_preflight() {}vm_cmd "powershell -NoProfile -ExecutionPolicy Bypass -File \C:\\cbm\\scripts\\ci\\clean-test-residue.ps1 -MinFreeGB ${CBM_VM_MIN_FREE_GB:-14}"+ # Defender parity: every Windows venue (this VM and the GitHub runners)+ # tests with real-time protection ACTIVE — the same canonical script the+ # CI jobs run, so a drifted-off Defender fails loudly, never silently.+ vm_cmd "powershell -NoProfile -ExecutionPolicy Bypass -File \+C:\\cbm\\scripts\\ci\\ensure-defender.ps1"}cmd="${1:-status}"; shift || true@@ -232,6 +240,13 @@ smoke-install)# over incremental speed here.vm clangarm64 "cd /c/cbm && scripts/build.sh CC=clang CXX=clang++ && bash test-infrastructure/vm/vm-smoke.sh";;+smoke-artifact)+ # The release-archive flow with local bytes: canonical build → the ONE+ # package-release.sh → extract → vm-smoke.sh in artifact mode — the same+ # sequence _build.yml + _smoke.yml run remotely, so archive-layout bugs+ # surface here instead of in a release dry run.+ vm clangarm64 "cd /c/cbm && bash scripts/ci/smoke-artifact.sh windows arm64 CC=clang CXX=clang++"+ ;;soak)duration="${1:-10}"case "$duration" indiff --git a/tests/test_venue_parity_contract.sh b/tests/test_venue_parity_contract.shindex 26de4b668..f620e238f 100644--- a/tests/test_venue_parity_contract.sh+++ b/tests/test_venue_parity_contract.sh@@ -47,7 +47,7 @@ failures: list[str] = []# ── The canonical leg entries (the ONLY product-exercising calls allowed) ──CANONICAL = re.compile(- r"scripts/(test|build|lint|clean|smoke-local|soak-legs|smoke-invariants)\.sh"+ r"scripts/(test|build|lint|clean|smoke-local|soak-legs|smoke-invariants|package-release)\.sh"r"|test-infrastructure/vm/vm-smoke\.sh"r"|scripts/ci/[a-z0-9-]+\.(sh|ps1|py)"r"|scripts/security-[a-z0-9-]+\.sh"@@ -247,12 +247,35 @@ REQUIRED = [("_test.yml", r"scripts/ci/new-protected-temp-root\.ps1", "Windows tests use the shared temp root"),("_test.yml", r"scripts/test\.sh", "the test legs run the canonical entry"),("pr.yml", r"vm-smoke\.sh", "PR CI smokes through the shared wrapper"),+ ("_build.yml", r"scripts/package-release\.sh",+ "release archives are produced by the canonical packaging entry"),+ ("_test.yml", r"scripts/ci/ensure-defender\.ps1",+ "Windows test legs enable+verify Defender (venue parity)"),+ ("_smoke.yml", r"scripts/ci/ensure-defender\.ps1",+ "Windows release smoke enables+verifies Defender (venue parity)"),+ ("_soak.yml", r"scripts/ci/ensure-defender\.ps1",+ "Windows soak legs enable+verify Defender (venue parity)"),+ ("pr.yml", r"scripts/ci/ensure-defender\.ps1",+ "PR Windows smoke enables+verifies Defender (venue parity)"),]for name, pattern, why in REQUIRED:path = workflows / nameif path.exists() and not re.search(pattern, path.read_text()):failures.append(f"{name}: missing required `{pattern}` — {why}")+# Defender-ON parity: EVERY Windows job in every venue workflow enables and+# verifies real-time protection — a single job dropping the step must fail,+# so the expectation is an exact per-file count, not mere presence.+DEFENDER_STEPS = {"_test.yml": 2, "_soak.yml": 3, "_smoke.yml": 1, "pr.yml": 1}+for name, expected in DEFENDER_STEPS.items():+ path = workflows / name+ if path.exists():+ got = path.read_text().count("scripts/ci/ensure-defender.ps1")+ if got != expected:+ failures.append(+ f"{name}: expected {expected} ensure-defender.ps1 step(s) "+ f"(one per Windows job), found {got}")+# ── Layer 4: the local venues route through the same entries ──compose = root / "test-infrastructure" / "docker-compose.yml"if compose.exists():@@ -281,6 +304,29 @@ for local in ["test-infrastructure/vm/win.sh",f"{local}:{number}: internal harness called directly — route "f"through the canonical entries\n {s}")+# The parity lanes exist on the LOCAL venues too: artifact-flow smoke and the+# glibc-floor leg in compose/run.sh, Defender preflight in the VM driver.+LOCAL_REQUIRED = [+ ("test-infrastructure/docker-compose.yml", r"scripts/ci/smoke-artifact\.sh",+ "the local artifact-flow smoke lane exists"),+ ("test-infrastructure/docker-compose.yml", r"Dockerfile\.glibc22",+ "the glibc-floor venue exists"),+ ("test-infrastructure/run.sh", r"smoke-artifact",+ "run.sh exposes the artifact-flow smoke leg"),+ ("test-infrastructure/run.sh", r"glibc-floor",+ "run.sh exposes the glibc-floor leg"),+ # Slash-agnostic: the VM driver invokes it via a Windows path+ # (C:\cbm\scripts\ci\ensure-defender.ps1).+ ("test-infrastructure/vm/win.sh", r"ensure-defender\.ps1",+ "the VM preflight enforces Defender-ON parity"),+ ("test-infrastructure/vm/win.sh", r"scripts/ci/smoke-artifact\.sh",+ "the VM driver exposes the artifact-flow smoke lane"),+]+for local, pattern, why in LOCAL_REQUIRED:+ path = root / local+ if path.exists() and not re.search(pattern, path.read_text()):+ failures.append(f"{local}: missing required `{pattern}` — {why}")+if failures:print("VENUE PARITY CONTRACT VIOLATED — one harness, every venue:")for failure in failures:@@ -311,6 +357,8 @@ scripts/ci/preflight-docker.shscripts/ci/require-all-green.shscripts/ci/verify-shard-union.shscripts/ci/generate-sbom.py+scripts/package-release.sh+scripts/ci/smoke-artifact.shtest-infrastructure/run.shtest-infrastructure/vm/vm-smoke.shtest-infrastructure/vm/vm-run-tests.shdiff --git a/tests/test_windows_bundle_contract.sh b/tests/test_windows_bundle_contract.shindex 14b78b54e..7ebcf8c69 100644--- a/tests/test_windows_bundle_contract.sh+++ b/tests/test_windows_bundle_contract.sh@@ -191,12 +191,32 @@ archives = ("codebase-memory-mcp-windows-arm64.zip","codebase-memory-mcp-ui-windows-arm64.zip",)-for archive in archives:- archive_blocks = [block for block in build_blocks if archive in block]- require(bool(archive_blocks), f"_build.yml has no run block producing {archive}")+# The five-file layout lives in the ONE canonical packaging entry; every venue+# (release build and the local artifact-flow smoke lane) produces archives+# through it, so the bundle layout is asserted where it is defined and cannot+# fork per venue.+package_release = read("scripts/package-release.sh")+require(+ all(name in package_release for name in windows_archive_names),+ "package-release.sh must archive the exact official five-file Windows bundle",+)+for archive, call, ui in (+ ("codebase-memory-mcp-windows-amd64.zip",+ "scripts/package-release.sh windows amd64", False),+ ("codebase-memory-mcp-ui-windows-amd64.zip",+ "scripts/package-release.sh windows amd64 --variant ui", True),+ ("codebase-memory-mcp-windows-arm64.zip",+ "scripts/package-release.sh windows arm64", False),+ ("codebase-memory-mcp-ui-windows-arm64.zip",+ "scripts/package-release.sh windows arm64 --variant ui", True),+):+ # The packaging steps are single-line runs (invisible to yaml_run_blocks,+ # which collects block scalars only), so associate archive -> call on the+ # workflow text; the lookahead keeps a ui call from satisfying a std check.+ pattern = re.escape(call) + ("" if ui else r"(?!\s+--variant)")require(- any(all(name in block for name in windows_archive_names) for block in archive_blocks),- f"{archive} must archive the exact official five-file Windows bundle",+ re.search(pattern, build_workflow) is not None,+ f"_build.yml must produce {archive} via the canonical packaging entry ('{call}')",)# install.ps1 must preserve the complete adjacent pair and enter the native