-
Notifications
You must be signed in to change notification settings - Fork 0
feat: implement issue #806 — dev-lead fix-review addresses advisory findings in code but never resolves the review thread → PRs stall on the advisory gate #840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bb307c8
feat: implement issue #806 — dev-lead fix-review addresses advisory f…
donpetry-bot 769b451
chore: dev-lead update (review-changes) [skip ci-relay]
donpetry-bot 6fcdade
chore: dev-lead update (review-changes) [skip ci-relay]
donpetry-bot 193afcb
chore: dev-lead update (review-changes) [skip ci-relay]
donpetry-bot ff9a517
Merge branch 'main' into dev-lead/issue-806-20260721-1159
don-petry ae92a61
fix(bot): address bot feedback [skip ci-relay]
donpetry-bot 1d6bcc1
fix(bot): address bot feedback [skip ci-relay]
donpetry-bot cbbbc86
fix(reviews): address review comments [skip ci-relay]
donpetry-bot cf0a4a0
chore: dev-lead update (review-changes) [skip ci-relay]
donpetry-bot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,152 @@ | ||
| #!/usr/bin/env bats | ||
| # Tests for pr_auto_review_blocking_thread_count in | ||
| # .github/scripts/pr-auto-review/lib/ready-check.sh | ||
| # | ||
| # Pins issue #806: dev-lead's fix-review cycle addresses an advisory finding in a | ||
| # follow-up commit but frequently never marks the corresponding review thread | ||
| # resolved, so the PR stalls REVIEW_REQUIRED on the unresolved-threads gate even | ||
| # though the code is fixed and CI is green. | ||
| # | ||
| # Consumer-side, defense-in-depth: a review thread that is unresolved but | ||
| # OUTDATED (its anchored diff position no longer exists at HEAD — line changed / | ||
| # file moved) no longer blocks auto-dispatch. GitHub sets reviewThread.isOutdated | ||
| # when the diff anchor shifts (a heuristic, not proof the concern is fixed), so | ||
| # unresolved-but-outdated threads stop blocking without requiring the producer to | ||
| # resolve them. | ||
| # | ||
| # The function reads the `gh api graphql` reviewThreads response on stdin (each | ||
| # node exposing .isResolved and .isOutdated) and prints the count of *blocking* | ||
| # threads — unresolved AND not outdated. | ||
|
|
||
| load 'helpers/setup' | ||
|
|
||
| setup() { | ||
| # shellcheck source=/dev/null | ||
| . "${TT_SCRIPTS_DIR}/lib/ready-check.sh" | ||
| } | ||
|
|
||
| # Build a GraphQL-shaped response from a raw nodes array, matching the shape the | ||
| # reusable workflow passes: .data.repository.pullRequest.reviewThreads.nodes | ||
| resp() { | ||
| printf '{"data":{"repository":{"pullRequest":{"reviewThreads":{"nodes":%s}}}}}' "$1" | ||
| } | ||
|
|
||
| # ── empty / trivial ────────────────────────────────────────────────────────── | ||
|
|
||
| @test "blocking count: no threads → 0" { | ||
| run pr_auto_review_blocking_thread_count <<<"$(resp '[]')" | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = "0" ] | ||
| } | ||
|
|
||
| @test "blocking count: all resolved → 0" { | ||
| run pr_auto_review_blocking_thread_count <<<"$(resp '[{"isResolved":true,"isOutdated":false},{"isResolved":true,"isOutdated":true}]')" | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = "0" ] | ||
| } | ||
|
|
||
| # ── the blocking case: still applies to HEAD ───────────────────────────────── | ||
|
|
||
| @test "blocking count: unresolved and NOT outdated → 1 (still blocks)" { | ||
| run pr_auto_review_blocking_thread_count <<<"$(resp '[{"isResolved":false,"isOutdated":false}]')" | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = "1" ] | ||
| } | ||
|
|
||
| # ── the #806 fix: outdated thread (diff anchor shifted at HEAD) → non-blocking ─ | ||
|
|
||
| @test "blocking count: unresolved but OUTDATED → 0 (diff anchor shifted, non-blocking)" { | ||
| run pr_auto_review_blocking_thread_count <<<"$(resp '[{"isResolved":false,"isOutdated":true}]')" | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = "0" ] | ||
| } | ||
|
|
||
| @test "blocking count: the #805 scenario — three fixed advisory threads all outdated → 0" { | ||
| # Copilot dep-check + two Gemini temp-file findings, each fixed in a follow-up | ||
| # commit that changed the anchored line, so all three threads are outdated. | ||
| run pr_auto_review_blocking_thread_count <<<"$(resp '[ | ||
| {"isResolved":false,"isOutdated":true}, | ||
| {"isResolved":false,"isOutdated":true}, | ||
| {"isResolved":false,"isOutdated":true} | ||
| ]')" | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = "0" ] | ||
| } | ||
|
|
||
| # ── mixed sets: only unresolved-and-current threads count ───────────────────── | ||
|
|
||
| @test "blocking count: mixed set counts only unresolved-and-current threads" { | ||
| # resolved(current), resolved(outdated), unresolved+outdated, unresolved+current | ||
| run pr_auto_review_blocking_thread_count <<<"$(resp '[ | ||
| {"isResolved":true,"isOutdated":false}, | ||
| {"isResolved":true,"isOutdated":true}, | ||
| {"isResolved":false,"isOutdated":true}, | ||
| {"isResolved":false,"isOutdated":false} | ||
| ]')" | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = "1" ] | ||
| } | ||
|
|
||
| @test "blocking count: several unresolved-and-current threads → their count" { | ||
| run pr_auto_review_blocking_thread_count <<<"$(resp '[ | ||
| {"isResolved":false,"isOutdated":false}, | ||
| {"isResolved":false,"isOutdated":false}, | ||
| {"isResolved":false,"isOutdated":true} | ||
| ]')" | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = "2" ] | ||
| } | ||
|
|
||
| # ── fail-safe: missing / null isOutdated on an unresolved thread still blocks ─ | ||
|
|
||
| @test "blocking count: unresolved thread with null isOutdated → 1 (fail safe: still blocks)" { | ||
| run pr_auto_review_blocking_thread_count <<<"$(resp '[{"isResolved":false,"isOutdated":null}]')" | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = "1" ] | ||
| } | ||
|
|
||
| @test "blocking count: unresolved thread with absent isOutdated → 1 (fail safe: still blocks)" { | ||
| run pr_auto_review_blocking_thread_count <<<"$(resp '[{"isResolved":false}]')" | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = "1" ] | ||
| } | ||
|
|
||
| # ── robustness: GraphQL error / missing-data bodies yield 0 ────────────────── | ||
|
|
||
| @test "blocking count: GraphQL error body (no data) → 0" { | ||
| run pr_auto_review_blocking_thread_count <<<'{"errors":[{"message":"Could not resolve to a Repository"}]}' | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = "0" ] | ||
| } | ||
|
|
||
| @test "blocking count: null nodes → 0" { | ||
| run pr_auto_review_blocking_thread_count <<<"$(resp 'null')" | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = "0" ] | ||
| } | ||
|
|
||
| # ── null-safety: absent / null intermediate fields → 0 ────────────────────── | ||
|
|
||
| @test "blocking count: absent .data key → 0" { | ||
| run pr_auto_review_blocking_thread_count <<<'{}' | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = "0" ] | ||
| } | ||
|
|
||
| @test "blocking count: null .data → 0" { | ||
| run pr_auto_review_blocking_thread_count <<<'{"data":null}' | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = "0" ] | ||
| } | ||
|
|
||
| @test "blocking count: absent .data.repository → 0" { | ||
| run pr_auto_review_blocking_thread_count <<<'{"data":{}}' | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = "0" ] | ||
| } | ||
|
|
||
| @test "blocking count: null .data.repository → 0" { | ||
| run pr_auto_review_blocking_thread_count <<<'{"data":{"repository":null}}' | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = "0" ] | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.