From d191906f6dec506dc9b55b488c41daaf8916d174 Mon Sep 17 00:00:00 2001 From: igneum-labs <337424239+igneum-labs@users.noreply.github.com> Date: Tue, 6 Oct 2026 18:55:41 +0000 Subject: [PATCH] Build server: the remote checkout's clean-tree check accepts the sha stamps and target dirs at any depth The second build of every repo-kind crate in a subdirectory failed (6 October 2026, 18:51 UTC, the pool build: "tree not clean after reset: ?? pool/.build-remote-sha-target"): checkout_tree keeps the stamps with `git clean -e` at any depth but its status check matched them at the root only. The check now reads `git status --porcelain --untracked-files=all` (an all-untracked directory is listed file by file, not as "?? sub/") and accepts target dirs, sccache and both stamps under any path. The self-test carries the subdirectory case (stamp and target dir kept, overlay file removed) and the known-failed case (a stray untracked file still fails the check). Co-Authored-By: Claude Fable 5.1 --- infra/build-server/remote-run.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/infra/build-server/remote-run.sh b/infra/build-server/remote-run.sh index a4ddc8b5..a26ec8e3 100755 --- a/infra/build-server/remote-run.sh +++ b/infra/build-server/remote-run.sh @@ -41,7 +41,10 @@ checkout_tree() { # what may remain untracked: target dirs, the sha stamps of build-remote.sh and cross-remote.sh (kept so a build after the # checkout knows whether to clean kaspa-build-info), sccache; the first live run after this mode was added failed on a # stamp it had itself kept (6 October 2026, 18:14 UTC: the self-test had no stamp file; it has one now) - local left; left=$(git status --porcelain | grep -vE '^\?\? (target|target-|sccache|\.build-remote-sha-|\.cross-remote-sha-)' | head -3 || true) + # ... at any depth: a repo-kind crate (pool/, igneum-pow/, app/igneum-app/) writes its stamp in its own directory, and the + # root-anchored pattern of the first version failed the second build of every such crate (6 October 2026, 18:51 UTC, the + # pool build: "tree not clean after reset: ?? pool/.build-remote-sha-target"; the self-test has the subdirectory case now) + local left; left=$(git status --porcelain --untracked-files=all | grep -vE '^\?\? (.*/)?(target|target-|sccache|\.build-remote-sha-|\.cross-remote-sha-)' | head -3 || true) [ -z "$left" ] || { echo "checkout: tree not clean after reset at $dir: $left" >&2; return 1; } set +e } @@ -56,6 +59,8 @@ if [ "${1:-}" = --self-test ]; then checkout_tree "$t/box" "$t/mirror.git" master "$sha1" || { echo "self-test: first checkout failed"; exit 1; } # the overlay of a build: a tracked file edited, an untracked file added, a target dir that must survive echo edited > "$t/box/a.txt"; echo new > "$t/box/b.txt"; mkdir -p "$t/box/target/release"; echo bin > "$t/box/target/release/x"; echo "$sha1" > "$t/box/.build-remote-sha-target" + # a crate in a subdirectory: its stamp and target dir must survive, its untracked overlay file must not + mkdir -p "$t/box/sub/target/release"; echo bin > "$t/box/sub/target/release/y"; echo "$sha1" > "$t/box/sub/.build-remote-sha-target"; echo new > "$t/box/sub/c.txt" # the Mac moves on: a new commit that changes a.txt echo a2 > "$t/src/a.txt"; git -C "$t/src" -c user.name=t -c user.email=t@t commit -qam three; git -C "$t/src" push -q "$t/mirror.git" master sha2=$(git -C "$t/src" rev-parse HEAD) @@ -66,7 +71,14 @@ if [ "${1:-}" = --self-test ]; then [ ! -e "$t/box/b.txt" ] || { echo "self-test: untracked overlay file survived"; exit 1; } [ -f "$t/box/target/release/x" ] || { echo "self-test: target dir was cleaned"; exit 1; } [ -f "$t/box/.build-remote-sha-target" ] || { echo "self-test: the sha stamp was cleaned"; exit 1; } - echo "self-test: checkout mode lands on the new commit with a clean tree, target dir and sha stamp kept"; exit 0 + [ -f "$t/box/sub/.build-remote-sha-target" ] || { echo "self-test: a subdirectory crate's sha stamp was cleaned"; exit 1; } + [ -f "$t/box/sub/target/release/y" ] || { echo "self-test: a subdirectory crate's target dir was cleaned"; exit 1; } + [ ! -e "$t/box/sub/c.txt" ] || { echo "self-test: a subdirectory's untracked overlay file survived"; exit 1; } + # the known-failed case: an untracked file the overlay left that no rule keeps must fail the check + echo stray > "$t/box/sub/stray.txt" + if (cd "$t/box" && left=$(git status --porcelain --untracked-files=all | grep -vE '^\?\? (.*/)?(target|target-|sccache|\.build-remote-sha-|\.cross-remote-sha-)' | head -3); [ -n "$left" ]); then :; else echo "self-test: the clean-tree check did NOT fire on a stray untracked file"; exit 1; fi + rm -f "$t/box/sub/stray.txt" + echo "self-test: checkout mode lands on the new commit with a clean tree, target dirs and sha stamps kept at any depth, and fires on a stray file"; exit 0 fi if [ "${BR_MODE:-run}" = checkout ]; then