[PR #1994] [MERGED] CI: a failed preparation leaves nothing in .local #3920

Closed
opened 2026-11-03 04:13:17 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1994
Author: @ludovic111
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: fix/vanilla-data-failed-prepare


📝 Commits (1)

  • 160c1e8 CI: a failed preparation leaves nothing in .local

📊 Changes

1 file changed (+18 additions, -1 deletions)

View changed files

📝 tools/ci/vanilla-data.sh (+18 -1)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What

tools/ci/vanilla-data.sh deleted a failed preparation's folder but kept what horizon-prepare had already written to .local/. The Mac runner horizon checkout had real .local/horizon-client, -collision, -health, -motion and -render folders (from 00:37 to 00:41 tonight). Every later preparation counted them as already there, so its .entries listed only horizon-client-structures (prepared/2a7d4…, 576dd…, 7f9a…), and jobs read the stale resources outside the per-key cache.

Fix

  • A failed preparation removes every .local/ entry it created, then the preparation folder.
  • Before anything else, a job removes real folders in .local/ named like preparation outputs: an .entries name or horizon-client*.
  • A preparation whose .entries lacks horizon-client is made again, so the broken preparations repair themselves.

#1965 doesn't touch this file, so there is no overlap.

Test

The script ran against a fake checkout: stub cargo, plus a fake horizon-prepare that writes .local/horizon-client* and fails on demand.

  1. A failed preparation exits 1. Only the datagen and minecraft links remain in .local/.
  2. Stale state (real .local/horizon-client and -render, plus a preparation listing only structures): both folders are removed, the preparation is made again, and .local/ gets links to horizon-client and horizon-client-motion.
  3. A rerun uses the cache and prints no messages.

shellcheck -S warning is clean.

Diff (tools/ci)

diff --git a/tools/ci/vanilla-data.sh b/tools/ci/vanilla-data.sh
index 5276c54e9..f548e1f14 100755
--- a/tools/ci/vanilla-data.sh
+++ b/tools/ci/vanilla-data.sh
@@ -42,7 +42,21 @@ until mkdir "$lock" 2>/dev/null; do
 done
 trap 'rmdir "$lock" 2>/dev/null || true' EXIT
 # horizon-prepare writes .local/horizon-client and its exporters' outputs beside it: all of them live in
-# $prepared, listed in $prepared/.entries, and .local/ links to them.
+# $prepared, listed in $prepared/.entries, and .local/ links to them. A real folder of that kind in .local/ is
+# what an older failed preparation left: it would hide the preparations (and a new one would not count it as its
+# own output), so it goes.
+outputs=$({ cat "$shared"/prepared/*/.entries; cd .local && ls -d horizon-client*; } 2>/dev/null || true)
+for name in $(echo "$outputs" | LC_ALL=C sort -u); do
+  if [ -e ".local/$name" ] && [ ! -L ".local/$name" ]; then
+    rm -rf ".local/${name:?}"
+    echo "Removed .local/$name, left by a failed preparation"
+  fi
+done
+# A preparation made while such a folder was there did not list it (horizon-client above all), so it is made again.
+if [ -f "$prepared/.entries" ] && ! grep -qx horizon-client "$prepared/.entries"; then
+  echo "Preparation $key lacks horizon-client: preparing again"
+  rm -rf "$prepared"
+fi
 if [ ! -f "$prepared/.entries" ]; then
   echo "Preparing resources with this checkout's horizon-prepare ($key)"
   rm -rf "$prepared" && mkdir -p "$prepared"
@@ -55,6 +69,9 @@ if [ ! -f "$prepared/.entries" ]; then
   cargo build --release --locked -p horizon-prepare
   if ! target/release/horizon-prepare --root "$PWD" > "$RUNNER_TEMP/prepare.log" 2>&1; then
     tail -40 "$RUNNER_TEMP/prepare.log"
+    # Nothing of a failed preparation stays in .local/: the next job prepares again.
+    LC_ALL=C comm -13 <(echo "$before") <(ls -1A .local | LC_ALL=C sort) |
+      while read -r name; do rm -rf ".local/${name:?}"; done
     rm -rf "$prepared"
     exit 1
   fi

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/1994 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/vanilla-data-failed-prepare` --- ### 📝 Commits (1) - [`160c1e8`](https://github.com/horizon-rust/horizon/commit/160c1e8b7a3bebcd7157feff5c4cf17ada0198c2) CI: a failed preparation leaves nothing in .local ### 📊 Changes **1 file changed** (+18 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `tools/ci/vanilla-data.sh` (+18 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What `tools/ci/vanilla-data.sh` deleted a failed preparation's folder but kept what `horizon-prepare` had already written to `.local/`. The Mac runner `horizon` checkout had real `.local/horizon-client`, `-collision`, `-health`, `-motion` and `-render` folders (from 00:37 to 00:41 tonight). Every later preparation counted them as already there, so its `.entries` listed only `horizon-client-structures` (prepared/2a7d4…, 576dd…, 7f9a…), and jobs read the stale resources outside the per-key cache. ## Fix - A failed preparation removes every `.local/` entry it created, then the preparation folder. - Before anything else, a job removes real folders in `.local/` named like preparation outputs: an `.entries` name or `horizon-client*`. - A preparation whose `.entries` lacks `horizon-client` is made again, so the broken preparations repair themselves. #1965 doesn't touch this file, so there is no overlap. ## Test The script ran against a fake checkout: stub `cargo`, plus a fake `horizon-prepare` that writes `.local/horizon-client*` and fails on demand. 1. A failed preparation exits 1. Only the `datagen` and `minecraft` links remain in `.local/`. 2. Stale state (real `.local/horizon-client` and `-render`, plus a preparation listing only structures): both folders are removed, the preparation is made again, and `.local/` gets links to `horizon-client` and `horizon-client-motion`. 3. A rerun uses the cache and prints no messages. `shellcheck -S warning` is clean. ## Diff (tools/ci) ```diff diff --git a/tools/ci/vanilla-data.sh b/tools/ci/vanilla-data.sh index 5276c54e9..f548e1f14 100755 --- a/tools/ci/vanilla-data.sh +++ b/tools/ci/vanilla-data.sh @@ -42,7 +42,21 @@ until mkdir "$lock" 2>/dev/null; do done trap 'rmdir "$lock" 2>/dev/null || true' EXIT # horizon-prepare writes .local/horizon-client and its exporters' outputs beside it: all of them live in -# $prepared, listed in $prepared/.entries, and .local/ links to them. +# $prepared, listed in $prepared/.entries, and .local/ links to them. A real folder of that kind in .local/ is +# what an older failed preparation left: it would hide the preparations (and a new one would not count it as its +# own output), so it goes. +outputs=$({ cat "$shared"/prepared/*/.entries; cd .local && ls -d horizon-client*; } 2>/dev/null || true) +for name in $(echo "$outputs" | LC_ALL=C sort -u); do + if [ -e ".local/$name" ] && [ ! -L ".local/$name" ]; then + rm -rf ".local/${name:?}" + echo "Removed .local/$name, left by a failed preparation" + fi +done +# A preparation made while such a folder was there did not list it (horizon-client above all), so it is made again. +if [ -f "$prepared/.entries" ] && ! grep -qx horizon-client "$prepared/.entries"; then + echo "Preparation $key lacks horizon-client: preparing again" + rm -rf "$prepared" +fi if [ ! -f "$prepared/.entries" ]; then echo "Preparing resources with this checkout's horizon-prepare ($key)" rm -rf "$prepared" && mkdir -p "$prepared" @@ -55,6 +69,9 @@ if [ ! -f "$prepared/.entries" ]; then cargo build --release --locked -p horizon-prepare if ! target/release/horizon-prepare --root "$PWD" > "$RUNNER_TEMP/prepare.log" 2>&1; then tail -40 "$RUNNER_TEMP/prepare.log" + # Nothing of a failed preparation stays in .local/: the next job prepares again. + LC_ALL=C comm -13 <(echo "$before") <(ls -1A .local | LC_ALL=C sort) | + while read -r name; do rm -rf ".local/${name:?}"; done rm -rf "$prepared" exit 1 fi ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:13:17 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#3920
No description provided.