fix(scripts): parse the apm version from stdout and its banner only

require_apm_version merged stderr into the --version output and took the
first X.Y.Z. When `uv run --frozen` syncs first, uv prints
`Using CPython 3.14.6` on stderr, so the check parsed 3.14.6 and passed
whatever apm reported. It now reads stdout only, matches apm's
`version X.Y.Z` banner, and shows the captured stderr only on failure.

The fake uv in the seam B test now writes that line to stderr, so the
regression stays pinned. Resolve the repo root with CDPATH cleared.

Refs: #271

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
This commit is contained in:
Defame1297andClaude Opus 5.5 committed 2026-12-02 09:47:30 +00:00
1 parent a48f0fdf5b
commit 615d3dd881
2 files changed
+22 -6

No files matched your search

+4 -1
View File
@@ -48,6 +48,9 @@ if [[ "\${1:-}" != run || "\${2:-}" != --project || "\${4:-}" != --frozen || "\$
exit 97
fi
shift 5
# What a real \`uv run --frozen\` prints on stderr when it syncs first. The
# version check must parse apm's stdout, never this (review round 1 of #271).
echo "Using CPython 3.14.6" >&2
exec "$BIN/apm" "\$@"
EOF
@@ -165,7 +168,7 @@ for pair in "apm-audit-ci:$AUDIT" "apm-pack-check-clean:$PACK"; do
done
reset_logs
run_gate "$FIXTURE" "$script" STUB_APM_OUTPUT="apm, version unknown"
[[ $RC -ne 0 ]] && grep -qF "printed no version" <<< "$OUT" \
[[ $RC -ne 0 ]] && grep -qF "printed no 'version X.Y.Z'" <<< "$OUT" \
&& pass "$label: fails when the version cannot be read" \
|| fail "$label: an unreadable version must fail clearly (rc=$RC): $OUT"
done