Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
25 changes: 20 additions & 5 deletions .github/scripts/pr-auto-review/lib/ready-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ pr_auto_review_checks_ready() {

# pr_auto_review_blocking_thread_count
# Reads a review-threads GraphQL response on stdin — the payload of
# `reviewThreads(first:100){nodes{isResolved isOutdated}}` under
# `reviewThreads(first:100){nodes{isResolved isOutdated comments(first:1){nodes{author{__typename}}}}}` under
Comment thread
don-petry marked this conversation as resolved.
Resolved
# .data.repository.pullRequest — and prints the count of threads that should
# BLOCK auto-dispatch: those that are unresolved AND not outdated.
# BLOCK auto-dispatch: those that are unresolved AND not outdated AND not
# posted exclusively by advisory bots.
#
# Why isOutdated (issue #806): dev-lead's fix-review cycle often addresses an
# advisory finding in a follow-up commit but never marks the thread resolved,
Expand All @@ -110,15 +111,29 @@ pr_auto_review_checks_ready() {
# unresolved-but-outdated thread as non-blocking clears the stall without the
# producer having to resolve the thread first.
#
# Why advisory-bot exclusion (issue #892): threads whose comments are all
# from advisory bots (author.__typename == "Bot") represent automated
# nitpick feedback, not human review requests. When CI is green and the only
# unresolved threads are advisory-bot posts, the PR should still be eligible
# for dispatch — otherwise the gate stalls on a human to resolve bot threads
# that dev-lead's fix-review correctly returns no-changes for (empty machine
# findings). A thread is advisory-bot-only when comments.nodes is non-empty
# and every author in that set has __typename == "Bot".
#
# Fail-safe: only an explicit isOutdated == true makes a thread non-blocking;
# a null / absent isOutdated on an unresolved thread still blocks, so a thread
# whose staleness we cannot confirm is never silently dropped. A GraphQL error
# body (no data / null nodes) yields 0.
# whose staleness we cannot confirm is never silently dropped. Similarly, a
# thread with absent or empty comments (cannot confirm all-bot) still blocks.
# A GraphQL error body (no data / null nodes) yields 0.
pr_auto_review_blocking_thread_count() {
jq -r '
def is_advisory_bot_thread:
(.comments?.nodes? // []) as $c
| ($c | length) > 0 and ([$c[] | .author?.__typename? == "Bot"] | all);
Comment thread
don-petry marked this conversation as resolved.
Resolved

[
(.data.repository.pullRequest.reviewThreads.nodes[]? |
select((.isResolved == false) and (.isOutdated != true)))?
select((.isResolved == false) and (.isOutdated != true) and (is_advisory_bot_thread | not)))?
Comment thread
don-petry marked this conversation as resolved.
Resolved
] | length
'
}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-auto-review-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
# silently reporting 0 blocking threads and dispatching. The pure
# function only has to tolerate a well-formed-but-empty payload.
# shellcheck disable=SC2016 # $owner/$repo/$number are GraphQL variable refs, not shell vars
_GQL='query($owner:String!,$repo:String!,$number:Int!){repository(owner:$owner,name:$repo){pullRequest(number:$number){reviewThreads(first:100){nodes{isResolved isOutdated}}}}}'
_GQL='query($owner:String!,$repo:String!,$number:Int!){repository(owner:$owner,name:$repo){pullRequest(number:$number){reviewThreads(first:100){nodes{isResolved isOutdated comments(first:1){nodes{author{__typename}}}}}}}}'

Check failure on line 214 in .github/workflows/pr-auto-review-reusable.yml

View workflow job for this annotation

GitHub Actions / Lint

214:201 [line-length] line too long (232 > 200 characters)
THREADS_JSON=$(gh api graphql \
-f "query=$_GQL" \
-f owner="${REPO%%/*}" \
Expand Down
19 changes: 19 additions & 0 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

116 changes: 116 additions & 0 deletions node_modules/bats-assert/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading