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
fix(test): arm smoke runtime cleanup at init, retire the daemon first
Anton Standrikfa138acf4452
diff --git a/scripts/smoke-test.sh b/scripts/smoke-test.shindex e996da847..d1c64c6b7 100755--- a/scripts/smoke-test.sh+++ b/scripts/smoke-test.sh@@ -51,6 +51,11 @@ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." && pwd)"# shellcheck source=test-runtime.shsource "$REPO_ROOT/scripts/test-runtime.sh"cbm_test_runtime_init+# Armed here rather than only with the fixture trap below: the fixture mktemp+# and its cygpath conversion sit between the two, and under `set -e` a failure+# there would otherwise leave the private root behind. The fixture trap+# replaces this one and keeps the same cleanup as its first step.+trap 'cbm_test_runtime_cleanup "$BINARY"' EXITsmoke_mktemp_file() {if [ -n "${SMOKE_TEMP_ROOT:-}" ]; then@@ -160,7 +165,11 @@ CODEX_LIFECYCLE_HOME=""if command -v cygpath &>/dev/null; thenTMPDIR=$(cygpath -m "$TMPDIR")fi-trap 'smoke_rmtree "$TMPDIR" "${DRYRUN_HOME:-}" "${CODEX_LIFECYCLE_HOME:-}"; cbm_test_runtime_cleanup "$BINARY"' EXIT+# Runtime cleanup first, so no earlier cleanup step stands between the exit+# and the private daemon's retirement; on Windows that retirement is also what+# unblocks the fixture rm (mapped binary, open logs). smoke_rmtree never fails,+# so the fixture removal still runs after it.+trap 'cbm_test_runtime_cleanup "$BINARY"; smoke_rmtree "$TMPDIR" "${DRYRUN_HOME:-}" "${CODEX_LIFECYCLE_HOME:-}"' EXITCLI_STDERR=$(smoke_mktemp_file)# 10 of the cli call sites assign directly (VAR=$(cli ...)). Underdiff --git a/tests/test_smoke_runtime_isolation_contract.sh b/tests/test_smoke_runtime_isolation_contract.shindex e91e1d38d..31ba7a7b6 100755--- a/tests/test_smoke_runtime_isolation_contract.sh+++ b/tests/test_smoke_runtime_isolation_contract.sh@@ -79,4 +79,25 @@ done < "$ENV_LOG"[[ ! -e "$private_root" ]] || fail "smoke-test left its private root behind: $private_root"+# The run above exits through the fixture trap, so it cannot show what happens+# to the private root when the harness dies before that trap exists — the+# fixture mktemp and its cygpath conversion are in that window, and under+# `set -e` either can end the run. Reproducing that failure would mean scanning+# the shared /tmp parent for orphaned roots, which races every other harness+# test in the same suite, so pin the ordering instead: the cleanup trap is+# armed between the init call and the first fixture work.+smoke="$ROOT/scripts/smoke-test.sh"+smoke_line_of() {+ # A missing pattern is the failure this check reports, not a reason to end+ # the test silently under `set -e`.+ grep -n "$1" "$smoke" | head -1 | cut -d: -f1 || true+}+init_line=$(smoke_line_of '^cbm_test_runtime_init$')+early_trap_line=$(smoke_line_of "^trap 'cbm_test_runtime_cleanup \"\$BINARY\"' EXIT\$")+fixture_line=$(smoke_line_of '^TMPDIR=\$(smoke_mktemp_dir)$')+if [[ -z "$init_line" || -z "$early_trap_line" || -z "$fixture_line" ]] ||+ ((early_trap_line < init_line || early_trap_line > fixture_line)); then+ fail "smoke-test must arm the runtime cleanup trap between cbm_test_runtime_init and its first fixture"+fi+echo "PASS: smoke harness isolates its daemon runtime and cache from the caller"