@@ -84,9 +84,11 @@ def test_detects_top_level_pr_comment_severity_markers
8484
8585 def test_detects_top_level_review_body_severity_markers
8686 payload = payload_with (
87+ head_ref_oid : "head-sha" ,
8788 reviews : [
8889 {
8990 "author" => { "login" => "reviewer" } ,
91+ "commit" => { "oid" => "head-sha" } ,
9092 "state" => "COMMENTED" ,
9193 "body" => "**P1 Badge** paired public PR feedback is missing" ,
9294 "url" => "https://github.com/evalops/example/pull/1#pullrequestreview-1"
@@ -100,6 +102,32 @@ def test_detects_top_level_review_body_severity_markers
100102 assert_equal "p1" , feedback . first . fetch ( :severity )
101103 end
102104
105+ def test_skips_top_level_review_feedback_from_superseded_heads
106+ payload = payload_with (
107+ head_ref_oid : "new-head" ,
108+ reviews : [
109+ {
110+ "author" => { "login" => "chatgpt-codex-connector[bot]" } ,
111+ "commit" => { "oid" => "old-head" } ,
112+ "state" => "COMMENTED" ,
113+ "body" => "**P1 Badge** stale feedback already fixed on the latest head" ,
114+ "url" => "https://github.com/evalops/example/pull/1#pullrequestreview-1"
115+ } ,
116+ {
117+ "author" => { "login" => "reviewer" } ,
118+ "commit" => { "oid" => "new-head" } ,
119+ "state" => "COMMENTED" ,
120+ "body" => "**High Severity** latest-head feedback still blocks" ,
121+ "url" => "https://github.com/evalops/example/pull/1#pullrequestreview-2"
122+ }
123+ ]
124+ )
125+
126+ feedback = EvalOpsReviewThreadGuard . blocking_feedback ( payload , min_severity : "high" )
127+
128+ assert_equal [ "https://github.com/evalops/example/pull/1#pullrequestreview-2" ] , feedback . map { |item | item . fetch ( :url ) }
129+ end
130+
103131 def test_skips_informational_bot_pr_summaries
104132 payload = payload_with (
105133 comments : [
@@ -238,11 +266,12 @@ def test_fetch_connection_tail_uses_connection_specific_cursor
238266
239267 private
240268
241- def payload_with ( comments : [ ] , reviews : [ ] , threads : [ ] )
269+ def payload_with ( comments : [ ] , reviews : [ ] , threads : [ ] , head_ref_oid : nil )
242270 {
243271 "data" => {
244272 "repository" => {
245273 "pullRequest" => {
274+ "headRefOid" => head_ref_oid ,
246275 "comments" => { "nodes" => comments } ,
247276 "reviews" => { "nodes" => reviews } ,
248277 "reviewThreads" => { "nodes" => threads }
0 commit comments