feat(utils): MSB_HOME env override for isolated state#669
Open
toksdotdev wants to merge 3 commits intomainfrom
Open
feat(utils): MSB_HOME env override for isolated state#669toksdotdev wants to merge 3 commits intomainfrom
toksdotdev wants to merge 3 commits intomainfrom
Conversation
`microsandbox_utils::resolve_home()` now checks `$MSB_HOME` before falling back to `~/.microsandbox/`. lets ci jobs and integration tests isolate per-process state (db, sandboxes, cache, logs) without touching `$HOME` and clobbering tooling that lives there (npm cache, ssh keys, etc.). every prior call site that built `~/.microsandbox` from `dirs::home_dir()` goes through the new helper: db init, config home resolution, setup downloader, and the cli `self` subcommand. set `MSB_HOME=$RUNNER_TEMP/msb-home` in ci to give each job a clean microsandbox state directory.
drop the symlink dance and the unsafe `$HOME` mutation in `init_isolated_home`. instead, point microsandbox at the test's tempdir via the new `MSB_HOME` env var and reuse the real installed binary via `MSB_PATH`. libkrunfw is resolved from `MSB_PATH`'s sibling lib dir, so no per-test bin/lib mirroring is needed. upsides: - `$HOME` is left untouched, so other tooling that reads it (npm cache, ssh keys, etc.) keeps working - ~30 LOC of `symlink_into` / `mirror_dir` plumbing gone - the same env vars work for non-rust integration tests (node, python)
isolates the node sdk smoke test job's microsandbox state (db, sandboxes, cache) from any other job that runs on the same self-hosted runner. fixes the flake where a sandbox or migration written by an earlier job left state the next run couldn't reconcile. `$RUNNER_TEMP` is wiped between jobs, so no manual cleanup is needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
ci jobs that share a self-hosted runner also share
~/.microsandbox/between runs, so a sandbox or sqlite migration left by one job can break the next. added anMSB_HOMEenv var that overrides the default home dir, letting each job point microsandbox at its own state without touching$HOMEand clobbering everything else that reads it.set per-job in the node sdk integration test workflow (the one currently flaking on
SQLITE_BUSY/ stale boot state):$RUNNER_TEMPis wiped between jobs, so cleanup is automatic.test-utils::init_isolated_homewas migrated to use the same env var, which let it drop the$HOMEmutation and the bin/lib symlink dance.test plan