@@ -104,6 +104,22 @@ class McpControllerTest < ActionDispatch::IntegrationTest
104104 assert_equal "mcp-srv" , result . dig ( "earliest" , "server" )
105105 end
106106
107+ test "find_failure_origin flags same-commit boundary as flaky" do
108+ base = Time . now . utc . change ( usec : 0 )
109+ good = create_report ( @server , base - 10 . hours , SHA_HEAD , success : true )
110+ good . update! ( branch : "4.0" )
111+ bad = create_report ( @server , base - 5 . hours , SHA_HEAD , success : false )
112+ bad . update! ( branch : "4.0" )
113+ LogExcerpt . create! ( report : bad , content : "TestFlaky#test_same_commit failed" )
114+
115+ result = call_tool ( "find_failure_origin" , { branch : "4.0" , query : "test_same_commit" } )
116+ config = result [ "configs" ] . first
117+ assert_equal bad . id , config . dig ( "first_bad" , "id" )
118+ assert_equal good . id , config . dig ( "last_good" , "id" )
119+ assert_nil config [ "compare_url" ]
120+ assert_match "flaky" , config [ "note" ]
121+ end
122+
107123 test "find_failure_origin with unmatched query" do
108124 result = call_tool ( "find_failure_origin" , { branch : "master" , query : "no_such_failure" } )
109125 assert_match "No failure log" , result [ "message" ]
0 commit comments