Skip to content

Drive JSON-namespace content-model lock from a single map#1109

Closed
JeroenDeDauw wants to merge 1 commit into
masterfrom
feature/content-model-namespace-map
Closed

Drive JSON-namespace content-model lock from a single map#1109
JeroenDeDauw wants to merge 1 commit into
masterfrom
feature/content-model-namespace-map

Conversation

@JeroenDeDauw

@JeroenDeDauw JeroenDeDauw commented Jul 20, 2026

Copy link
Copy Markdown
Member

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.

AI-authored — Claude Code, Opus 4.8 (max); detailed spec from @JeroenDeDauw, built autonomously (no interactive human steering); diff not yet human-reviewed; TDD + mutation-checked, independently AI-reviewed (one test-quality fix applied), full PHPUnit + phpcs + phpstan and CI green.

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
JeroenDeDauw force-pushed the feature/content-model-namespace-map branch from e8acef2 to 7d0efe1 Compare July 20, 2026 20:39
@JeroenDeDauw

Copy link
Copy Markdown
Member Author

Independent Fable max insists this is good, but I think it's nonsense adding accidental complexity

@JeroenDeDauw
JeroenDeDauw deleted the feature/content-model-namespace-map branch July 20, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant