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
Add comprehensive smoke test: version + index + search + trace + folder integrity
Martin Vogelce96ecc0859e
diff --git a/.github/workflows/dry-run.yml b/.github/workflows/dry-run.ymlindex fc89b2611..9e5b5c015 100644--- a/.github/workflows/dry-run.yml+++ b/.github/workflows/dry-run.yml@@ -7,7 +7,30 @@ permissions:contents: readjobs:- test-unix:+ lint:+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v4++ - name: Install deps+ run: |+ sudo apt-get update && sudo apt-get install -y libsqlite3-dev zlib1g-dev cppcheck+ wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -+ sudo add-apt-repository -y "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-18 main"+ sudo apt-get update && sudo apt-get install -y clang-tidy-18 clang-format-18+ sudo ln -sf /usr/bin/clang-tidy-18 /usr/bin/clang-tidy+ sudo ln -sf /usr/bin/clang-format-18 /usr/bin/clang-format++ - name: clang-format+ run: make -f Makefile.cbm lint-format++ - name: cppcheck+ run: make -f Makefile.cbm lint-cppcheck++ - name: clang-tidy+ run: make -f Makefile.cbm lint-tidy++ test:strategy:matrix:include:@@ -30,28 +53,64 @@ jobs:- name: Run C tests (ASan + UBSan)run: make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu) -f Makefile.cbm test+ build-unix:+ needs: [lint, test]+ strategy:+ matrix:+ include:+ - os: ubuntu-latest+ goos: linux+ goarch: amd64+ - os: ubuntu-24.04-arm+ goos: linux+ goarch: arm64+ - os: macos-14+ goos: darwin+ goarch: arm64+ - os: macos-15-intel+ goos: darwin+ goarch: amd64+ variant: [standard, ui]+ runs-on: ${{ matrix.os }}+ steps:+ - uses: actions/checkout@v4++ - name: Install deps (Ubuntu)+ if: startsWith(matrix.os, 'ubuntu')+ run: sudo apt-get update && sudo apt-get install -y libsqlite3-dev zlib1g-dev+- name: Build standard binary+ if: matrix.variant == 'standard'run: make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu) -f Makefile.cbm cbm- - name: Smoke test (standard)- run: |- ./build/c/codebase-memory-mcp --version- echo '{}' | timeout 3 ./build/c/codebase-memory-mcp 2>&1 || true- echo "Smoke test passed"-- uses: actions/setup-node@v4+ if: matrix.variant == 'ui'with:node-version: "22"- name: Build UI binary+ if: matrix.variant == 'ui'run: make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu) -f Makefile.cbm cbm-with-ui- - name: Smoke test (UI)+ - name: Smoke test+ run: scripts/smoke-test.sh ./build/c/codebase-memory-mcp++ - name: Archive binaryrun: |- ./build/c/codebase-memory-mcp --version- echo "UI binary smoke test passed"+ SUFFIX=${{ matrix.variant == 'ui' && '-ui' || '' }}+ tar -czf codebase-memory-mcp${SUFFIX}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz \+ -C build/c codebase-memory-mcp- test-windows:+ - uses: actions/upload-artifact@v4+ with:+ name: ${{ matrix.variant }}-${{ matrix.goos }}-${{ matrix.goarch }}+ path: "*.tar.gz"++ build-windows:+ needs: [lint, test]+ strategy:+ matrix:+ variant: [standard, ui]runs-on: windows-lateststeps:- uses: actions/checkout@v4@@ -64,12 +123,36 @@ jobs:mingw-w64-ucrt-x86_64-gccmingw-w64-ucrt-x86_64-sqlite3mingw-w64-ucrt-x86_64-zlib+ mingw-w64-ucrt-x86_64-python3make- name: Build standard binary+ if: matrix.variant == 'standard'shell: msys2 {0}run: make -j$(nproc) -f Makefile.cbm cbm+ - uses: actions/setup-node@v4+ if: matrix.variant == 'ui'+ with:+ node-version: "22"++ - name: Build UI binary+ if: matrix.variant == 'ui'+ shell: msys2 {0}+ run: make -j$(nproc) -f Makefile.cbm cbm-with-ui+- name: Smoke testshell: msys2 {0}- run: ./build/c/codebase-memory-mcp.exe --version || ./build/c/codebase-memory-mcp --version+ run: scripts/smoke-test.sh ./build/c/codebase-memory-mcp++ - name: Archive binary+ shell: pwsh+ run: |+ $suffix = if ("${{ matrix.variant }}" -eq "ui") { "-ui" } else { "" }+ Copy-Item build/c/codebase-memory-mcp -Destination codebase-memory-mcp.exe+ Compress-Archive -Path codebase-memory-mcp.exe -DestinationPath "codebase-memory-mcp${suffix}-windows-amd64.zip"++ - uses: actions/upload-artifact@v4+ with:+ name: ${{ matrix.variant }}-windows-amd64+ path: "*.zip"diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 0049d97cf..d047302cc 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -58,7 +58,7 @@ jobs:CFLAGS_EXTRA="-DCBM_VERSION=\"\\\"$CLEAN_VERSION\\\"\""- name: Smoke test (standard)- run: ./build/c/codebase-memory-mcp --version+ run: scripts/smoke-test.sh ./build/c/codebase-memory-mcp- name: Archive standard binaryrun: |@@ -79,7 +79,7 @@ jobs:CFLAGS_EXTRA="-DCBM_VERSION=\"\\\"$CLEAN_VERSION\\\"\""- name: Smoke test (UI)- run: ./build/c/codebase-memory-mcp --version+ run: scripts/smoke-test.sh ./build/c/codebase-memory-mcp- name: Archive UI binaryrun: |@@ -104,6 +104,7 @@ jobs:mingw-w64-ucrt-x86_64-gccmingw-w64-ucrt-x86_64-sqlite3mingw-w64-ucrt-x86_64-zlib+ mingw-w64-ucrt-x86_64-python3make# ── Standard binary ──@@ -116,9 +117,9 @@ jobs:make -j$(nproc) -f Makefile.cbm cbm \CFLAGS_EXTRA="-DCBM_VERSION=\"\\\"$CLEAN_VERSION\\\"\""- - name: Smoke test+ - name: Smoke test (standard)shell: msys2 {0}- run: ./build/c/codebase-memory-mcp --version+ run: scripts/smoke-test.sh ./build/c/codebase-memory-mcp- name: Archive standard binaryshell: pwsh@@ -140,6 +141,10 @@ jobs:make -j$(nproc) -f Makefile.cbm cbm-with-ui \CFLAGS_EXTRA="-DCBM_VERSION=\"\\\"$CLEAN_VERSION\\\"\""+ - name: Smoke test (UI)+ shell: msys2 {0}+ run: scripts/smoke-test.sh ./build/c/codebase-memory-mcp+- name: Archive UI binaryshell: pwshrun: |diff --git a/scripts/smoke-test.sh b/scripts/smoke-test.shindex 3f4e61ba2..fd9a5383c 100755--- a/scripts/smoke-test.sh+++ b/scripts/smoke-test.sh@@ -1,18 +1,163 @@#!/usr/bin/env bashset -euo pipefail-# Smoke test: verify the binary starts and reports its version.+# Smoke test: verify the binary is fully operational.+#+# Phase 1: --version output+# Phase 2: Index a small multi-language project+# Phase 3: Verify node/edge counts, search, and trace+#+# Usage: smoke-test.sh <binary-path>+BINARY="${1:?usage: smoke-test.sh <binary-path>}"+TMPDIR=$(mktemp -d)+trap 'rm -rf "$TMPDIR"' EXIT++cli() { "$BINARY" cli "$@" 2>/dev/null; }-echo "=== smoke-test: --version ==="+echo "=== Phase 1: version ==="OUTPUT=$("$BINARY" --version 2>&1)echo "$OUTPUT"--if echo "$OUTPUT" | grep -qE 'v?[0-9]+\.[0-9]+|dev'; then- echo "OK: version output looks valid"-else+if ! echo "$OUTPUT" | grep -qE 'v?[0-9]+\.[0-9]+|dev'; thenecho "FAIL: unexpected version output"exit 1fi+echo "OK"++echo ""+echo "=== Phase 2: index test project ==="++# Create a small multi-language project (Python + Go + JS)+mkdir -p "$TMPDIR/src/pkg"++cat > "$TMPDIR/src/main.py" << 'PYEOF'+from pkg import helper++def main():+ result = helper.compute(42)+ print(result)++class Config:+ DEBUG = True+ PORT = 8080+PYEOF++cat > "$TMPDIR/src/pkg/__init__.py" << 'PYEOF'+from .helper import compute+PYEOF++cat > "$TMPDIR/src/pkg/helper.py" << 'PYEOF'+def compute(x):+ return x * 2++def validate(data):+ if not data:+ raise ValueError("empty")+ return True+PYEOF++cat > "$TMPDIR/src/server.go" << 'GOEOF'+package main++import "fmt"++func StartServer(port int) {+ fmt.Printf("listening on :%d\n", port)+}++func HandleRequest(path string) string {+ return "ok: " + path+}+GOEOF++cat > "$TMPDIR/src/app.js" << 'JSEOF'+function render(data) {+ return `<div>${data}</div>`;+}++function fetchData(url) {+ return fetch(url).then(r => r.json());+}++module.exports = { render, fetchData };+JSEOF++cat > "$TMPDIR/config.yaml" << 'YAMLEOF'+server:+ port: 8080+ debug: true+database:+ host: localhost+YAMLEOF++# Index+RESULT=$(cli index_repository "{\"repo_path\":\"$TMPDIR\"}")+echo "$RESULT"++STATUS=$(echo "$RESULT" | python3 -c "import json,sys; d=json.loads(json.loads(sys.stdin.read())['content'][0]['text']); print(d.get('status',''))" 2>/dev/null || echo "")+if [ "$STATUS" != "indexed" ]; then+ echo "FAIL: index status is '$STATUS', expected 'indexed'"+ exit 1+fi++NODES=$(echo "$RESULT" | python3 -c "import json,sys; d=json.loads(json.loads(sys.stdin.read())['content'][0]['text']); print(d.get('nodes',0))" 2>/dev/null || echo "0")+EDGES=$(echo "$RESULT" | python3 -c "import json,sys; d=json.loads(json.loads(sys.stdin.read())['content'][0]['text']); print(d.get('edges',0))" 2>/dev/null || echo "0")++echo "nodes=$NODES edges=$EDGES"++if [ "$NODES" -lt 10 ]; then+ echo "FAIL: expected at least 10 nodes, got $NODES"+ exit 1+fi+if [ "$EDGES" -lt 5 ]; then+ echo "FAIL: expected at least 5 edges, got $EDGES"+ exit 1+fi+echo "OK: $NODES nodes, $EDGES edges"++echo ""+echo "=== Phase 3: verify queries ==="++# 3a: search_graph — find the compute function+PROJECT=$(echo "$RESULT" | python3 -c "import json,sys; d=json.loads(json.loads(sys.stdin.read())['content'][0]['text']); print(d.get('project',''))" 2>/dev/null || echo "")++SEARCH=$(cli search_graph "{\"project\":\"$PROJECT\",\"name_pattern\":\"compute\"}")+TOTAL=$(echo "$SEARCH" | python3 -c "import json,sys; d=json.loads(json.loads(sys.stdin.read())['content'][0]['text']); print(d.get('total',0))" 2>/dev/null || echo "0")+if [ "$TOTAL" -lt 1 ]; then+ echo "FAIL: search_graph for 'compute' returned 0 results"+ exit 1+fi+echo "OK: search_graph found $TOTAL result(s) for 'compute'"++# 3b: trace_call_path — verify compute has callers+TRACE=$(cli trace_call_path "{\"project\":\"$PROJECT\",\"function_name\":\"compute\",\"direction\":\"inbound\",\"max_depth\":1}")+CALLERS=$(echo "$TRACE" | python3 -c "import json,sys; d=json.loads(json.loads(sys.stdin.read())['content'][0]['text']); print(len(d.get('callers',[])))" 2>/dev/null || echo "0")+if [ "$CALLERS" -lt 1 ]; then+ echo "FAIL: trace_call_path found 0 callers for 'compute'"+ exit 1+fi+echo "OK: trace_call_path found $CALLERS caller(s) for 'compute'"++# 3c: get_graph_schema — verify labels exist+SCHEMA=$(cli get_graph_schema "{\"project\":\"$PROJECT\"}")+LABELS=$(echo "$SCHEMA" | python3 -c "import json,sys; d=json.loads(json.loads(sys.stdin.read())['content'][0]['text']); print(len(d.get('node_labels',[])))" 2>/dev/null || echo "0")+if [ "$LABELS" -lt 3 ]; then+ echo "FAIL: schema has fewer than 3 node labels"+ exit 1+fi+echo "OK: schema has $LABELS node labels"++# 3d: Verify __init__.py didn't clobber Folder node+FOLDERS=$(cli search_graph "{\"project\":\"$PROJECT\",\"label\":\"Folder\"}")+FOLDER_COUNT=$(echo "$FOLDERS" | python3 -c "import json,sys; d=json.loads(json.loads(sys.stdin.read())['content'][0]['text']); print(d.get('total',0))" 2>/dev/null || echo "0")+if [ "$FOLDER_COUNT" -lt 2 ]; then+ echo "FAIL: expected at least 2 Folder nodes (src, src/pkg), got $FOLDER_COUNT"+ exit 1+fi+echo "OK: $FOLDER_COUNT Folder nodes (init.py didn't clobber them)"++# 3e: delete_project cleanup+cli delete_project "{\"project_name\":\"$PROJECT\"}" > /dev/null-echo "=== smoke-test: passed ==="+echo ""+echo "=== smoke-test: ALL PASSED ==="