Fix: Re-run verified installer inputs
This commit is contained in:
@@ -116,6 +116,41 @@ grep -q '/etc/profile.d/nvm.sh' "$stage" \
|
||||
git -C "$repo_dir" check-ignore -q "$extension/node_modules" 2>/dev/null \
|
||||
|| note 'the extension node_modules is not gitignored'
|
||||
|
||||
# npm must honour the committed dependency graph. This disposable fixture
|
||||
# simulates npm rejecting a mismatched lockfile, which must leave that lockfile
|
||||
# untouched and keep the launcher stage nonfatal.
|
||||
fixture_root="$(mktemp -d -t panama-vicinae-lock.XXXXXX)"
|
||||
trap 'rm -rf -- "$fixture_root"' EXIT
|
||||
mkdir -p "$fixture_root/config/local/share/vicinae/scripts" \
|
||||
"$fixture_root/config/local/share/vicinae/extensions/panama-search/src" \
|
||||
"$fixture_root/bin"
|
||||
printf '{"name":"panama-search","dependencies":{"left-pad":"1.3.0"}}\n' \
|
||||
>"$fixture_root/config/local/share/vicinae/extensions/panama-search/package.json"
|
||||
printf '{"lockfileVersion":3,"packages":{}}\n' \
|
||||
>"$fixture_root/config/local/share/vicinae/extensions/panama-search/package-lock.json"
|
||||
lockfile="$fixture_root/config/local/share/vicinae/extensions/panama-search/package-lock.json"
|
||||
lock_before="$fixture_root/package-lock.before"
|
||||
cp -- "$lockfile" "$lock_before"
|
||||
cat >"$fixture_root/bin/npm" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
printf '%s\n' "$*" >>"${NPM_LOG:?}"
|
||||
[[ "${1:-}" == ci ]] || exit 64
|
||||
exit 1
|
||||
EOF
|
||||
chmod +x "$fixture_root/bin/npm"
|
||||
stage_status=0
|
||||
stage_output="$(PATH="$fixture_root/bin:$PATH" PANAMA_PATH="$fixture_root" \
|
||||
VICINAE_DATA_DIR="$fixture_root/vicinae-data" NPM_LOG="$fixture_root/npm.log" \
|
||||
bash "$stage" 2>&1)" || stage_status=$?
|
||||
[[ "$stage_status" -eq 0 ]] \
|
||||
|| note "the Vicinae stage returned $stage_status for a lockfile mismatch instead of remaining nonfatal"
|
||||
[[ "$(<"$fixture_root/npm.log")" == 'ci --silent' ]] \
|
||||
|| note 'the Vicinae extension dependency command was not npm ci --silent'
|
||||
[[ "$stage_output" == *'Vicinae extension panama-search did not build; skipping'* ]] \
|
||||
|| note 'a nonzero Vicinae extension dependency install did not fail the extension build'
|
||||
cmp -s -- "$lock_before" "$lockfile" \
|
||||
|| note 'a rejected Vicinae lockfile mismatch changed package-lock.json'
|
||||
|
||||
# ── Report ───────────────────────────────────────────────────────────────────
|
||||
|
||||
if (( ${#findings[@]} > 0 )); then
|
||||
|
||||
Reference in New Issue
Block a user