test(labels): reproduce moving base-tip warning
Some checks failed
CI / self-guards (pull_request) Successful in 12s
CI / release-exercise (pull_request) Successful in 15s
CI / action-exercise (pull_request) Successful in 8s
CI / docs-sync-exercise (pull_request) Successful in 8s
Refs guard / refs-not-closing (pull_request) Successful in 8s
labels / labels (pull_request) Successful in 10s
CI / test (pull_request) Failing after 45s

This commit is contained in:
codex-bot-andresmgsl 2026-08-31 21:04:41 +00:00
parent 85290031b2
commit 328c8707df

View file

@ -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)"