From 74099d2bf4ff23ede962a5285f4d8324d2f69c97 Mon Sep 17 00:00:00 2001 From: Sergey Kozyrenko Date: Sat, 25 Jul 2026 04:00:57 +0700 Subject: [PATCH] fix(e2e): carry binaries and untracked files into the review sandbox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `create --dirty` piped `git diff HEAD` without --binary and copied no untracked files, so a regenerated PNG baseline aborted the patch (leaving a half-built worktree) and a new spec never reached the sandbox — and because the failure printed onto stdout, the caller captured an error string as the sandbox path. Use --binary, copy untracked non-ignored files separately, and trap ERR to tear the worktree down and report on stderr. Verified with a modified baseline plus a new untracked spec: both now arrive in the sandbox. Co-Authored-By: Claude Opus 4.8 --- frontend/e2e/tools/review-sandbox.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/frontend/e2e/tools/review-sandbox.sh b/frontend/e2e/tools/review-sandbox.sh index cf4cf660..3202ed2c 100755 --- a/frontend/e2e/tools/review-sandbox.sh +++ b/frontend/e2e/tools/review-sandbox.sh @@ -39,9 +39,22 @@ create() { path="$SANDBOX_ROOT/wt-$$-$(date +%s)" mkdir -p "$SANDBOX_ROOT" git -C "$REPO_ROOT" worktree add --detach --quiet "$path" HEAD + # Anything that fails from here leaves a worktree behind, and the caller reads stdout as the + # sandbox path — so take the worktree down and say so on stderr rather than printing a stub. + trap 'clean "$path" >/dev/null 2>&1; echo "review-sandbox: failed to prepare $path" >&2' ERR - if [[ -n "$carry_dirty" ]] && ! git -C "$REPO_ROOT" diff --quiet HEAD; then - git -C "$REPO_ROOT" diff HEAD | git -C "$path" apply --allow-empty + if [[ -n "$carry_dirty" ]]; then + # --binary or a regenerated PNG baseline aborts the patch ("cannot apply binary patch + # without full index line"). Untracked files are absent from the diff entirely, so a new + # spec would never reach the sandbox — copy them separately, minus the ignored ones. + if ! git -C "$REPO_ROOT" diff --quiet HEAD; then + git -C "$REPO_ROOT" diff HEAD --binary | git -C "$path" apply --allow-empty + fi + + while IFS= read -r -d '' file; do + mkdir -p "$path/$(dirname "$file")" + cp "$REPO_ROOT/$file" "$path/$file" + done < <(git -C "$REPO_ROOT" ls-files --others --exclude-standard -z) fi if [[ -n "$with_deps" ]]; then