diff --git a/scripts/lib/ci-status.sh b/scripts/lib/ci-status.sh index e940edffe..fa82208db 100644 --- a/scripts/lib/ci-status.sh +++ b/scripts/lib/ci-status.sh @@ -30,6 +30,11 @@ # to race an in-progress branch-mutating run. # Matched: # • Bare job name: "review" +# • Nested job form "review / review" — produced once the cascade is invoked +# via the trigger stub (pr-review-trigger.yml → reusable pr-review.yml@ +# pr-review/stable), where the rollup name becomes "callerJob / reusableJob" +# rather than the bare job name (#497 self-host). Matched exactly (not by a +# "/ review" suffix) so a genuine external "Build / review" is NOT filtered. # • "PR Review Agent / *" # • "PR Review Reusable / *" # • "PR Review — Mention Trigger / *" @@ -46,6 +51,7 @@ compute_ci_status() { def is_own_check: (.name // .context // "") as $n | ($n == "review") or + ($n == "review / review") or ($n | test("^PR Review (Agent|Reusable) /")) or ($n | test("^PR Review — Mention Trigger /")); if (. == null or (type != "array")) then "passing" diff --git a/tests/test_ci_status.bats b/tests/test_ci_status.bats index db7cdf871..54e475838 100644 --- a/tests/test_ci_status.bats +++ b/tests/test_ci_status.bats @@ -164,6 +164,30 @@ rollup() { [ "$output" = "passing" ] } +# #497 self-host: invoked via the trigger stub, the cascade's own check appears +# as the nested "review / review" — must still be filtered so a stale/failed own +# check never blocks the agent from re-reviewing. +@test "nested 'review / review' (FAILURE) is filtered out → passing" { + local r + r=$(rollup "$(check_run "review / review" "COMPLETED" "FAILURE")") + run compute_ci_status "$r" + [ "$output" = "passing" ] +} + +@test "nested 'review / review' FAILURE alongside an external pass → passing" { + local r + r=$(rollup "$(check_run "review / review" "COMPLETED" "FAILURE")" "$(check_run "SonarCloud" "COMPLETED" "SUCCESS")") + run compute_ci_status "$r" + [ "$output" = "passing" ] +} + +@test "a genuinely external failing check still → failing (regression guard)" { + local r + r=$(rollup "$(check_run "review / review" "COMPLETED" "FAILURE")" "$(check_run "SonarCloud" "COMPLETED" "FAILURE")") + run compute_ci_status "$r" + [ "$output" = "failing" ] +} + # --------------------------------------------------------------------------- # Dev-lead and generic workflow/job-suffix checks are NOT filtered # Dev-lead can commit back to the PR branch, so it must remain a real CI gate.