feat(plugins): fire domain hooks from ticket + assignment services#97
Merged
Conversation
Wires the plugin hook dispatch into the core write paths so registered
plugins are actually exercised end-to-end (the prior PR landed the
mechanism + lifecycle hooks only).
Actions dispatched:
* ticket_created (TicketService.create)
* ticket_replied / internal_note_added (TicketService.reply)
* ticket_status_changed + ticket_resolved/closed/reopened
(TicketService.transition_status)
* ticket_priority_changed (TicketService.change_priority)
* ticket_assigned / ticket_unassigned (AssignmentService)
Filters applied in TicketService.list: ticket_list_query (the Ecto query
before execution) and ticket_list_data (the loaded list). Hook names
mirror the Laravel HookRegistry (unprefixed, since the Escalated.Plugins
namespace already scopes them).
Also reflows a few pre-existing over-length lines that mix format
rewraps now the files are touched, and reorders one alias group.
Verified in the CI toolchain (Elixir 1.15/OTP 26): mix format, credo
--strict, mix test (548 tests, 0 failures).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #96. That PR landed the plugin hook dispatch mechanism and the activation lifecycle hooks; this one wires the dispatch into the core ticket write paths so registered plugins actually fire end-to-end during real ticket operations.
Actions dispatched
From
Escalated.Services.TicketService:ticket_created— on createticket_replied/internal_note_added— on reply (byis_internal)ticket_status_changed, plusticket_resolved/ticket_closed/ticket_reopened— on status transitionticket_priority_changed— on priority changeFrom
Escalated.Services.AssignmentService:ticket_assigned/ticket_unassignedFilters applied
In
TicketService.list/1:ticket_list_query— the Ecto query before executionticket_list_data— the loaded ticket listHook names mirror the Laravel
HookRegistry(unprefixed here, since theEscalated.Pluginsnamespace already scopes them). Dispatch runs after each write commits and is failure-isolated — a raising plugin is logged and skipped, never breaking a ticket operation.Notes
ticket_service_hooks_test.exs) that activates a capturing plugin and asserts the real service calls fireticket_created,ticket_status_changed+ticket_resolved,ticket_replied/internal_note_added, and that aticket_list_datafilter transformslist/1output.mix formatrewraps now the files are touched, and alphabetizes one alias group (both surfaced by CI's PR-scoped format/credo checks).Escalated.Plugins.Hooksmoduledoc now lists the hooks the core services dispatch.Verification
Ran the exact CI toolchain (Elixir 1.15 / OTP 26) in a container:
mix format --check-formattedclean,mix credo --strictno issues,mix test548 tests, 0 failures.