As noted here by @SomeRandomDeveloper: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1090544/comment/47886e8c_81e16373/
Many of the IEditConstraint classes do not set the human-readable error messages in the StatusValue objects they return from their getLegacyStatus() methods, or set them incorrectly (with missing or wrong message parameters).
This works because the messages are not used in these cases. EditPage recognizes some specific error codes (set in the StatusValue object's value), and some specific IEditConstraint classes, and generates its own error messages from scratch.
I think the constraint classes should always generate the error messages, and EditPage should just display them instead of duplicating this code. There are some comments in EditPage suggesting that this was the original vision of the refactor, just not quite implemented:
- https://gerrit.wikimedia.org/g/mediawiki/core/+/b2041fb9ee0fc3d8f32db68f14cd8745b9fdd7fe/includes/editpage/EditPage.php#1830
- https://gerrit.wikimedia.org/g/mediawiki/core/+/b2041fb9ee0fc3d8f32db68f14cd8745b9fdd7fe/includes/editpage/Constraint/IEditConstraint.php#50
EditPage will still need to special-case some errors (e.g. edit conflicts, or errors that can be supressed like BrokenRedirectConstraint), but the "default" error message should be generated by the constraint class, not by EditPage. This would let us also remove a third duplicate of this code in ApiEditPage:
(BTW, getLegacyStatus() should be renamed to just getStatus(). It's not "legacy" in the usual meaning of the word, I don't understand where that name came from.)