Fixes #22967: move auto-assigned incidents to the Assigned stage - #30594
Fixes #22967: move auto-assigned incidents to the Assigned stage#30594IceS2 wants to merge 4 commits into
Conversation
An incident created on test failure already inherits its assignees from the test case owners, but the resolution workflow always entered NewStage and nothing ever advanced it. The incident stayed in New, and because the TCRS mirror only carries assignee details on Assigned records, the Incident Manager rendered it as unassigned even though the task had assignees. Drive the workflow's own "assign" transition right after the incident task is created when assignees resolved, so the incident lands on the Assigned stage with the owner attached and the TCRS record carries the assignee. Incidents without owners are untouched and stay in New. Stage and transition ids of TestCaseResolutionTaskWorkflow move into IncidentWorkflowStages so the TCRS sync handler and the new assignment path cannot drift apart.
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
Log a warning when an incident has assignees but is not at the New stage, so a broken assumption about synchronous workflow start surfaces instead of silently leaving the incident unassigned. Assert the typed assignee id on the Assigned TCRS record rather than substring-matching the serialized details blob, which could pass on an incidental match elsewhere in the payload.
Code Review ✅ Approved 2 resolved / 2 findingsAutomatically advances newly created incidents with inherited assignees into the Assigned workflow stage, addressing previous test assertions and async workflow concerns. No issues found. ✅ 2 resolved✅ Edge Case: Auto-advance silently no-ops if workflow start is async
✅ Quality: Fragile assignee assertion via details.toString().contains()
OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar | Powered by Gitar — free for open source |
Fixes #22967
Problem
An incident task created on test failure already inherits its assignees from the test case owners (
TestCaseResolutionStatusRepository.createIncidentTask), butTestCaseResolutionTaskWorkflowalways entersNewStageand nothing ever advances it — the only edges out ofNewStageare theack/assign/resolvetransitions a user fires by hand.Two symptoms follow from that single cause:
IncidentTcrsSyncHandler.buildDetailsForStageonly attaches assignee details toAssignedrecords, and the Incident Manager reads the assignee fromtestCaseResolutionStatusDetails.assigneeon the TCRS time series rather than from the taskFix
After the incident task is created, if assignees resolved, drive the workflow's own
assigntransition viaresolveTaskWithWorkflow— the same path a manual assignment takes. Theassigntransition targetsInProgress, so it takes the non-terminal branch: the workflow advances toAssignedStage,CreateTaskstampsworkflowStageId=assigned/status=InProgress, and the resultingpostUpdatemakes the TCRS sync emit anAssignedrecord carrying the assignee.Guarded so it only fires when assignees are non-empty, the task actually sits at stage
new, and anassigntransition is available. Best-effort: an incident that fails to advance is still a usable incident in New, so it never fails test-result ingestion.Incidents with no owners are untouched and stay in New.
Stage and transition ids of the workflow move into a new
IncidentWorkflowStagesholder so the TCRS sync handler and this new path cannot drift apart.InProgressis already inTaskRepository.OPEN_TASK_STATUSES, so incident de-duplication (getOrCreateIncident) andautoCloseIncidentboth still find the incident after it leavesOpen.Verification
AutoAssignIncidentITcovers both directions — owned test case reachesassigned/InProgresswith the owner on the TCRSAssignedrecord, unowned test case staysnew/Openwith noAssignedrecord.Confirmed end to end against a locally built stack:
Known limitation
SetApprovalAssigneesImplstrips the requester from the assignee list to prevent self-approval and does not add them back for workflow-managed tasks. If the user who triggered the test run is the sole owner, the incident ends up unassigned and stays in New — same as a manual assign behaves today. Not addressed here.Greptile Summary
Adds automatic workflow advancement for newly created incidents that inherit assignees.
assigntransition when an owned incident reaches thenewstage.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Result as Failed test result participant Repo as Resolution status repository participant Task as Task repository participant Workflow as Incident workflow participant Sync as TCRS sync handler Result->>Repo: Create or find incident Repo->>Task: Create incident task Task->>Workflow: Start workflow alt Assignees resolved and assign is available Repo->>Task: Resolve assign transition Task->>Workflow: Advance to assigned Workflow->>Task: Persist assigned / InProgress Task->>Sync: Post-update lifecycle event Sync->>Sync: Emit Assigned record with assignee else No assignees Task->>Sync: Post-create lifecycle event Sync->>Sync: Emit New record endReviews (4): Last reviewed commit: "Merge branch 'main' into fix-incident-sh..." | Re-trigger Greptile
Context used: