Skip to content

Render view error output as HTML instead of wikitext#1076

Draft
malberts wants to merge 1 commit into
masterfrom
fix/view-error-autolink
Draft

Render view error output as HTML instead of wikitext#1076
malberts wants to merge 1 commit into
masterfrom
fix/view-error-autolink

Conversation

@malberts

Copy link
Copy Markdown
Contributor

Follows-up to #1069.

The {{#view}} error box was returned as a bare parser-function string, which MediaWiki treats as wikitext. When an error message interpolates the offending user-supplied argument and that argument holds a URL, the parser autolinks it: the URL is wrapped in an anchor, and a trailing quote is swallowed into the link and percent-encoded, corrupting the surrounding markup.

Wrap the error output in the same isHTML/noparse array the success placeholder and cypher_raw already use, so the parser leaves it alone. The wrapping happens at the handle() boundary rather than inside renderError(): the internal parseArgs()/classifyArgs() plumbing distinguishes an error string from a parsed argument tuple by type, so an armoured array there would be indistinguishable from the tuple.

AI-authored — Claude Code, Fable 5 (max); one-line ask from @malberts after the bug surfaced in an AI review of #1069; no revisions; diff not yet human-reviewed; parser-level regression test seen failing before the fix and passing after, full PHPUnit suite + PHPCS + PHPStan green locally, and both error and success paths verified in a browser on a live dev wiki.

Production notes

Spec and review by Fable 5 (max); implementation and tests by an Opus 4.8 (max) subagent. Browser verification was automated (Playwright) against the bundled demo data, not human-clicked.

The {{#view}} error box was returned as a bare parser-function string, which
MediaWiki treats as wikitext. When an error message interpolates the offending
user-supplied argument and that argument holds a URL, the parser autolinks it:
the URL is wrapped in an anchor, and a trailing quote is swallowed into the link
and percent-encoded, corrupting the surrounding markup.

Wrap the error output in the same isHTML/noparse array the success placeholder
and cypher_raw already use, so the parser leaves it alone. The wrapping happens
at the handle() boundary rather than inside renderError(): the internal
parseArgs()/classifyArgs() plumbing distinguishes an error string from a parsed
argument tuple by type, so an armoured array there would be indistinguishable
from the tuple.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@malberts
malberts force-pushed the fix/view-error-autolink branch from ab62860 to 1df8183 Compare July 17, 2026 18:48
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