Skip to content

Fix scripts/tests deleting a real checkout at $SHARED_WORKSPACE/repos - #256

Merged
webcoyote merged 1 commit into
mainfrom
fix/237-tests-clone-fixture-workspace
Sep 8, 2026
Merged

webcoyote merged 1 commit into
mainfrom
fix/237-tests-clone-fixture-workspace

Conversation

@webcoyote

@webcoyote webcoyote commented Sep 8, 2026 •

Copy link
Copy Markdown
Owner

The sv-clone tests hardcoded their fixture path to $SHARED_WORKSPACE/repos/sandvault and rm -rf'd it during setup and teardown. That is exactly where sv-clone puts a contributor's own checkout, and the README documents that invocation, so running the suite from such a checkout deleted it mid-run along with any uncommitted work. The deletion goes through sv_cmd s -- rm -rf, which runs as the sandvault user and has write access, so it succeeded. The subsequent getcwd errors made it look like an environment problem.

Give the clone tests a unique per-run workspace from mktemp -d and point sv-clone at it via SV_CLONE_WORKSPACE_ROOT, so the fixture path can never collide with a real checkout regardless of repo name. This also covers test_sv_clone_local, whose path derives from the source repo's basename.

SV_CLONE_WORKSPACE_ROOT defaults to the original location, so sv-clone behavior is unchanged when it is unset.

Fixes #237

The sv-clone tests hardcoded their fixture path to
$SHARED_WORKSPACE/repos/sandvault and rm -rf'd it during setup and
teardown. That is exactly where sv-clone puts a contributor's own
checkout, and the README documents that invocation, so running the
suite from such a checkout deleted it mid-run along with any
uncommitted work. The deletion goes through `sv_cmd s -- rm -rf`, which
runs as the sandvault user and has write access, so it succeeded. The
subsequent getcwd errors made it look like an environment problem.

Give the clone tests a unique per-run workspace from mktemp -d and
point sv-clone at it via SV_CLONE_WORKSPACE_ROOT, so the fixture path
can never collide with a real checkout regardless of repo name. This
also covers test_sv_clone_local, whose path derives from the source
repo's basename.

SV_CLONE_WORKSPACE_ROOT defaults to the original location, so sv-clone
behavior is unchanged when it is unset.

Fixes #237

Note: the clone tests did not execute during verification. This sandbox
cannot create /Users/Shared/sv-avtest*, so the agentsview test fails
and aborts the suite before the clone block is reached; that failure
reproduces identically on unmodified main. Verified separately: bash -n
and shellcheck -S warning clean on both files, the override redirects
the clone destination, the default path is unchanged when unset, and a
real clone through the override landed in the fixture workspace rather
than repos/sandvault. The clone tests themselves still need a run in an
environment where the suite gets that far.

Known gaps, not addressed here: the fixture workspace is created inside
repos/ as a sibling of real checkouts and should live elsewhere, and
cleanup runs at the end of the clone block rather than hooking the
suite's existing cleanup_guard trap, so it leaks if the run aborts.
@webcoyote
webcoyote force-pushed the fix/237-tests-clone-fixture-workspace branch from 729e7a4 to d4630fd Compare September 8, 2026 19:14
@webcoyote
webcoyote merged commit 1759c4f into main Sep 8, 2026
2 checks passed
@webcoyote
webcoyote deleted the fix/237-tests-clone-fixture-workspace branch September 8, 2026 19:45
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.

scripts/tests deletes its own working tree when the checkout is at $SHARED_WORKSPACE/repos/sandvault

1 participant