77import pytest
88
99import jira_reactions
10- from jira_reactions import comment_task_finished , comment_task_started
10+ from jira_reactions import comment_task_started
1111
1212JIRA_META = {"jira_cloud_id" : "cloud-1" , "jira_issue_key" : "KAN-1" }
1313
@@ -36,7 +36,6 @@ def test_non_jira_source_is_noop(self, monkeypatch):
3636 monkeypatch .setenv ("JIRA_API_TOKEN" , "jira_at" )
3737 with patch ("jira_reactions.requests.post" ) as post :
3838 comment_task_started ("linear" , JIRA_META )
39- comment_task_finished ("linear" , JIRA_META , success = True )
4039 post .assert_not_called ()
4140
4241 def test_empty_metadata_is_noop (self , monkeypatch ):
@@ -74,31 +73,14 @@ def test_skips_when_token_missing(self, monkeypatch):
7473 post .assert_not_called ()
7574
7675
77- class TestFinishComment :
78- def test_success_with_pr_includes_pr_url (self , monkeypatch ):
79- monkeypatch .setenv ("JIRA_API_TOKEN" , "jira_at" )
80- with patch ("jira_reactions.requests.post" , return_value = _resp (201 )) as post :
81- comment_task_finished (
82- "jira" , JIRA_META , success = True , pr_url = "https://github.com/o/r/pull/7"
83- )
84- text = post .call_args [1 ]["json" ]["body" ]["content" ][0 ]["content" ][0 ]["text" ]
85- assert "✅" in text
86- assert "https://github.com/o/r/pull/7" in text
87-
88- def test_success_without_pr_notes_no_pr (self , monkeypatch ):
89- monkeypatch .setenv ("JIRA_API_TOKEN" , "jira_at" )
90- with patch ("jira_reactions.requests.post" , return_value = _resp (201 )) as post :
91- comment_task_finished ("jira" , JIRA_META , success = True , pr_url = None )
92- text = post .call_args [1 ]["json" ]["body" ]["content" ][0 ]["content" ][0 ]["text" ]
93- assert "✅" in text
94- assert "No pull request" in text
76+ class TestTerminalCommentDemoted :
77+ """Since issue #573 the fan-out plane (``dispatchToJira``) owns the Jira
78+ terminal comment, so the agent no longer exposes ``comment_task_finished``.
79+ This pins the demotion so a future refactor can't silently re-introduce a
80+ duplicate terminal comment on the agent side."""
9581
96- def test_failure_comment (self , monkeypatch ):
97- monkeypatch .setenv ("JIRA_API_TOKEN" , "jira_at" )
98- with patch ("jira_reactions.requests.post" , return_value = _resp (201 )) as post :
99- comment_task_finished ("jira" , JIRA_META , success = False , pr_url = None )
100- text = post .call_args [1 ]["json" ]["body" ]["content" ][0 ]["content" ][0 ]["text" ]
101- assert "❌" in text
82+ def test_comment_task_finished_is_gone (self ):
83+ assert not hasattr (jira_reactions , "comment_task_finished" )
10284
10385
10486class TestFailureIsSwallowed :
@@ -107,7 +89,6 @@ def test_http_500_does_not_raise(self, monkeypatch):
10789 with patch ("jira_reactions.requests.post" , return_value = _resp (500 , "boom" )):
10890 # Must not raise.
10991 comment_task_started ("jira" , JIRA_META )
110- comment_task_finished ("jira" , JIRA_META , success = True )
11192
11293 def test_request_exception_does_not_raise (self , monkeypatch ):
11394 import requests
@@ -130,7 +111,7 @@ def test_opens_after_threshold_consecutive_401s(self, monkeypatch):
130111 calls_after_open = post .call_count
131112 # Further calls short-circuit without hitting the network.
132113 comment_task_started ("jira" , JIRA_META )
133- comment_task_finished ("jira" , JIRA_META , success = True )
114+ comment_task_started ("jira" , JIRA_META )
134115 assert post .call_count == calls_after_open
135116
136117 def test_2xx_resets_failure_counter (self , monkeypatch ):
0 commit comments