test(npm): plant the macOS cache layout too

From the Codex re-gate: the planted-binary check used only ~/.cache, so
the old macOS fallback (~/Library/Caches) would have escaped it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V3syn2fN2LNo5pvTSqc6eh
This commit is contained in:
hermes 2026-10-16 09:53:49 +00:00
commit 537b01901f

View file

@ -109,10 +109,13 @@ XDG_CACHE_HOME="${smoke_dir}/user-cache" IDX_BINARY_URL="${repo_root}/target/rel
# Without an absolute cache root (empty HOME) there is no cache fallback, so a # Without an absolute cache root (empty HOME) there is no cache fallback, so a
# binary planted under the current directory is never run. # binary planted under the current directory is never run.
planted_dir="${smoke_dir}/planted" planted_dir="${smoke_dir}/planted"
planted="${planted_dir}/.cache/idx-mcp/$(node -p 'require("./npm/idx-mcp/package.json").version')/$(node -p 'process.platform + "-" + process.arch')/idx-mcp" planted_rel="idx-mcp/$(node -p 'require("./npm/idx-mcp/package.json").version')/$(node -p 'process.platform + "-" + process.arch')/idx-mcp"
mkdir -p "$(dirname "$planted")" # Both cache layouts: ~/.cache (Linux) and ~/Library/Caches (macOS).
printf '#!/bin/sh\necho PLANTED\n' > "$planted" for planted in "${planted_dir}/.cache/${planted_rel}" "${planted_dir}/Library/Caches/${planted_rel}"; do
chmod +x "$planted" mkdir -p "$(dirname "$planted")"
printf '#!/bin/sh\necho PLANTED\n' > "$planted"
chmod +x "$planted"
done
if (cd "$planted_dir" && HOME='' XDG_CACHE_HOME='' "${read_only_dir}/node_modules/.bin/idx-mcp" --help 2>&1) | grep -q PLANTED; then if (cd "$planted_dir" && HOME='' XDG_CACHE_HOME='' "${read_only_dir}/node_modules/.bin/idx-mcp" --help 2>&1) | grep -q PLANTED; then
echo "npm smoke: the launcher ran a binary from the current directory" >&2 echo "npm smoke: the launcher ran a binary from the current directory" >&2
exit 1 exit 1