Skip to content

Commit ae8fd2c

Browse files
committed
fix(test): keep the version contract alive under pipefail with no tags
The tag lookup and one mutual-consistency call ended in pipelines whose grep legitimately matches nothing — no v* tags in a --no-tags CI checkout, no bare-return form in server.json. Under `set -euo pipefail` that exit status killed the contract mid-run: it exited 1 having printed nothing, which reads like a failure that forgot to explain itself, and in the tagless case it died before it could report that its truth source was unavailable. Found by running the contract in a real `git clone --no-tags --depth 1`, not by inspection. With the guards, that clone now passes while announcing the degradation, and still fails on a drifted surface through mutual consistency alone. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 5821078 commit ae8fd2c

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

‎tests/test_version_metadata_contract.sh‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,18 @@ fail() {
6565
# a user can actually fetch.
6666
newest_tag=""
6767
if git rev-parse --git-dir >/dev/null 2>&1; then
68+
# `|| true` is load-bearing: under pipefail a tagless clone makes grep exit
69+
# 1, and set -e would kill the contract HERE — exiting non-zero with no
70+
# output at all, in exactly the venue (a --no-tags CI checkout) where this
71+
# gate most needs to say what it could and could not verify.
6872
newest_tag=$(
69-
git tag -l 'v*' 2>/dev/null |
70-
grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' |
71-
sed 's/^v//' |
72-
sort -t. -k1,1n -k2,2n -k3,3n |
73-
tail -1
73+
{
74+
git tag -l 'v*' 2>/dev/null |
75+
grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' |
76+
sed 's/^v//' |
77+
sort -t. -k1,1n -k2,2n -k3,3n |
78+
tail -1
79+
} || true
7480
)
7581
fi
7682

0 commit comments

Comments
 (0)