Page MenuHomePhabricator

Port EventBus PageChangeHooks to Domain Events
Closed, DuplicatePublic20 Estimated Story Points

Description

Currently EventBus uses the hooks API for sending mediawiki/page/change events
that represent changes to the current state of how a MediaWiki Page
looks to a non-logged-in / anonymous / public user.

We should refactor the use of hooks and adopt the new Domain Events API instead.

This means replacing the PageChangeHooks implementation with their respective event listeners:
PageSaveCompleteHook.

AC:

Not that at the time of writing not all hooks have been implemented (2025-04)

  • PageSaveCompleteHook has been replaced with PageRevisionUpdatedEvent
  • PageMoveCompleteHook has been replaced with PageMovedEvent
  • PageDeleteCompleteHook has been replaced with PageDeletedEvent
  • PageUndeleteCompleteHook has been replaced with ...
  • PageDeleteHook has been replaced with PageDeletedEvent
  • ArticleRevisionVisibilitySetHook has been replaced with {}.

Things to keep in mind (input from @daniel ):

  • We don't need and EventIngress class per listener, but a generic one for all page state changes (PageStateIngress?)
  • we might need to share code between hooks and listeners. This will require some ad hoc service wiring. Growth's implementation has examples we can piggyback on
  • ImportableOldRevisionImporter could give some inspiration on how to implement an integration test strategy

Event Timeline

We don't need and EventIngress class per listener, but a generic one for all page state changes (PageStateIngress?)

We had the same sentiment when we refactored EventBusHooks into the per-purpose/stream hook handlers...for which we got around to making one of: PageChangeHooks. Could this then be called PageChangeEventIngress ? Or something like that? An EventIngress class who's purpose it is is to emit mediawiki.page_change.v1 events?

We don't need and EventIngress class per listener, but a generic one for all page state changes (PageStateIngress?)

We had the same sentiment when we refactored EventBusHooks into the per-purpose/stream hook handlers...for which we got around to making one of: PageChangeHooks. Could this then be called PageChangeEventIngress ? Or something like that? An EventIngress class who's purpose it is is to emit mediawiki.page_change.v1 events?

Ack. It seems reasonable to have naming that reflects the intention to handle mediawiki.page_change.v1 events.