Steps to replicate the issue (include links if applicable):
- Ensure CommunityConfiguration extension is installed and CommunityConfigurationExample is not installed.
- Save { "UnexpectedData": 42 } under MediaWiki:ExampleConfig.json
- Install CommunityConfigurationExample
- Go to http://localhost:8080/w/index.php?title=Special:CommunityConfiguration/FooBar
- Without making any changes, hit "Save changes"
On beta, this can be reproduced by putting a similarly invalid config onto an existing page, such as MediaWiki:GrowthExperimentsHomepage.json. Instead of unstalling an extension, non-standard operations such as page moves or page imports might be used to save the invalid content. Locally, uninstalling and reinstalling is the easiest way to reproduce.
What happens?:
An error message:
This happens because the form respects the unrecognized UnexpectedData field in the JSON blob, and re-submits it when making a change.
What should have happened instead?:
No error message, the edit gets saved and UnexpectedData is silently dropped. Note that if the schema in question allowed additional properties, the expected behaviour would be
Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
urbanecm@wmf3345 CommunityConfiguration % git show -s HEAD
commit 633a0ddbb5491a0036afcaa35d82b9a1ed5488e3 (HEAD -> master, origin/master, origin/HEAD)
Author: Michael Große <mgrosse@wikimedia.org>
Date: Fri Apr 19 17:37:50 2024 +0200
Add validation warnings
Only warning about some issues instead of failing will be necessary when
migrating a Schema to a newer version that might have new parameters or
might drop some.
This could in principle be implemented with the existing
`IValidator::validate` method by fully relying on the difference between
`StatusValue::isOK` and `StatusValue::isGood`. However, that difference
is subtle and prone to confusion and thus errors. Though this could be
mitigated with thorough and explicit testing.
For now, this change introduces a second method on `IValidator` to make
it explicit that this will return a StatusValue that is still `OK` if
there are warnings. `::validate` has been renamed to make the intended
functionality explicit.
For now, this change assumes that IValidator will not be stable neither
to implement nor to call by external code. If this assumption changes,
then we may want to reconsider whether these public method signatures
are the best to make stable, or whether we should find a solution that
is more extendable under a stable interface policy. This could, for
example, mean to only expose a single ::validate() method that then
would have a second "mode" parameter that could either be
`IValidator::FOR_READS` or `IValidator::FOR_WRITES`.
Bug: T362042
Change-Id: Ie53284c56f43684256bb3a8cb0e10cf4fd24986e
urbanecm@wmf3345 CommunityConfiguration %
urbanecm@wmf3345 core % git show -s HEAD
commit ce9d259317b876fdd2334d4065230b2f9e1f1510 (HEAD -> master, origin/master, origin/HEAD)
Merge: 10ec2e342a9 ed7e787f32e
Author: [BOT] jenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Date: Mon Apr 22 17:11:41 2024 +0000
Merge "Ignore/fix MediaWiki.Commenting.PropertyDocumentation.WrongStyle"
urbanecm@wmf3345 core %
urbanecm@wmf3345 CommunityConfigurationExample % git show -s HEAD
commit 5596a3e42014e8d88bef8f571d5940ed5d2bacf6 (HEAD -> main, origin/main, origin/HEAD)
Author: Martin Urbanec <martin.urbanec@wikimedia.cz>
Date: Sat Mar 30 20:30:45 2024 +0100
i18n: Add default form labels
urbanecm@wmf3345 CommunityConfigurationExample %Other information (browser name/version, screenshots, etc.):
This is a regression from T362042: Community configuration: Introduce validation warnings. See the conversation on https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CommunityConfiguration/+/1022047/11/tests/phpunit/integration/Specials/GenericFormEditorCapabilityTest.php#104 for more details.




