Skip to content

Bind the context parse to the revision and clarify provider docs#1031

Open
malberts wants to merge 1 commit into
provide-content-to-page-property-providersfrom
pr-982-review-fixes
Open

Bind the context parse to the revision and clarify provider docs#1031
malberts wants to merge 1 commit into
provide-content-to-page-property-providersfrom
pr-982-review-fixes

Conversation

@malberts

@malberts malberts commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Follows-up to #982, delivering review fixes onto that PR's
branch (this diff contains only the fixes).

Bind the context parse to the stored revision. The parse that fills categories and parserProperties
ran without a revision id, i.e. as a preview-like parse: revision-context magic words ({{REVISIONID}},
{{REVISIONUSER}}, ...) and parser hooks that read the revision while recording page properties resolved
against nothing, so the recorded values could diverge from what core stored for the same revision. That
mattered little while the parse only fed categories, but the PR publishes the parse products to providers
as the recommended derivation path. The fix passes $revision->getId() through ContentParseParams. The
test pins the behavior with a {{DEFAULTSORT:Rev{{REVISIONID}}}} page: it records Rev without the fix and
Rev<id> with it, and a second stored revision ensures resolving the page's latest revision instead of the
provided one also fails. Verified end to end on a dev stack, where the graph property carries the actual
revision id.

Pin the remaining documented contracts with tests. The content-unavailable sentinels (content,
contentModel empty and parserProperties, categories empty when the main-slot content is hidden) had no
covering test, so type-clean drift such as switching the builder to getContentOrThrow would pass the whole
suite while making undeletion of a page with rev-deleted history fatal in production; the new test suppresses
a real revision and asserts what a provider receives. The contentModel test only exercised wikitext, the
one value a hardcode would also produce, so a JSON page now pins that the model comes from the actual
content. Each test was verified against a production mutation that only it catches.

Docs accuracy in extending.md. The sentence introducing the context now names the content and parse
products (previously it promised content derivation while enumerating only the pre-existing fields), and the
section states when providers actually run: when a revision is stored for a page carrying Subject data
(including undeletions) and during RebuildGraphDatabases runs, with pages whose last Subject was deleted
still qualifying via their subject slot.

Review-fix delivery directed by @malberts over two rounds: he triaged the initial review's findings and
scoped the first delivery to them, then requested a deeper re-review that produced the additional tests and
docs corrections; the history is squashed to one commit and @malberts gave the diff a quick look before requesting review. Findings
come from multi-agent reviews of #982 (code review, security review, test review, adversarial verification
of candidate blockers, with MediaWiki 1.43 core-contract claims checked against core source), and a third,
independent re-review of #982 reproduced the findings these fixes address. All code changes were developed
test-first or mutation-verified, with the full PHPUnit, phpcs, and phpstan gate run locally and the parse
binding verified end to end on a running dev stack.
Context: the NeoWiki codebase, the PR #982 and issue #979 discussions, and MediaWiki 1.43 core source.
Written by Claude Code, Fable 5 (initial fixes at high effort, later additions at max)

@malberts
malberts marked this pull request as ready for review July 15, 2026 13:48
The parse that fills categories and parserProperties ran without a
revision id, i.e. as a preview-like parse: revision-context magic words
({{REVISIONID}}, {{REVISIONUSER}}, ...) and parser hooks that read the
revision while recording page properties resolved against nothing, so
the recorded values could diverge from what core stored for the same
revision. That mattered little while the parse only fed categories, but
the parse products are now published to providers as the recommended
derivation path. The fix passes the revision id through
ContentParseParams. The new test pins the behavior with a
{{DEFAULTSORT:Rev{{REVISIONID}}}} page: it records Rev without the fix
and Rev<id> with it, and a second stored revision ensures resolving the
page's latest revision instead of the provided one also fails.

The content-unavailable sentinels (content and contentModel empty,
parserProperties and categories empty when the main-slot content is
hidden) had no covering test, so type-clean drift such as switching the
builder to getContentOrThrow would pass the whole suite while making
undeletion of a page with rev-deleted history fatal in production; the
new test suppresses a real revision and asserts what a provider
receives. The contentModel test only exercised wikitext, the one value
a hardcode would also produce, so a JSON page now pins that the model
comes from the actual content.

In extending.md, the sentence introducing the context now names the
content and parse products, and the section states when providers
actually run: when a revision is stored for a page carrying Subject
data (including undeletions) and during RebuildGraphDatabases runs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@malberts
malberts force-pushed the pr-982-review-fixes branch from 114b10f to 2116ae6 Compare July 15, 2026 13:50
@malberts
malberts requested a review from JeroenDeDauw July 15, 2026 13:57
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