Skip to content

fix(test): isolate smoke harness daemon runtime - #2199

Open
astandrik wants to merge 1 commit into
DeusData:mainfrom
astandrik:fix/1696-smoke-runtime-isolation
Open

fix(test): isolate smoke harness daemon runtime#2199
astandrik wants to merge 1 commit into
DeusData:mainfrom
astandrik:fix/1696-smoke-runtime-isolation

Conversation

@astandrik

Copy link
Copy Markdown
Contributor

What does this PR do?

Part of #1696 (audit ledger), follow-up to #1691/#1695.

scripts/smoke-test.sh starts every product process of a smoke run and retires
"the account daemon" through daemon stop from seven call sites. Its wrappers
sandbox HOME/XDG/TMPDIR and CBM_CACHE_DIR, but only CBM_RUNTIME_DIR moves the
daemon rendezvous (src/daemon/bootstrap.c:231-241, docs/CONFIGURATION.md), so
every retirement landed on the operator's live account daemon: stopped when no
committed client was attached, or FAIL ...: account daemon still active when one
was.

  • scripts/smoke-test.sh sources scripts/test-runtime.sh, calls
    cbm_test_runtime_init after argument validation and runs
    cbm_test_runtime_cleanup "$BINARY" from the EXIT trap. The wrappers
    (smoke-local.sh, vm-smoke.sh) are unchanged: their CBM_CACHE_DIR is now
    overridden by the harness-owned root, and the smoke-fixture contract pins stay valid.
  • tests/test_smoke_runtime_isolation_contract.sh: drives the harness with an
    environment-probe fixture under a caller CBM_RUNTIME_DIR/CBM_CACHE_DIR and
    requires 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 main with FAIL: smoke-test exposed the caller CBM_RUNTIME_DIR to a product process; passes with this change. Wired as Step 0t2 in scripts/test.sh.

Not verified here: the Windows leg (vm-smoke.sh → protected-root helper path of
test-runtime.sh without CBM_CI_TEMP_ROOT) — CI only.

Checklist

  • Every commit is signed off (git commit -s)
  • Tests pass locally (make -f Makefile.cbm test) — shell-only change; the new
    contract plus test_smoke_fixture_contract, test_venue_parity_contract,
    test_runtime_isolation_contract and test_shell_line_endings were run; the
    full C suite was not run on this host
  • Lint passes (make -f Makefile.cbm lint-ci) — no C changes;
    scripts/check-no-test-skips.sh run
  • New behavior is covered by a test (reproduce-first for bug fixes)

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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.sh does not leak caller CBM_RUNTIME_DIR/CBM_CACHE_DIR into product processes and cleans up the private root.
  • Wire the new contract test into scripts/test.sh.
  • Update scripts/smoke-test.sh to initialize a private runtime/cache via scripts/test-runtime.sh and 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.

Comment thread scripts/smoke-test.sh
# shellcheck source=test-runtime.sh
source "$REPO_ROOT/scripts/test-runtime.sh"
cbm_test_runtime_init

Comment thread scripts/smoke-test.sh
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
@github-actions

Copy link
Copy Markdown

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. 0.9.1-rc.1 is out, so the release freeze that held reviews is over — but it left a large queue of open pull requests behind it, and we are reading through them oldest-first. The background is in discussion #1144.

What that means for this PR, concretely:

  • It will not be closed for inactivity. No stale bot touches pull requests here.
  • It may still sit a while before a human reads it. That is on us, not on you.
  • Older PRs are read first, so a recent one is not being skipped — it is behind a queue.

Things that will genuinely speed it up whenever review does happen:

  • Keep it rebased on main — the tree is moving quickly right now, and a conflicting branch cannot be reviewed as the diff you intended.
  • Get CI green, or say which failures you believe are pre-existing.
  • Keep the change to one claim. Bundled features and refactors get split before they get merged, which costs you a round trip.
  • Every commit needs a sign-off (git commit -s) — CI enforces DCO.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants