2.4 KiB
2.4 KiB
03 Ticket Status Changed Trigger
Implementation guide: Ticket Implementation Guide
Branch
codex/v0.5-webhook-notification/03-ticket-status-changed-trigger
Start this branch from codex/v0.5-webhook-notification/02-project-notification-settings-ui.
Goal
Trigger notification deliveries when a ticket status actually changes.
Requirements
- Add a
TicketStatusChangedevent or equivalent internal event object. - Emit the event from the existing ticket move action only when the ticket moves to a different status.
- Do not emit the event for no-op moves where the destination status is already current.
- Build a reusable event payload that includes:
- project id, key, and name
- ticket id, key, title, and absolute ticket URL
- actor id and name when available
- origin status id and label
- destination status id and label
- occurred timestamp
- Add a listener or action that finds enabled project notification actions for
ticket_status_changed. - Queue one delivery job per matching action.
- Keep existing worklog behavior for status changes.
Acceptance Criteria
- Moving a ticket to a new status queues delivery jobs for all enabled matching actions in the ticket project.
- Disabled actions are ignored.
- Actions from other projects are ignored.
- No-op moves do not queue delivery jobs.
- Ticket movement responses and worklog entries remain unchanged.
Tests
- Ticket move feature tests asserting jobs are queued for enabled matching actions.
- Tests asserting disabled, foreign-project, and wrong-event actions are ignored.
- Test asserting no-op moves do not dispatch notifications.
- Test asserting the event payload contains the expected ticket URL and status labels.
Verification
vendor/bin/pint --dirty --format agentphp artisan test --compact tests/Feature/Projects tests/Feature/Notificationsphp artisan test --compact tests/Feature/Api/TicketApiTest.php tests/Feature/Mcpgit diff --check
Commit And Push
- Commit only this ticket's changes.
- Push with
git push origin codex/v0.5-webhook-notification/03-ticket-status-changed-trigger.
Out of Scope
- Actual webhook HTTP request execution
- Actual Discord HTTP request execution
- Delivery attempt UI
- User bell notifications
- Unread counters
- Slack, Teams, email, or other channels
- Incoming webhooks
- API or MCP management endpoints