test(labels): prove merge-base fallback
Some checks failed
CI / self-guards (pull_request) Failing after 9s
CI / action-exercise (pull_request) Successful in 9s
CI / release-exercise (pull_request) Successful in 14s
CI / docs-sync-exercise (pull_request) Successful in 7s
labels / labels (pull_request) Successful in 10s
Refs guard / refs-not-closing (pull_request) Successful in 8s
CI / test (pull_request) Successful in 4m18s

This commit is contained in:
codex-bot-andresmgsl 2026-08-31 21:20:35 +00:00
parent 4ce43c4a3b
commit 4bce62e1fa

View file

@ -176,10 +176,12 @@ 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)" "$(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 pure matrix above proves the warning predicate. These two fixtures drive
# the sweep boundary that chooses WHICH base tree feeds it (#275): Forgejo and # the sweep boundary that chooses WHICH base tree feeds it (#275): the
# GitHub both expose the PR's moving base tip beside its fixed merge base, and # reporting Forgejo payload exposes the PR's moving base tip beside its fixed
# using the former manufactures a downgrade after an intervening release. # merge base, and using the former manufactures a downgrade after an
release_shape_ref_probe() { # $1 = phantom | bump # intervening release. A missing merge-base field deliberately keeps the
# specified base-tip fallback for backends that do not supply that fact.
release_shape_ref_probe() { # $1 = phantom | bump | fallback
( (
# shellcheck disable=SC2030 # this probe intentionally isolates its repository fixture # shellcheck disable=SC2030 # this probe intentionally isolates its repository fixture
REPO=owner/repo REPO=owner/repo
@ -190,9 +192,14 @@ release_shape_ref_probe() { # $1 = phantom | bump
: >"$refs" : >"$refs"
case "$mode" in case "$mode" in
phantom) phantom)
head_ver=1.3.0 base_tip_ver=1.4.0 merge_base_ver=1.3.0 ;; head_ver=1.3.0 base_tip_ver=1.4.0 merge_base_ver=1.3.0
merge_base_json='"merge-base"' ;;
bump) bump)
head_ver=1.4.0 base_tip_ver=1.3.0 merge_base_ver=1.3.0 ;; head_ver=1.4.0 base_tip_ver=1.3.0 merge_base_ver=1.3.0
merge_base_json='"merge-base"' ;;
fallback)
head_ver=1.4.0 base_tip_ver=1.4.0 merge_base_ver=unused
merge_base_json=null ;;
*) return 2 ;; *) return 2 ;;
esac esac
# shellcheck disable=SC2317 # reached through the GitHub backend selected above # shellcheck disable=SC2317 # reached through the GitHub backend selected above
@ -214,8 +221,9 @@ release_shape_ref_probe() { # $1 = phantom | bump
*'repos/owner/repo/pulls/701 --jq .requested_reviewers'*) return 0 ;; *'repos/owner/repo/pulls/701 --jq .requested_reviewers'*) return 0 ;;
*repos/owner/repo/pulls/701/reviews*) return 0 ;; *repos/owner/repo/pulls/701/reviews*) return 0 ;;
*repos/owner/repo/pulls/701) *repos/owner/repo/pulls/701)
jq -n '{draft:false,user:{login:"fixture-builder"}, jq -n --argjson merge_base "$merge_base_json" \
head:{sha:"head"},base:{sha:"base-tip"},merge_base:"merge-base", '{draft:false,user:{login:"fixture-builder"},
head:{sha:"head"},base:{sha:"base-tip"},merge_base:$merge_base,
labels:[{name:"state:addressing"},{name:"blocked"}], labels:[{name:"state:addressing"},{name:"blocked"}],
requested_reviewers:[],created_at:"2026-08-31T20:00:00Z"}' ;; requested_reviewers:[],created_at:"2026-08-31T20:00:00Z"}' ;;
*repos/owner/repo/commits/head*) printf '2026-08-31T20:00:00Z\n' ;; *repos/owner/repo/commits/head*) printf '2026-08-31T20:00:00Z\n' ;;
@ -248,6 +256,12 @@ expect "a genuine version bump relative to the merge base keeps the warning text
expect "the genuine-bump guard also compares head with the PR merge base" \ expect "the genuine-bump guard also compares head with the PR merge base" \
$'head\nmerge-base' "$(cat "$RTMP/release-shape-bump-refs")" $'head\nmerge-base' "$(cat "$RTMP/release-shape-bump-refs")"
fallback_shape="$(release_shape_ref_probe fallback)"
expect "a null merge base falls back to the base tip without guessing a warning" \
no "$(grep -q 'release-shaped' <<<"$fallback_shape" && echo yes || echo no)"
expect "the null merge-base fallback compares head with the base tip" \
$'head\nbase-tip' "$(cat "$RTMP/release-shape-fallback-refs")"
# -- drafts are building, whoever is requested -------------------------------- # -- drafts are building, whoever is requested --------------------------------
DRAFT=true HEAD_SHA=head1 REQUESTED="" REVIEWS_JSON='[]' DRAFT=true HEAD_SHA=head1 REQUESTED="" REVIEWS_JSON='[]'
expect "draft PR is building" state:building "$(decide_state)" expect "draft PR is building" state:building "$(decide_state)"