From d2f3ccae5902f8a5be32a1f05094c90f33399ac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Jos=C3=A9=20Garc=C3=ADa=20Garc=C3=ADa?= Date: Tue, 25 Aug 2026 21:38:41 +0200 Subject: [PATCH] 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. --- tests/protocol/test-describe-monotonicity.sh | 9 +++++ tests/protocol/test-describe-version.sh | 38 +++++++++++++------- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/tests/protocol/test-describe-monotonicity.sh b/tests/protocol/test-describe-monotonicity.sh index 598cff7..a24ac52 100755 --- a/tests/protocol/test-describe-monotonicity.sh +++ b/tests/protocol/test-describe-monotonicity.sh @@ -22,6 +22,15 @@ field() { cd "$clone" +# The clone inherits whatever branch this runs from, and a release branch +# carries a VERSION. Everything below exercises the derived path, which a +# declared version turns off -- so the clone starts without one rather than +# assuming the branch has none. +if git cat-file -e HEAD:VERSION 2>/dev/null; then + git rm -q VERSION + git commit -aq -m 'test: derive versions rather than read them' +fi + # describe fails when the candidate's committer date precedes its parent's. parent_epoch=$(git log -1 --format=%ct HEAD) skewed_epoch=$(( parent_epoch - 3600 )) diff --git a/tests/protocol/test-describe-version.sh b/tests/protocol/test-describe-version.sh index 24710dc..aab7eb3 100755 --- a/tests/protocol/test-describe-version.sh +++ b/tests/protocol/test-describe-version.sh @@ -19,6 +19,9 @@ vercmp() { python3 "$repository_root/scripts/vercmp.py" "$1" "$2" } +# The same file describe reads to decide a version is declared. +VERSION_PATH=VERSION + cd "$repository_root" head_rev=$(git rev-parse HEAD) @@ -39,20 +42,31 @@ version_b=$(describe --profile vita --revision "$head_rev" | field version) # The walkable range starts where describe's own files were introduced, not history's root. introduced=$(git log --first-parent --format=%H --diff-filter=A -- cmake/Profiles.cmake | tail -1) range_count=$(git rev-list --first-parent --count "${introduced}~1..$head_rev") -# A PR merge ref's first parent is master, where describe's files do not -# exist yet, so the walkable range collapses to the merge commit alone. -# The guards themselves are covered by the synthetic-history test; the -# real-history walk waits for a ref that carries it (any master push). -(( range_count >= 2 )) || { - printf 'skipping the real-history walk: %s describe-capable commit(s) on the first-parent line\n' \ - "$range_count" - exit 0 -} + +# Reasons the walk has nothing to walk. Neither is a failure, and neither +# stops the checks below it: skipping used to exit, which took the stable +# declaration with it on exactly the branches that have one. +skip_walk="" +if git cat-file -e "$head_rev:$VERSION_PATH" 2>/dev/null; then + # Every commit on a release branch answers with what VERSION says, so + # there is no derived version here to be monotonic. The derivation and + # its guards are covered by the synthetic-history test, which builds + # the history it needs instead of borrowing this one. + skip_walk="$head_rev declares a version" +elif (( range_count < 2 )); then + # A PR merge ref's first parent is master, where describe's files do not + # exist yet, so the walkable range collapses to the merge commit alone. + skip_walk="$range_count describe-capable commit(s) on the first-parent line" +fi chain=() -while read -r rev; do - chain+=("$rev") -done < <(git rev-list --first-parent "${introduced}~1..$head_rev") +if [[ -n $skip_walk ]]; then + printf 'skipping the real-history walk: %s\n' "$skip_walk" +else + while read -r rev; do + chain+=("$rev") + done < <(git rev-list --first-parent "${introduced}~1..$head_rev") +fi previous_version= previous_rev=