fix(tests): pause reopen timer, lock edits to assignee, restore Jira operator on reopen
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
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
- reopen_red_review starts the timer paused (paused_at set) instead of immediately running, since the operator hasn't resumed working yet — blue already did this via blue_work_started_at, red needed the same behavior via the existing pause/resume mechanism. - update_test_red/update_test_blue now lock edits to the actual assigned operator for leads too, not just techs — a lead could previously edit another operator's in-progress test. Mirrored in TeamTabs.tsx. - push_test_event reassigns the Jira ticket to the original operator (not the reopening lead) when a test returns to red_executing or blue_evaluating for rework, instead of leaving it on the lead.
This commit is contained in:
@@ -828,9 +828,12 @@ def push_test_event(
|
||||
link.jira_issue_key, target_status, exc_t,
|
||||
)
|
||||
|
||||
# When the operator starts execution: assign the ticket to that operator.
|
||||
# When the operator starts execution: assign the ticket to that
|
||||
# operator. On reopen (rework), *actor* is the lead who reopened
|
||||
# it, not the operator who should keep working it — the caller
|
||||
# passes the original red_tech_assignee as *assignee* in that case.
|
||||
if new_state == "red_executing":
|
||||
jira_account_id = getattr(actor, "jira_account_id", None)
|
||||
jira_account_id = getattr(assignee or actor, "jira_account_id", None)
|
||||
if jira_account_id:
|
||||
try:
|
||||
jira.assign_issue(link.jira_issue_key, account_id=jira_account_id)
|
||||
@@ -859,12 +862,30 @@ def push_test_event(
|
||||
link.jira_issue_key, jira_account_id, exc_a,
|
||||
)
|
||||
|
||||
# Both are hand-off points to a different team with no single owner
|
||||
# yet: blue_evaluating is queued for Blue Team (whoever reviewed the
|
||||
# red side is done with it), and in_review is dual-validation by both
|
||||
# leads at once. Leaving the previous assignee (red/blue reviewer)
|
||||
# stuck on the ticket is misleading, so clear it.
|
||||
if new_state in ("blue_evaluating", "in_review"):
|
||||
# blue_evaluating is reached two different ways: a fresh hand-off
|
||||
# from Red (no blue_tech_assignee yet — queued, no owner) or a
|
||||
# reopen/rework of a test some blue_tech already had (assignee is
|
||||
# still set) — that operator should get the ticket back, not have
|
||||
# it clear. in_review is always dual-validation by both leads at
|
||||
# once, so it never has a single owner.
|
||||
if new_state == "blue_evaluating":
|
||||
if test.blue_tech_assignee:
|
||||
reassignee = db.query(User).filter(User.id == test.blue_tech_assignee).first()
|
||||
jira_account_id = getattr(reassignee, "jira_account_id", None)
|
||||
else:
|
||||
jira_account_id = None
|
||||
try:
|
||||
jira.assign_issue(link.jira_issue_key, account_id=jira_account_id)
|
||||
logger.info(
|
||||
"%s Jira ticket %s (state=%s)",
|
||||
"Reassigned" if jira_account_id else "Unassigned", link.jira_issue_key, new_state,
|
||||
)
|
||||
except Exception as exc_a:
|
||||
logger.warning(
|
||||
"Could not update assignee on %s for state %s: %s",
|
||||
link.jira_issue_key, new_state, exc_a,
|
||||
)
|
||||
elif new_state == "in_review":
|
||||
try:
|
||||
jira.assign_issue(link.jira_issue_key, account_id=None)
|
||||
logger.info("Unassigned Jira ticket %s (state=%s)", link.jira_issue_key, new_state)
|
||||
|
||||
Reference in New Issue
Block a user