Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions scripts/lib/ci-status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 / *"
Expand All @@ -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"
Expand Down
24 changes: 24 additions & 0 deletions tests/test_ci_status.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading