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
ci: scan only UI artifacts in dry runs
Martin Vogel5c18e3f2d04e
diff --git a/.github/workflows/_build.yml b/.github/workflows/_build.ymlindex e6bad802d..3f55dc267 100644--- a/.github/workflows/_build.yml+++ b/.github/workflows/_build.yml@@ -1,4 +1,4 @@-# Reusable: build binaries (standard + UI) on all platforms+# Reusable: build release binaries on all supported platformsname: Buildon:@@ -12,6 +12,10 @@ on:description: 'Generate build provenance attestations for release artifacts'type: booleandefault: false+ ui_only:+ description: 'Build only the UI runtime archives'+ type: boolean+ default: falsepermissions:contents: read@@ -64,6 +68,7 @@ jobs:node-version: "22"- name: Build standard binary+ if: ${{ !inputs.ui_only }}env:VERSION: ${{ inputs.version }}CC: ${{ matrix.cc }}@@ -75,17 +80,16 @@ jobs:scripts/build.sh "CC=$CC" "CXX=$CXX"fi- - name: Ad-hoc sign macOS binary- if: startsWith(matrix.os, 'macos')+ - name: Ad-hoc sign macOS standard binary+ if: ${{ !inputs.ui_only && startsWith(matrix.os, 'macos') }}run: codesign --sign - --force build/c/codebase-memory-mcp- # 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)+ if: ${{ !inputs.ui_only }}run: scripts/package-release.sh ${{ matrix.goos }} ${{ matrix.goarch }}- name: Attest standard binary provenance- if: ${{ inputs.attest }}+ if: ${{ inputs.attest && !inputs.ui_only }}uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1with:subject-path: codebase-memory-mcp-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz@@ -110,6 +114,8 @@ jobs:if: matrix.goos == 'linux' && matrix.goarch == 'amd64'run: scripts/security-ui.sh+ # Archive layout/name live in the ONE canonical script the local+ # artifact-flow smoke lane also runs (venue-parity contract).- name: Archive UI binary (canonical package-release.sh)run: scripts/package-release.sh ${{ matrix.goos }} ${{ matrix.goarch }} --variant ui@@ -145,6 +151,7 @@ jobs:node-version: "22"- name: Build standard binary+ if: ${{ !inputs.ui_only }}shell: msys2 {0}env:VERSION: ${{ inputs.version }}@@ -155,14 +162,13 @@ jobs:scripts/build.sh CC=clang CXX=clang++fi- # 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)+ if: ${{ !inputs.ui_only }}shell: msys2 {0}run: scripts/package-release.sh windows amd64 CC=clang CXX=clang++- name: Attest standard binary provenance- if: ${{ inputs.attest }}+ if: ${{ inputs.attest && !inputs.ui_only }}uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1with:subject-path: codebase-memory-mcp-windows-amd64.zip@@ -178,6 +184,8 @@ jobs:scripts/build.sh --with-ui CC=clang CXX=clang++fi+ # Archive layout/name live in the ONE canonical script the local+ # artifact-flow smoke lane also runs (venue-parity contract).- name: Archive UI binary (canonical package-release.sh)shell: msys2 {0}run: scripts/package-release.sh windows amd64 --variant ui CC=clang CXX=clang++@@ -218,6 +226,7 @@ jobs:node-version: "22"- name: Build standard binary+ if: ${{ !inputs.ui_only }}shell: msys2 {0}env:VERSION: ${{ inputs.version }}@@ -229,11 +238,12 @@ jobs:fi- name: Archive standard binary (canonical package-release.sh)+ if: ${{ !inputs.ui_only }}shell: msys2 {0}run: scripts/package-release.sh windows arm64 CC=clang CXX=clang++- name: Attest standard binary provenance- if: ${{ inputs.attest }}+ if: ${{ inputs.attest && !inputs.ui_only }}uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1with:subject-path: codebase-memory-mcp-windows-arm64.zip@@ -288,6 +298,7 @@ jobs:node-version: "22"- name: Build standard binary (static)+ if: ${{ !inputs.ui_only }}env:VERSION: ${{ inputs.version }}run: |@@ -297,16 +308,18 @@ jobs:scripts/build.sh CC=gcc CXX=g++ STATIC=1fi- - name: Verify static linking+ - name: Verify standard static linking+ if: ${{ !inputs.ui_only }}run: |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 (canonical package-release.sh)+ if: ${{ !inputs.ui_only }}run: scripts/package-release.sh linux ${{ matrix.arch }}-portable- name: Attest standard binary provenance- if: ${{ inputs.attest }}+ if: ${{ inputs.attest && !inputs.ui_only }}uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1with:subject-path: codebase-memory-mcp-linux-${{ matrix.arch }}-portable.tar.gz@@ -321,6 +334,11 @@ jobs:scripts/build.sh --with-ui CC=gcc CXX=g++ STATIC=1fi+ - name: Verify UI static linking+ run: |+ file build/c/codebase-memory-mcp+ ldd 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 UI binary (canonical package-release.sh)run: scripts/package-release.sh linux ${{ matrix.arch }}-portable --variant uidiff --git a/.github/workflows/_smoke.yml b/.github/workflows/_smoke.ymlindex d97969704..fca2f0401 100644--- a/.github/workflows/_smoke.yml+++ b/.github/workflows/_smoke.yml@@ -1,4 +1,4 @@-# Reusable: smoke test every binary (standard + UI, all platforms)+# Reusable: smoke test shipped release binaries on all platformsname: Smokeon:@@ -8,6 +8,10 @@ on:description: 'Smoke the shipped binaries on the broad platform matrix (extra OS versions) instead of the core set'type: booleandefault: false+ ui_only:+ description: 'Smoke only the UI runtime archives'+ type: boolean+ default: falsepermissions:contents: read@@ -30,6 +34,7 @@ jobs:id: setenv:BROAD: ${{ inputs.broad_platforms }}+ UI_ONLY: ${{ inputs.ui_only }}run: |CORE_UNIX='[{"os":"ubuntu-latest","goos":"linux","goarch":"amd64"},@@ -72,13 +77,14 @@ jobs:WIN=$(jq -cn --argjson a "$CORE_WIN" '$a')PORTABLE=$(jq -cn --argjson a "$CORE_PORTABLE" '$a')fi- # Expand each OS entry over both variants into a FLAT include list so- # every {os,variant} runs as its own job. A {variant:[...],include:$LIST}- # matrix collapses under GitHub's include-merge (later os entries- # overwrite the variant combos last-wins), which silently dropped every- # OS except the last — e.g. only windows-11-arm ran, never windows-latest.- # Building the cartesian explicitly avoids that.- VARIANTS='["standard","ui"]'+ # Keep the variant dimension explicit because the smoke wrappers use it+ # to require and validate the UI pack. VT-focused dry runs select only+ # UI; release compatibility retains both variants until migration.+ if [ "$UI_ONLY" = "true" ]; then+ VARIANTS='["ui"]'+ else+ VARIANTS='["standard","ui"]'+ fiUNIX_M=$(jq -cn --argjson a "$UNIX" --argjson v "$VARIANTS" '{include:[$a[] as $o | $v[] as $t | ($o + {variant:$t})]}')WIN_M=$(jq -cn --argjson a "$WIN" --argjson v "$VARIANTS" '{include:[$a[] as $o | $v[] as $t | ($o + {variant:$t})]}')PORTABLE_M=$(jq -cn --argjson a "$PORTABLE" --argjson v "$VARIANTS" '{include:[$a[] as $o | $v[] as $t | ($o + {variant:$t})]}')@@ -133,8 +139,8 @@ jobs:scripts/security-install.sh "$BIN"scripts/security-network.sh "$BIN"- - name: MCP robustness test (linux-amd64 standard only)- if: matrix.variant == 'standard' && matrix.goos == 'linux' && matrix.goarch == 'amd64'+ - name: MCP robustness test (selected linux-amd64 runtime)+ if: matrix.goos == 'linux' && matrix.goarch == 'amd64' && (inputs.ui_only || matrix.variant == 'standard')run: |BIN="$RUNNER_TEMP/cbm-artifact/codebase-memory-mcp"scripts/security-fuzz.sh "$BIN"diff --git a/.github/workflows/dry-run.yml b/.github/workflows/dry-run.ymlindex 19d6f4515..e9134c6d3 100644--- a/.github/workflows/dry-run.yml+++ b/.github/workflows/dry-run.yml@@ -91,6 +91,7 @@ jobs:uses: ./.github/workflows/_build.ymlwith:attest: false+ ui_only: true# ── Smoke test every binary ────────────────────────────────────# Run unless builds were skipped or a build leg FAILED. Every build leg@@ -102,6 +103,7 @@ jobs:uses: ./.github/workflows/_smoke.ymlwith:broad_platforms: true+ ui_only: true# ── Soak tests (optional, parallel with smoke) ────────────────soak:@@ -151,10 +153,11 @@ jobs:- name: Extract archive artifactsrun: |scripts/ci/extract-release-archives.sh assets binaries \- --expect-archives=16 \- --expect-binaries=16 \+ --archive-scope=ui \+ --expect-archives=8 \+ --expect-binaries=8 \--expect-packs=8 \- --expect-runtime-files=64+ --expect-runtime-files=32- name: VirusTotal scanuses: crazy-max/ghaction-virustotal@936d8c5c00afe97d3d9a1af26d017cfdf26800a2 # v5.0.0diff --git a/scripts/ci/extract-release-archives.sh b/scripts/ci/extract-release-archives.shindex 0dbd8091c..487857277 100755--- a/scripts/ci/extract-release-archives.sh+++ b/scripts/ci/extract-release-archives.sh@@ -4,7 +4,7 @@## Usage:# extract-release-archives.sh <archive-dir> <output-dir> \-# [--expect-archives=N] [--expect-binaries=N] [--expect-packs=N] \+# [--archive-scope=all|ui] [--expect-archives=N] [--expect-binaries=N] [--expect-packs=N] \# [--expect-runtime-files=N]## The output directory is published as one atomic bundle:@@ -18,7 +18,7 @@set -euo pipefailif [ "$#" -lt 2 ]; then- echo "Usage: $0 <archive-dir> <output-dir> [--expect-archives=N] [--expect-binaries=N] [--expect-packs=N] [--expect-runtime-files=N]" >&2+ echo "Usage: $0 <archive-dir> <output-dir> [--archive-scope=all|ui] [--expect-archives=N] [--expect-binaries=N] [--expect-packs=N] [--expect-runtime-files=N]" >&2exit 2fi@@ -70,18 +70,21 @@ UNIX_TARGETS = ("linux-arm64-portable",)WINDOWS_TARGETS = ("windows-amd64", "windows-arm64")-CANONICAL_ARCHIVES = frozenset(+UI_ARCHIVES = frozenset([- f"codebase-memory-mcp{suffix}-{target}.tar.gz"- for suffix in ("", "-ui")+ f"codebase-memory-mcp-ui-{target}.tar.gz"for target in UNIX_TARGETS]+ [- f"codebase-memory-mcp{suffix}-{target}.zip"- for suffix in ("", "-ui")+ f"codebase-memory-mcp-ui-{target}.zip"for target in WINDOWS_TARGETS])+STANDARD_ARCHIVES = frozenset(+ [f"codebase-memory-mcp-{target}.tar.gz" for target in UNIX_TARGETS]+ + [f"codebase-memory-mcp-{target}.zip" for target in WINDOWS_TARGETS]+)+CANONICAL_ARCHIVES = UI_ARCHIVES | STANDARD_ARCHIVESPACK_NAME = re.compile(r"cbm-ui-([0-9a-f]{64})\.pack\Z")SAFE_LABEL = re.compile(r"[^A-Za-z0-9._-]+")SAFE_ASSET_PATH = re.compile(rb"\A[A-Za-z0-9._/-]+\Z")@@ -290,13 +293,22 @@ class ObjectStore:def parse_arguments(argv: Sequence[str],-) -> Tuple[pathlib.Path, pathlib.Path, Dict[str, Optional[int]]]:+) -> Tuple[pathlib.Path, pathlib.Path, Dict[str, Optional[int]], str]:archive_dir = pathlib.Path(argv[1]).absolute()output_dir = pathlib.Path(argv[2]).absolute()expected: Dict[str, Optional[int]] = {value: None for value in COUNT_OPTIONS.values()}seen: set[str] = set()+ archive_scope = "all"for argument in argv[3:]:option, separator, raw_value = argument.partition("=")+ if separator and option == "--archive-scope":+ if "archive_scope" in seen:+ raise ContractError(f"duplicate option: {option}")+ if raw_value not in {"all", "ui"}:+ raise ContractError("--archive-scope must be all or ui")+ archive_scope = raw_value+ seen.add("archive_scope")+ continueif not separator or option not in COUNT_OPTIONS:raise ContractError(f"unknown option: {argument}")key = COUNT_OPTIONS[option]@@ -306,7 +318,7 @@ def parse_arguments(raise ContractError(f"{option} requires a non-negative integer")expected[key] = int(raw_value)seen.add(key)- return archive_dir, output_dir, expected+ return archive_dir, output_dir, expected, archive_scopedef validate_namespace(archive_name: str, names: Iterable[str]) -> Tuple[str, Dict[str, str]]:@@ -674,7 +686,7 @@ def write_tsv(def main(argv: Sequence[str]) -> None:- archive_dir, output_dir, expected = parse_arguments(argv)+ archive_dir, output_dir, expected, archive_scope = parse_arguments(argv)if not archive_dir.is_dir() or archive_dir.is_symlink():raise ContractError(f"archive directory is not a regular directory: {archive_dir}")if output_dir.name in ("", ".", ".."):@@ -687,11 +699,13 @@ def main(argv: Sequence[str]) -> None:archive_paths = sorted(archive_dir.iterdir(), key=lambda candidate: candidate.name)actual_names = {path.name for path in archive_paths}- if actual_names != CANONICAL_ARCHIVES or len(archive_paths) != len(CANONICAL_ARCHIVES):- missing = sorted(CANONICAL_ARCHIVES - actual_names)- unexpected = sorted(actual_names - CANONICAL_ARCHIVES)+ expected_names = UI_ARCHIVES if archive_scope == "ui" else CANONICAL_ARCHIVES+ if actual_names != expected_names or len(archive_paths) != len(expected_names):+ missing = sorted(expected_names - actual_names)+ unexpected = sorted(actual_names - expected_names)raise ContractError(- f"archive namespace mismatch: expected exact canonical 16; missing={missing}, unexpected={unexpected}"+ f"archive namespace mismatch: expected exact canonical {len(expected_names)} "+ f"({archive_scope}); missing={missing}, unexpected={unexpected}")for path in archive_paths:mode = path.lstat().st_modediff --git a/tests/test_release_archive_extractor_contract.sh b/tests/test_release_archive_extractor_contract.shindex ddb184d7b..67872475e 100644--- a/tests/test_release_archive_extractor_contract.sh+++ b/tests/test_release_archive_extractor_contract.sh@@ -50,6 +50,7 @@ archive_names = tuple(]))+ui_archive_names = tuple(name for name in archive_names if name.startswith("codebase-memory-mcp-ui-"))expected_base_counts = {"archives": 16,"binaries": 16,@@ -60,6 +61,19 @@ count_args = [f"--expect-{key.replace('_', '-')}={value}"for key, value in expected_base_counts.items()]+ui_expected_base_counts = {+ "archives": 8,+ "binaries": 8,+ "packs": 8,+ "runtime_files": 32,+}+ui_count_args = [+ "--archive-scope=ui",+ *[+ f"--expect-{key.replace('_', '-')}={value}"+ for key, value in ui_expected_base_counts.items()+ ],+]asset_payloads = {"/assets/app.css": b"body{color:#123}\n","/assets/app.js": b"globalThis.__CBM_UI__ = true;\n",@@ -233,6 +247,7 @@ Association = Tuple[str, str, str, str]def build_matrix(archive_dir: pathlib.Path,mutation: Optional[str] = None,+ selected_names: Tuple[str, ...] = archive_names,) -> Dict[Association, bytes]:archive_dir.mkdir(parents=True)expected: Dict[Association, bytes] = {}@@ -253,7 +268,7 @@ def build_matrix("zip_duplicate": "codebase-memory-mcp-ui-windows-amd64.zip",}target = targets.get(mutation)- for name in archive_names:+ for name in selected_names:if mutation == "missing_archive" and name == "codebase-memory-mcp-linux-amd64.tar.gz":continuepack_mutation = mutation if name == target and mutation and mutation.startswith("bad_pack_") else None@@ -350,8 +365,8 @@ def assert_clean_failure(case_root: pathlib.Path, mutation: str, message: str) -fail(f"{mutation}: rejected archives left a partial atomic scan bundle")-if len(archive_names) != 16:- fail("fixture matrix itself no longer describes 16 canonical archives")+if len(archive_names) != 16 or len(ui_archive_names) != 8:+ fail("fixture matrix no longer describes 16 canonical archives / eight UI archives")with tempfile.TemporaryDirectory(prefix="cbm-release-scan-contract-") as temporary:work = pathlib.Path(temporary)@@ -428,6 +443,34 @@ with tempfile.TemporaryDirectory(prefix="cbm-release-scan-contract-") as temporaif row["sha256"] != hashlib.sha256(data).hexdigest() or int(row["size"]) != len(data):fail(f"scan-set digest/size does not bind {row['scan_path']}")+ ui_only = work / "ui-only"+ ui_expected = build_matrix(ui_only / "archives", selected_names=ui_archive_names)+ ui_output = ui_only / "scan"+ ui_result = invoke(ui_only / "archives", ui_output, ui_count_args)+ if ui_result.returncode != 0:+ fail(f"canonical UI-only matrix was rejected: {ui_result.stdout.strip()}")+ ui_metadata, ui_rows = parse_manifest(+ ui_output / "associations.tsv", "cbm-release-scan-associations-v2"+ )+ ui_associations = 8 + 48 + expected_pack_assets+ if ui_metadata != {+ **ui_expected_base_counts,+ "pack_assets": expected_pack_assets,+ "associations": ui_associations,+ "scan_objects": len(set(ui_expected.values())),+ }:+ fail(f"UI-only association metadata mismatch: {ui_metadata!r}")+ if len(ui_rows) != ui_associations or {row["variant"] for row in ui_rows} != {"ui"}:+ fail("UI-only scan scope does not cover exactly the eight UI archives")+ ui_as_all_output = ui_only / "scan-as-all"+ ui_as_all = invoke(ui_only / "archives", ui_as_all_output, count_args)+ if (+ ui_as_all.returncode == 0+ or "expected exact canonical 16 (all)" not in ui_as_all.stdout+ or ui_as_all_output.exists()+ ):+ fail("UI-only archives must require an explicit closed archive scope")+failure_cases = {"bad_hash": "UI pack digest does not match its filename","bad_pack_magic": "CBMUIPK header/offset contract failed",@@ -436,13 +479,13 @@ with tempfile.TemporaryDirectory(prefix="cbm-release-scan-contract-") as tempora"bad_pack_mime": "CBMUIPK MIME/path contract failed","directory": "non-regular archive member","extra_pack": "exactly one UI pack",- "missing_archive": "expected exact canonical 16",+ "missing_archive": "expected exact canonical 16 (all)","missing_pack": "exactly one UI pack","nested_member": "unexpected archive member","oversized_archive": "archive exceeds 536870912 byte ceiling","tar_symlink": "non-regular archive member","tar_duplicate": "duplicate archive member",- "unexpected_archive": "expected exact canonical 16",+ "unexpected_archive": "expected exact canonical 16 (all)","zip_directory": "non-regular archive member","zip_duplicate": "duplicate archive member","zip_symlink": "non-regular archive member",@@ -473,8 +516,23 @@ for ceiling in ("MAX_ARCHIVE_BYTES", "MAX_MEMBER_BYTES", "MAX_TOTAL_MEMBER_BYTESrelease = (root / ".github/workflows/release.yml").read_text(encoding="utf-8")dry_run = (root / ".github/workflows/dry-run.yml").read_text(encoding="utf-8")-for workflow_name, workflow in (("release", release), ("dry-run", dry_run)):- for argument in count_args:+build = (root / ".github/workflows/_build.yml").read_text(encoding="utf-8")+smoke = (root / ".github/workflows/_smoke.yml").read_text(encoding="utf-8")+if "ui_only:" not in build or build.count("if: ${{ !inputs.ui_only }}") < 4:+ fail("canonical build workflow must gate every standard build family behind ui_only")+if build.count("--variant ui") != 4:+ fail("canonical build workflow must package exactly its four UI build families")+if "UI_ONLY: ${{ inputs.ui_only }}" not in smoke or "VARIANTS='[\"ui\"]'" not in smoke:+ fail("release smoke matrix must support an explicit UI-only selection")+if dry_run.count("ui_only: true") != 2 or "--archive-scope=ui" not in dry_run:+ fail("dry-run must build, smoke and extract only the UI runtime set")+if "--archive-scope=ui" in release:+ fail("release workflow must retain its dual-variant compatibility scope")+for workflow_name, workflow, arguments in (+ ("release", release, count_args),+ ("dry-run", dry_run, ui_count_args),+):+ for argument in arguments:if argument not in workflow:fail(f"{workflow_name} workflow does not assert {argument}")for required in (diff --git a/tests/test_windows_bundle_contract.sh b/tests/test_windows_bundle_contract.shindex 5acb8b9d5..1661dfeda 100644--- a/tests/test_windows_bundle_contract.sh+++ b/tests/test_windows_bundle_contract.sh@@ -148,7 +148,8 @@ require()# Each archive variant is still produced through the ONE canonical packaging-# entry, so the five-or-six-file layout above governs all of them.+# entry, so the five-or-six-file layout above governs all of them. The standard+# calls are conditionally skipped by VT-focused UI-only dry runs.build_workflow = read(".github/workflows/_build.yml")for archive, call, ui in (("codebase-memory-mcp-windows-amd64.zip", "scripts/package-release.sh windows amd64", False),@@ -164,6 +165,10 @@ for archive, call, ui in (re.search(pattern, build_workflow) is not None,f"_build.yml must produce {archive} via the canonical packaging entry ('{call}')",)+require(+ build_workflow.count("if: ${{ !inputs.ui_only }}") >= 4,+ "_build.yml must skip every standard Windows build/archive in UI-only mode",+)# ── 3. install.ps1 delegates every runtime mutation to the candidate ─────────installer = read("install.ps1")