Skip to content

Conversation

rowanseymour
Copy link
Member

No description provided.

@Copilot Copilot AI review requested due to automatic review settings September 3, 2025 17:07
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR consolidates multiple ticket update hooks into a single unified hook that updates all ticket fields. It simplifies the architecture by replacing separate hooks for assignee changes, topic changes, and activity updates with one comprehensive UpdateTickets hook.

Key changes:

  • Modified ticket modifiers to directly update ModifiedOn and LastActivityOn fields
  • Created a new UpdateTickets hook that handles all ticket field updates
  • Removed three specialized hooks (UpdateTicketAssignee, UpdateTicketTopic, UpdateTicketActivity)

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
core/tickets/modifiers.go Added timestamp updates directly in modifier functions
core/runner/hooks/update_tickets.go New unified hook for updating all ticket fields
core/runner/hooks/update_ticket_*.go Removed specialized hooks for assignee, topic, and activity updates
core/runner/handlers/ticket_*.go Updated to use the new unified UpdateTickets hook
core/models/ticket_test.go Replaced separate test functions with comprehensive UpdateTickets test
core/models/ticket.go Replaced multiple update functions with single UpdateTickets function using bulk query

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +19 to +23
now := dates.Now()
prevAssignee := oa.UserByID(ticket.AssigneeID)

ticket.AssigneeID = assigneeID
ticket.ModifiedOn = now
Copy link
Preview

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The newAssignee variable referenced in line 25 is not defined. It should be oa.UserByID(assigneeID) to get the new assignee reference.

Copilot uses AI. Check for mistakes.


for _, args := range scenes {
for _, item := range args {
tickets = append(tickets, item.([]*models.Ticket)...)
Copy link
Preview

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type assertion without checking could cause a panic if the item is not of type []*models.Ticket. Consider using a type switch or checking the assertion result.

Suggested change
tickets = append(tickets, item.([]*models.Ticket)...)
if ts, ok := item.([]*models.Ticket); ok {
tickets = append(tickets, ts...)
} else {
return fmt.Errorf("unexpected type in scenes: got %T, want []*models.Ticket", item)
}

Copilot uses AI. Check for mistakes.

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 3.22581% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.21%. Comparing base (bf96987) to head (50e88a0).

Files with missing lines Patch % Lines
core/tickets/modifiers.go 0.00% 13 Missing ⚠️
core/runner/hooks/update_tickets.go 0.00% 12 Missing ⚠️
core/models/ticket.go 33.33% 1 Missing and 1 partial ⚠️
core/runner/handlers/ticket_assignee_changed.go 0.00% 1 Missing ⚠️
core/runner/handlers/ticket_note_added.go 0.00% 1 Missing ⚠️
core/runner/handlers/ticket_topic_changed.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #780      +/-   ##
==========================================
+ Coverage   50.17%   50.21%   +0.03%     
==========================================
  Files         260      258       -2     
  Lines       15250    15231      -19     
==========================================
- Hits         7652     7648       -4     
+ Misses       6799     6785      -14     
+ Partials      799      798       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rowanseymour rowanseymour merged commit 3cd6d15 into main Sep 3, 2025
5 checks passed
@rowanseymour rowanseymour deleted the update_tickets branch September 3, 2025 19:52
@github-actions github-actions bot locked and limited conversation to collaborators Sep 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants