Drive JSON-namespace content-model lock from a single map#1109
Closed
JeroenDeDauw wants to merge 1 commit into
Closed
Drive JSON-namespace content-model lock from a single map#1109JeroenDeDauw wants to merge 1 commit into
JeroenDeDauw wants to merge 1 commit into
Conversation
NeoWiki's Schema, Layout and Mapping namespaces are each locked to a single JSON content model. The lock was enforced in two hand-maintained places: the ContentModelCanBeUsedOn hook, which enumerated the three namespace/model pairs by hand, and each content handler's canBeUsedOn(). It had no test coverage, so adding a fourth JSON namespace risked silently shipping it unprotected. Introduce NamespaceContentModels as the single source of truth mapping each namespace to its content model, and drive both the hook and the handlers from it. Behaviour is unchanged: the hook and handlers now read the lock from one place instead of several hand-kept lists, so they cannot drift out of sync. Add data-driven tests that iterate the map and assert, for each namespace, that the matching model is allowed and foreign models (wikitext and other NeoWiki models) are rejected — covering the hook directly and the real save path — plus a test pinning the concrete namespace/model pairs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
JeroenDeDauw
force-pushed
the
feature/content-model-namespace-map
branch
from
July 20, 2026 20:39
e8acef2 to
7d0efe1
Compare
Member
Author
|
Independent Fable max insists this is good, but I think it's nonsense adding accidental complexity |
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.
NeoWiki's Schema, Layout and Mapping namespaces are each locked to a single
JSON content model. The lock was enforced in two hand-maintained places: the
ContentModelCanBeUsedOn hook, which enumerated the three namespace/model pairs
by hand, and each content handler's canBeUsedOn(). It had no test coverage, so
adding a fourth JSON namespace risked silently shipping it unprotected.
Introduce NamespaceContentModels as the single source of truth mapping each
namespace to its content model, and drive both the hook and the handlers from
it. Behaviour is unchanged: the hook and handlers now read the lock from one
place instead of several hand-kept lists, so they cannot drift out of sync.
Add data-driven tests that iterate the map and assert, for each namespace,
that the matching model is allowed and foreign models (wikitext and other
NeoWiki models) are rejected — covering the hook directly and the real save
path — plus a test pinning the concrete namespace/model pairs.