From 328c8707df72aa8c2b1b319501ccc7166737a6fc Mon Sep 17 00:00:00 2001 From: codex-bot-andresmgsl Date: Mon, 31 Aug 2026 21:04:41 +0000 Subject: [PATCH] test(labels): reproduce moving base-tip warning --- test/labels-reconcile.test.sh | 72 +++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/test/labels-reconcile.test.sh b/test/labels-reconcile.test.sh index 9dd791c..c90793f 100755 --- a/test/labels-reconcile.test.sh +++ b/test/labels-reconcile.test.sh @@ -175,6 +175,78 @@ expect "an unreadable head version is silent — never nag on a guess" "" \ expect "a bare head over an unreadable base still warns" yes \ "$(release_shape_warning 41 2.0.0 "" | grep -qF '::warning::' && echo yes || echo no)" +# The pure matrix above proves the warning predicate. These two fixtures drive +# the sweep boundary that chooses WHICH base tree feeds it (#275): Forgejo and +# GitHub both expose the PR's moving base tip beside its fixed merge base, and +# using the former manufactures a downgrade after an intervening release. +release_shape_ref_probe() { # $1 = phantom | bump + ( + REPO=owner/repo + LABELS_CONF="$FIXTURE_CONF" + CEREMONY_FORGE=github + mode="$1" + refs="$RTMP/release-shape-$mode-refs" + : >"$refs" + case "$mode" in + phantom) + head_ver=1.3.0 base_tip_ver=1.4.0 merge_base_ver=1.3.0 ;; + bump) + head_ver=1.4.0 base_tip_ver=1.3.0 merge_base_ver=1.3.0 ;; + *) return 2 ;; + esac + # shellcheck disable=SC2317 # reached through the GitHub backend selected above + gh() { + if [ "$1" = label ] && [ "$2" = list ]; then + core_label_rows | cut -d'|' -f1 + return 0 + fi + if [ "$1" = pr ] && [ "$2" = list ]; then + printf '701\n' + return 0 + fi + if [ "$1" = pr ] && [ "$2" = view ]; then + jq -n '{mergeable:"MERGEABLE",statusCheckRollup:[]}' + return 0 + fi + if [ "$1" = issue ] && [ "$2" = edit ]; then return 0; fi + case "$(forge_stub_path "$*")" in + *'repos/owner/repo/pulls/701 --jq .requested_reviewers'*) return 0 ;; + *repos/owner/repo/pulls/701/reviews*) return 0 ;; + *repos/owner/repo/pulls/701) + jq -n '{draft:false,user:{login:"fixture-builder"}, + head:{sha:"head"},base:{sha:"base-tip"},merge_base:"merge-base", + labels:[{name:"state:addressing"},{name:"blocked"}], + requested_reviewers:[],created_at:"2026-08-31T20:00:00Z"}' ;; + *repos/owner/repo/commits/head*) printf '2026-08-31T20:00:00Z\n' ;; + *repos/owner/repo/contents/VERSION\?ref=head*) + printf 'head\n' >>"$refs" + printf '%s' "$head_ver" | base64 ;; + *repos/owner/repo/contents/VERSION\?ref=base-tip*) + printf 'base-tip\n' >>"$refs" + printf '%s' "$base_tip_ver" | base64 ;; + *repos/owner/repo/contents/VERSION\?ref=merge-base*) + printf 'merge-base\n' >>"$refs" + printf '%s' "$merge_base_ver" | base64 ;; + *) printf '[]\n' ;; + esac + } + main + ) +} + +phantom_shape="$(release_shape_ref_probe phantom)" +expect "an unchanged branch cut before a later base release emits no release-shape warning" \ + no "$(grep -q 'release-shaped' <<<"$phantom_shape" && echo yes || echo no)" +expect "the unchanged-branch guard compares head with the PR merge base" \ + $'head\nmerge-base' "$(cat "$RTMP/release-shape-phantom-refs")" + +bump_shape="$(release_shape_ref_probe bump)" +expect "a genuine version bump relative to the merge base keeps the warning text" \ + yes "$(grep -qF '#701 is release-shaped (version 1.3.0 -> 1.4.0 at its head)' \ + <<<"$bump_shape" && echo yes || echo no)" +expect "the genuine-bump guard also compares head with the PR merge base" \ + $'head\nmerge-base' "$(cat "$RTMP/release-shape-bump-refs")" + # -- drafts are building, whoever is requested -------------------------------- DRAFT=true HEAD_SHA=head1 REQUESTED="" REVIEWS_JSON='[]' expect "draft PR is building" state:building "$(decide_state)"