test: cover stale unassigned claims

This commit is contained in:
codex-bot-andresmgsl 2026-07-22 19:24:45 +00:00
parent 561b7a99ec
commit cbb0fb5eee
3 changed files with 15 additions and 5 deletions

View file

@ -78,9 +78,9 @@ author_decision() { # $1 = true when author is triage; labels on stdin
claim_decision() { # $1 assignee count, $2 linked open PR, $3 age seconds claim_decision() { # $1 assignee count, $2 linked open PR, $3 age seconds
local assignees="$1" open_pr="$2" age="$3" local assignees="$1" open_pr="$2" age="$3"
if [ "$assignees" -eq 0 ]; then echo FLAG_UNASSIGNED if [ "$open_pr" = false ] && [ "$age" -gt "$STALE_AFTER" ]; then echo RECLAIM
elif [ "$open_pr" = true ] || [ "$age" -le "$STALE_AFTER" ]; then echo KEEP elif [ "$assignees" -eq 0 ]; then echo FLAG_UNASSIGNED
else echo RECLAIM else echo KEEP
fi fi
} }
@ -186,8 +186,12 @@ reconcile_issue() {
ensure_comment "$n" claim-reclaimed \ ensure_comment "$n" claim-reclaimed \
'This claim has no linked open PR and no activity for 48 hours. The sweep is reclaiming it for the ready queue.' 'This claim has no linked open PR and no activity for 48 hours. The sweep is reclaiming it for the ready queue.'
owners="$(jq -r '[.assignees[].login] | join(",")' <<<"$ISSUE_JSON")" owners="$(jq -r '[.assignees[].login] | join(",")' <<<"$ISSUE_JSON")"
run gh issue edit "$n" -R "$REPO" --remove-assignee "$owners" \ if [ -n "$owners" ]; then
--remove-label claimed --add-label ready >/dev/null run gh issue edit "$n" -R "$REPO" --remove-assignee "$owners" \
--remove-label claimed --add-label ready >/dev/null
else
run gh issue edit "$n" -R "$REPO" --remove-label claimed --add-label ready >/dev/null
fi
log "#$n: stale claim reclaimed -> ready" ;; log "#$n: stale claim reclaimed -> ready" ;;
esac esac
elif has_issue_label blocked; then elif has_issue_label blocked; then

View file

@ -34,6 +34,7 @@ check "claim with open PR stays claimed" 0 "KEEP" claim_decision 1 true 999999
check "recent claim without PR stays claimed" 0 "KEEP" claim_decision 1 false 60 check "recent claim without PR stays claimed" 0 "KEEP" claim_decision 1 false 60
check "unassigned claim is flagged" 0 "FLAG_UNASSIGNED" claim_decision 0 false 60 check "unassigned claim is flagged" 0 "FLAG_UNASSIGNED" claim_decision 0 false 60
check "quiet claim without PR is reclaimed" 0 "RECLAIM" claim_decision 1 false $((STALE_AFTER + 1)) check "quiet claim without PR is reclaimed" 0 "RECLAIM" claim_decision 1 false $((STALE_AFTER + 1))
check "quiet unassigned claim is also reclaimed" 0 "RECLAIM" claim_decision 0 false $((STALE_AFTER + 1))
# Invariant 3: blocked declarations parse and release only when all close. # Invariant 3: blocked declarations parse and release only when all close.
refs="$(blocked_references <<< $'Context #99\nBlocked by #12 and #7')" refs="$(blocked_references <<< $'Context #99\nBlocked by #12 and #7')"

View file

@ -12,6 +12,7 @@ trap 'rm -rf "$TMP"' EXIT
printf '%s\n' \ printf '%s\n' \
'panel=one two three' \ 'panel=one two three' \
'triage-actors=triage-one' \
'' \ '' \
'scope:one|C5DEF5|First scope' \ 'scope:one|C5DEF5|First scope' \
'scope:two|C5DEF5|Second scope' >"$TMP/good.conf" 'scope:two|C5DEF5|Second scope' >"$TMP/good.conf"
@ -25,6 +26,10 @@ check "panel is parsed" 0 "one two three" bash -c \
check "core and config rows merge" 0 "scope:two|C5DEF5|Second scope" bash -c \ check "core and config rows merge" 0 "scope:two|C5DEF5|Second scope" bash -c \
'source "$1"; core_label_rows; configured_label_rows "$2"' _ \ 'source "$1"; core_label_rows; configured_label_rows "$2"' _ \
"$ROOT/actions/labels-reconcile/labels-reconcile.sh" "$TMP/good.conf" "$ROOT/actions/labels-reconcile/labels-reconcile.sh" "$TMP/good.conf"
# shellcheck disable=SC2016 # expansion belongs to the nested bash
check "triage config is not parsed as a label row" 1 "" bash -c \
'source "$1"; configured_label_rows "$2" | grep -F triage-actors' _ \
"$ROOT/actions/labels-reconcile/labels-reconcile.sh" "$TMP/good.conf"
check "missing scope config is an empty table" 0 "" configured_label_rows "$TMP/missing.conf" check "missing scope config is an empty table" 0 "" configured_label_rows "$TMP/missing.conf"
printf '%s\n' 'scope:bad|C5DEF5' >"$TMP/bad.conf" printf '%s\n' 'scope:bad|C5DEF5' >"$TMP/bad.conf"