While I was testing around for T402809, I noticed some logstash errors while testing Special:RevisionDelete.
invalid revision for page 0 Cannot create visibility change event for mediawiki.page_change.v1: Current revision could not be loaded from database and may have been deleted. Cannot create visibility change event for mediawiki.page_change.v1.
ReqId: 7767daf3-8d80-9ed4-844f-e50d5a75702e
This happen on PHP 8.3 and 8.1, so it's not about the PHP version.
I can reproduce by using the "change visibility" buttons on any of the non-current revisions at either:
- https://test.wikipedia.org/w/index.php?title=Page536&action=history or
- https://test.wikipedia.org/wiki/Special:Undelete/YouTube
It seems that PageChangeEventIngress::handlePageHistoryVisibilityChangedEvent in EventBus is catching an InvalidArgumentException exception and logging. It doesn't seem safe to catch such a generic error here. Even if it was a more specific error, throwing and catching seems odd here...the could should just return or something based on things like isCurrent(). I'm not sure why a production error would be thrown. The handler should just filter based on the events it wants. If it want's to ignore events to non-latest revisions, it can just do so.