fix(jira): clear stale assignee on hand-off to blue team / dual validation
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled

The red_lead reviewer stayed assigned in Jira through blue_evaluating
(and the blue_lead reviewer through in_review) since push_test_event
never touched the assignee on those transitions — only red_executing
and the review gates did. Both are hand-offs with no single owner yet,
so the assignee is cleared instead of left stale.

Also fixes push_bt_work_started never assigning the blue_tech who
actually picks up the queued test — it only moved the status to
In Progress before.
This commit is contained in:
kitos
2026-07-10 16:49:16 +02:00
parent 0fc2427f71
commit 337faf824d
2 changed files with 48 additions and 1 deletions
+23 -1
View File
@@ -149,6 +149,26 @@ def test_push_test_event_maps_every_state_to_jira_status(
mock_jira.set_issue_status.assert_called_once_with(link.jira_issue_key, expected_status)
@pytest.mark.parametrize("new_state", ["blue_evaluating", "in_review"])
@patch("app.services.jira_service.has_admin_jira_configured", return_value=True)
@patch("app.services.jira_service.get_admin_jira_client")
def test_push_test_event_clears_assignee_on_handoff(mock_get_client, mock_configured, db, new_state):
"""Regression: the previous reviewer's assignment must not linger on the
ticket after a hand-off to a different team / dual-validation stage —
e.g. approving red_review left the red_lead reviewer stuck as assignee
all through blue_evaluating."""
mock_jira = MagicMock()
mock_get_client.return_value = mock_jira
test = _make_test()
link = _make_link(test.id)
db.add(link)
db.commit()
jira_service.push_test_event(db, test, MagicMock(username="alice", jira_account_id=None), new_state)
mock_jira.assign_issue.assert_called_once_with(link.jira_issue_key, account_id=None)
@patch("app.services.jira_service.has_admin_jira_configured", return_value=True)
@patch("app.services.jira_service.get_admin_jira_client")
def test_push_bt_work_started_sets_in_progress(mock_get_client, mock_configured, db):
@@ -163,9 +183,11 @@ def test_push_bt_work_started_sets_in_progress(mock_get_client, mock_configured,
db.add(link)
db.commit()
jira_service.push_bt_work_started(db, test, MagicMock(username="bob"))
actor = MagicMock(username="bob", jira_account_id="bob-account-id")
jira_service.push_bt_work_started(db, test, actor)
mock_jira.set_issue_status.assert_called_once_with(link.jira_issue_key, "In Progress")
mock_jira.assign_issue.assert_called_once_with(link.jira_issue_key, account_id="bob-account-id")
@patch("app.services.jira_service.has_admin_jira_configured", return_value=True)