Skip to content

Commit 9c45200

Browse files
committed
Invalidate cache via policy extra instead of wiping directory
Using CachePolicy(extra={'cache_generation': ...}) keys the cache, so bumping it leaves old entries on disk but unreachable — eventually evicted by the 50GB soft-cap mtime pass. Avoids churning the whole directory and is friendlier if multiple branches share the cache.
1 parent 983256c commit 9c45200

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

.github/workflows/test_full.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,6 @@ jobs:
5050
# Purge stale staging dirs from crashed previous runs (safe: atomic-rename commits)
5151
rm -rf "$STYXCACHE_DIR/.incoming" 2>/dev/null || true
5252
53-
# Invalidate the whole cache when the styxcache version changes:
54-
# legacy entries may lack data (e.g. persisted stdout) that newer
55-
# versions expect, and missing-file handling is silent — so we rebuild.
56-
version=$(uv run python -c "from importlib.metadata import version; print(version('styxcache'))")
57-
marker="$STYXCACHE_DIR/.styxcache_version"
58-
if [ ! -f "$marker" ] || [ "$(cat "$marker")" != "$version" ]; then
59-
echo "styxcache version changed (now $version); wiping cache"
60-
find "$STYXCACHE_DIR" -mindepth 1 -maxdepth 1 -exec rm -rf {} +
61-
echo "$version" > "$marker"
62-
fi
63-
6453
size_kb=$(du -sk "$STYXCACHE_DIR" 2>/dev/null | awk '{print $1}')
6554
size_kb=${size_kb:-0}
6655
cap_kb=$(( STYXCACHE_MAX_GB * 1024 * 1024 ))

tests/full_pipeline/conftest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,12 @@ def _niwrap_session_runner(
9797
wrapped = _AttrProxyCachingRunner(
9898
base=runner,
9999
cache_dir=cache_dir,
100-
policy=CachePolicy(image_digest=resolver),
100+
policy=CachePolicy(
101+
image_digest=resolver,
102+
# Bump to invalidate when styxcache storage semantics change
103+
# (e.g. 0.1.x entries lacked persisted stdout).
104+
extra={"cache_generation": "2026-1"},
105+
),
101106
)
102107
niwrap.set_global_runner(wrapped)
103108
return wrapped

0 commit comments

Comments
 (0)