This is a reformulation of #12463 which aims to be more boring and easier to review. A significant part of the change is now a scripted-diff and the other bits work up to that.
This is best reviewed on a per-commit basis.
The end result is removing Invalid, and removing 2 args from DoS. Renaming DoS to Reject is a protective measure against undetected merge conflicts, given the call flexibility of DoS.