fix(test): isolate smoke harness daemon runtime - #2199
Conversation
scripts/smoke-test.sh retires the account daemon from seven call sites, but its wrappers sandbox only HOME/TMPDIR/CBM_CACHE_DIR and only CBM_RUNTIME_DIR moves the daemon rendezvous, so every retirement reached the operator's live daemon. Source scripts/test-runtime.sh so every product process runs under a harness-owned runtime and cache, and clean that root up from the EXIT trap. Add tests/test_smoke_runtime_isolation_contract.sh, which fails before this change, and wire it into scripts/test.sh. Part of DeusData#1696. Signed-off-by: Anton Standrik <astandrik@yandex-team.ru>
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
This PR fixes smoke-test harness isolation by ensuring the daemon rendezvous/runtime and cache are owned by the harness (not inherited from the caller), and adds a contract test to prevent regressions.
Changes:
- Add a new contract test that verifies
scripts/smoke-test.shdoes not leak callerCBM_RUNTIME_DIR/CBM_CACHE_DIRinto product processes and cleans up the private root. - Wire the new contract test into
scripts/test.sh. - Update
scripts/smoke-test.shto initialize a private runtime/cache viascripts/test-runtime.shand clean it up on exit.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/test_smoke_runtime_isolation_contract.sh | New contract test asserting smoke harness runtime/cache isolation and cleanup. |
| scripts/test.sh | Adds a new test step to run the smoke harness isolation contract. |
| scripts/smoke-test.sh | Initializes harness-owned runtime/cache and adds cleanup on EXIT. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| # shellcheck source=test-runtime.sh | ||
| source "$REPO_ROOT/scripts/test-runtime.sh" | ||
| cbm_test_runtime_init | ||
|
|
| TMPDIR=$(cygpath -m "$TMPDIR") | ||
| fi | ||
| trap 'smoke_rmtree "$TMPDIR" "${DRYRUN_HOME:-}" "${CODEX_LIFECYCLE_HOME:-}"' EXIT | ||
| trap 'smoke_rmtree "$TMPDIR" "${DRYRUN_HOME:-}" "${CODEX_LIFECYCLE_HOME:-}"; cbm_test_runtime_cleanup "$BINARY"' EXIT |
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
What does this PR do?
Part of #1696 (audit ledger), follow-up to #1691/#1695.
scripts/smoke-test.shstarts every product process of a smoke run and retires"the account daemon" through
daemon stopfrom seven call sites. Its wrapperssandbox HOME/XDG/TMPDIR and
CBM_CACHE_DIR, but onlyCBM_RUNTIME_DIRmoves thedaemon rendezvous (
src/daemon/bootstrap.c:231-241,docs/CONFIGURATION.md), soevery retirement landed on the operator's live account daemon: stopped when no
committed client was attached, or
FAIL ...: account daemon still activewhen onewas.
scripts/smoke-test.shsourcesscripts/test-runtime.sh, callscbm_test_runtime_initafter argument validation and runscbm_test_runtime_cleanup "$BINARY"from the EXIT trap. The wrappers(
smoke-local.sh,vm-smoke.sh) are unchanged: theirCBM_CACHE_DIRis nowoverridden by the harness-owned root, and the smoke-fixture contract pins stay valid.
tests/test_smoke_runtime_isolation_contract.sh: drives the harness with anenvironment-probe fixture under a caller
CBM_RUNTIME_DIR/CBM_CACHE_DIRandrequires that no product process receives them, that runtime and cache sit under
one private root, and that the root is gone after exit. No daemon is started.
Fails on
mainwithFAIL: smoke-test exposed the caller CBM_RUNTIME_DIR to a product process; passes with this change. Wired as Step 0t2 inscripts/test.sh.Not verified here: the Windows leg (
vm-smoke.sh→ protected-root helper path oftest-runtime.shwithoutCBM_CI_TEMP_ROOT) — CI only.Checklist
git commit -s)make -f Makefile.cbm test) — shell-only change; the newcontract plus
test_smoke_fixture_contract,test_venue_parity_contract,test_runtime_isolation_contractandtest_shell_line_endingswere run; thefull C suite was not run on this host
make -f Makefile.cbm lint-ci) — no C changes;scripts/check-no-test-skips.shrun