Feature summary (what you would like to be able to do and where):
I would like to see a function that could potentially allow for the dropping of protection of some modules and templates. Specifically, I would like to see a function where an edit is rejected if an edit to a template or module fails specified tests, including assertions, etc.
Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):
A few years back on Wikipedia an administrator managed to break CS1 while updating a config page. https://en.wikipedia.org/w/index.php?diff=1101715557 As administrators are humans, they are still prone to making mistakes which of course can be undone. Because of how caching works for templates and modules, bad (not necessarily bad-faith) edits can propagate through the database for a long time after the edit was reverted. If there was some sort of tests ran on publish, the edit would have been rejected with a detailed message showing the test that failed. A user able to edit defined tests for a template or module would still be able to publish, but if the tests page is protected, the publishing will fail for other users. The rejection would be logged in a special page, maybe Special:Log/autocodereviewfail.
Benefits (why should this be implemented?):
This would hopefully allow for more liberal editing of templates and modules which are often preemptively protected. Code review is an important mitigation measure for ensuring bad edits do not make it to live templates or modules.