Skip to content

Commit a75f246

Browse files
committed
Let the protocol tests run on a branch that declares a version
Tagging 2026.08.1 turned its CI red, and every release branch and tag after it would have gone the same way. The thirteen build jobs pass on that tree; what fails is two tests that assume the repository derives its version, which a release branch is precisely the thing that does not. The version test walks real first-parent history asserting each version precedes the next, and on a release branch every commit answers with the same declared string. It already knows how to say a walk has nothing to walk -- a PR merge ref collapses the range -- so a declared version becomes the second reason. Skipping now leaves the rest of the file running, which matters because the checks below it are about declared versions and were being skipped on the only branches that have one. The monotonicity test builds its own history in a clone and exercises the derived path throughout, so the clone drops VERSION if the branch it came from carries one, rather than assuming none does.
1 parent db4d1a5 commit a75f246

2 files changed

Lines changed: 35 additions & 12 deletions

File tree

tests/protocol/test-describe-monotonicity.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ field() {
2222

2323
cd "$clone"
2424

25+
# The clone inherits whatever branch this runs from, and a release branch
26+
# carries a VERSION. Everything below exercises the derived path, which a
27+
# declared version turns off -- so the clone starts without one rather than
28+
# assuming the branch has none.
29+
if git cat-file -e HEAD:VERSION 2>/dev/null; then
30+
git rm -q VERSION
31+
git commit -aq -m 'test: derive versions rather than read them'
32+
fi
33+
2534
# describe fails when the candidate's committer date precedes its parent's.
2635
parent_epoch=$(git log -1 --format=%ct HEAD)
2736
skewed_epoch=$(( parent_epoch - 3600 ))

tests/protocol/test-describe-version.sh

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ vercmp() {
1919
python3 "$repository_root/scripts/vercmp.py" "$1" "$2"
2020
}
2121

22+
# The same file describe reads to decide a version is declared.
23+
VERSION_PATH=VERSION
24+
2225
cd "$repository_root"
2326
head_rev=$(git rev-parse HEAD)
2427

@@ -39,20 +42,31 @@ version_b=$(describe --profile vita --revision "$head_rev" | field version)
3942
# The walkable range starts where describe's own files were introduced, not history's root.
4043
introduced=$(git log --first-parent --format=%H --diff-filter=A -- cmake/Profiles.cmake | tail -1)
4144
range_count=$(git rev-list --first-parent --count "${introduced}~1..$head_rev")
42-
# A PR merge ref's first parent is master, where describe's files do not
43-
# exist yet, so the walkable range collapses to the merge commit alone.
44-
# The guards themselves are covered by the synthetic-history test; the
45-
# real-history walk waits for a ref that carries it (any master push).
46-
(( range_count >= 2 )) || {
47-
printf 'skipping the real-history walk: %s describe-capable commit(s) on the first-parent line\n' \
48-
"$range_count"
49-
exit 0
50-
}
45+
46+
# Reasons the walk has nothing to walk. Neither is a failure, and neither
47+
# stops the checks below it: skipping used to exit, which took the stable
48+
# declaration with it on exactly the branches that have one.
49+
skip_walk=""
50+
if git cat-file -e "$head_rev:$VERSION_PATH" 2>/dev/null; then
51+
# Every commit on a release branch answers with what VERSION says, so
52+
# there is no derived version here to be monotonic. The derivation and
53+
# its guards are covered by the synthetic-history test, which builds
54+
# the history it needs instead of borrowing this one.
55+
skip_walk="$head_rev declares a version"
56+
elif (( range_count < 2 )); then
57+
# A PR merge ref's first parent is master, where describe's files do not
58+
# exist yet, so the walkable range collapses to the merge commit alone.
59+
skip_walk="$range_count describe-capable commit(s) on the first-parent line"
60+
fi
5161

5262
chain=()
53-
while read -r rev; do
54-
chain+=("$rev")
55-
done < <(git rev-list --first-parent "${introduced}~1..$head_rev")
63+
if [[ -n $skip_walk ]]; then
64+
printf 'skipping the real-history walk: %s\n' "$skip_walk"
65+
else
66+
while read -r rev; do
67+
chain+=("$rev")
68+
done < <(git rev-list --first-parent "${introduced}~1..$head_rev")
69+
fi
5670

5771
previous_version=
5872
previous_rev=

0 commit comments

Comments
 (0)