@@ -141,38 +141,53 @@ jobs:
141141 restore-keys : |
142142 nile-fixture-
143143
144- - name : Build trond + download Nile fixture (if cache miss)
145- if : steps.fixture-cache.outputs.cache-hit != 'true'
144+ - name : Build trond + download Nile fixture (if absent)
145+ # Guard on whether the fixture is actually PRESENT, not on
146+ # cache-hit. actions/cache sets cache-hit='true' only on an EXACT
147+ # key match; a `restore-keys: nile-fixture-` prefix fallback (the
148+ # common case when the weekly key rolls) still restores last
149+ # week's fixture into ./nile-fixture but reports cache-hit=false.
150+ # The old `if: cache-hit != 'true'` then re-ran the download into
151+ # a dir that already had a database, and `snapshot download`
152+ # (correctly) refuses to clobber without --force → exit 10
153+ # HUMAN_REQUIRED. Any restored snapshot is fine for equivalence
154+ # (both Go and Java diff the same copy), so: present → use it;
155+ # absent → cold download + prune.
146156 run : |
147157 set -euo pipefail
148- go build -o bin/trond ./
149- ./bin/trond snapshot download \
150- --network nile --type lite \
151- --to ./nile-fixture
152- # snapshot download streams gunzip|tar straight to disk and
153- # never persists the .tgz, so there is nothing to clean up
154- # here. Guard that the extracted layout the test expects
155- # actually materialised, so a future download-format change
156- # fails here instead of as a confusing SKIP downstream.
157158 DB=./nile-fixture/output-directory/database
158- test -d "$DB" \
159- || { echo "::error::fixture missing output-directory/database after download"; exit 1; }
160- # Prune to the 8 dbfork stores. A full Nile snapshot is ~90 GB,
161- # dominated by block/trans/pbft-sign-data which dbfork never
162- # touches — java DbFork's initStore() and Go's Apply open only
163- # these 8 stores. The test makes TWO scratch copies, so keeping
164- # the bulk overflowed the runner disk ("no space left on
165- # device"). Pruning frees ~40+ GB and is what gets cached, so
166- # cache-hit runs are already lean.
167- KEEP="witness witness_schedule account properties asset-issue-v2 account-asset contract storage-row"
168- for d in "$DB"/*/; do
169- name=$(basename "$d")
170- case " $KEEP " in
171- *" $name "*) : ;; # keep the 8 dbfork stores
172- *) rm -rf "$d" ;; # drop everything else
173- esac
174- done
175- echo "Pruned fixture to dbfork stores; remaining:"
159+ if [ -d "$DB" ]; then
160+ echo "Fixture already present (exact or restore-keys cache hit); skipping download + prune."
161+ else
162+ go build -o bin/trond ./
163+ ./bin/trond snapshot download \
164+ --network nile --type lite \
165+ --to ./nile-fixture
166+ # snapshot download streams gunzip|tar straight to disk and
167+ # never persists the .tgz, so there is nothing to clean up
168+ # here. Guard that the extracted layout the test expects
169+ # actually materialised, so a future download-format change
170+ # fails here instead of as a confusing SKIP downstream.
171+ test -d "$DB" \
172+ || { echo "::error::fixture missing output-directory/database after download"; exit 1; }
173+ # Prune to the 8 dbfork stores. A full Nile snapshot is ~90 GB,
174+ # dominated by block/trans/pbft-sign-data which dbfork never
175+ # touches — java DbFork's initStore() and Go's Apply open only
176+ # these 8 stores. The test makes TWO scratch copies, so keeping
177+ # the bulk overflowed the runner disk ("no space left on
178+ # device"). Pruning frees ~40+ GB and is what gets cached, so
179+ # the restored fixture on later runs is already lean.
180+ KEEP="witness witness_schedule account properties asset-issue-v2 account-asset contract storage-row"
181+ for d in "$DB"/*/; do
182+ name=$(basename "$d")
183+ case " $KEEP " in
184+ *" $name "*) : ;; # keep the 8 dbfork stores
185+ *) rm -rf "$d" ;; # drop everything else
186+ esac
187+ done
188+ echo "Pruned fixture to dbfork stores."
189+ fi
190+ echo "Fixture stores:"
176191 ls -1 "$DB"
177192 df -h . | tail -1
178193
0 commit comments