Add an on-wiki JSON configuration page at MediaWiki:NeoWiki - #1139
Merged
Conversation
JeroenDeDauw
marked this pull request as ready for review
July 23, 2026 15:51
Member
Author
A vetted subset of NeoWiki configuration (dereferenceSubjectsToDataTab, autoRenderMainSubject) becomes settable on the MediaWiki:NeoWiki JSON page: strict save-time validation, per-setting page-wins-over-LocalSettings combining with never-throw fallback, schema-generated on-page reference, preloaded example, and a kill-switch. Squash of the reviewed branch after master gained the boolean dereference setting (#1141) the branch already contained. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
JeroenDeDauw
force-pushed
the
feature/on-wiki-config
branch
from
July 23, 2026 15:53
57f8c9c to
1c30078
Compare
onConfigPageBeforePageDisplay reduced the config page to its JSON table on every 'view' action. A diff request (?diff=) also resolves to the 'view' action, so the comparison table was discarded and replaced by the framed current revision; guard against it so diffs of MediaWiki:NeoWiki render normally. The trim also took everything from the mw-json table to the end of the body. Core wraps that table in <div class="noresize">, so the slice re-emitted the wrapper's orphaned closing </div>, leaving the framed view with unbalanced HTML (the reference block escaped #mw-content-text). Extract the balanced <table>...</table> element instead. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add an on-wiki JSON configuration page at MediaWiki:NeoWiki
A wiki administrator without server access can set a vetted subset of NeoWiki's configuration on the
MediaWiki:NeoWikipage. It holds JSON and is forced to the JSON content model on exactly that title, soMediaWiki gives it
editinterface+editsitejsonedit protection, JSON syntax enforcement, and the JSONeditor for free. Set
$wgNeoWikiEnableInWikiConfigtofalseto disable it entirely: the page is thennever given the content model, validated, or read.
Exposed settings (the allowlist is the security boundary)
dereferenceSubjectsToDataTab$wgNeoWikiDereferenceSubjectsToDataTabtrue|falseautoRenderMainSubject$wgNeoWikiAutoRenderMainSubjecttrue|falseEvery other setting stays exclusive to
LocalSettings.php, deliberately:NeoWikiSparqlStoresisinfrastructure and carries secrets (secrets never go on-wiki);
NeoWikiRdfBaseUrire-mints every IRI whenchanged, too consequential for a wiki page;
NeoWikiEnableDevelopmentUIis dev-only. Future settings arevetted and added one at a time.
Precedence and failure semantics
Per setting, a valid value on the page wins; otherwise the
LocalSettings.phpvalue (itself theextension.json default) applies. A missing page, unparseable JSON, a value of the wrong shape, or an
unavailable database all fall back to
LocalSettings.phprather than throwing — a config typo must not takedown the wiki (the NeoWikiConfigFactory stance). The read path is tolerant and forward-compatible: unknown
keys are ignored, and one NeoWiki-channel warning is logged when the page exists but a value (or the whole
document) is unusable. The page is read at most once per request (memoized on a request-scoped source) and
never during extension registration.
Saving is strict: an EditFilter rejects non-object JSON, unknown keys, and wrong-typed values with precise,
i18n'd, per-field errors, so a typo is caught where the admin can fix it.
One schema structure (
ConfigSchema→ConfigSetting) defines each key once and drives save validation, thegenerated on-page reference table, and the preloaded example, so they cannot drift. A test pins the preloaded
example against the validator.
The two existing consumers now read through the combining lookup:
ResolveSubjectIriApi::dataTabDereference()andNeoWikiExtension::shouldAutoRenderMainSubject(), each as astrict boolean. Their existing contracts hold whichever source supplied the value.
Documentation affordances (that title only, kill-switch-gated)
pointer and the schema-generated reference table (page key | accepted value | LocalSettings.php setting).
The key and setting columns are plain text; the accepted value shows the literal JSON values (
true/false) as<code>spans.Parser-cache staleness
dereferenceSubjectsToDataTabis read at request time, so it takes effect immediately.autoRenderMainSubjectaffects rendered page HTML, so already-cached pages keep their previous rendering until they re-parse (or a
?action=purge) — accepted, and stated in the docs.Alternatives considered and rejected
as the primary mechanism: it is a dependency, and form-first where NeoWiki wants a small JSON-first page with
no new dependency. It stays composable — PHP/LocalSettings remains authoritative underneath, so a form layer
could sit on top later.
NeoWiki must work on plain MediaWiki, and the JSON page composes under any such layer since the values still
resolve through the same PHP settings.
Considered, omitted
ConfigSettingfixes the value shape directly with no discriminator; the enum machinery (and itsConfigValueType) was dropped when the dereference target became boolean, and is re-added with the firstgenuinely differently-shaped setting.
NeoWikiConfigvalue object: kept separate and lazy so the eager configVO never triggers a DB read and behavioural settings stay overridable in tests without a singleton rebuild.
Ported from the Maps extension's
MediaWiki:Mapspattern (PRs ProfessionalWiki/Maps#925 and #928), scaled totwo settings and NeoWiki's hexagonal layering.