Page MenuHomePhabricator

Parsoid: use current revision rendering to enable selser, when no stash key/etag is provided.
Closed, ResolvedPublic

Description

When the client requests a html-to-wikitext transformation but does not provie a render key, we should use the latest known rendering of the page (or specified revision) as the context for selser. The latest known rendering should be obtained from ParsoidOutputAccess (or later, ParserOutputAccess), so we make use of ParserCache.

NOTE: Parsoid currently performs re-parsing of the base wikitext, see ContentModelHandler::setupSelser(). However, this bypasses caching. It is preferrable to do this in a higher layer such as HtmlInputTransformHelper, so we can make use of ParsoidOutputAccess.
NOTE: This should work regardless of whether the input is HTML or a PageBundle (fix T146187)
WARNING: @Arlolra said on Slack that if the client does send a render key (etag), but we don't have that exact rendering cached/stashed, we MUST NOT fall back to re-parsing, but MUST return status 412 right away. The client can then retry saving the content without providing the etag, if desired.

Event Timeline

daniel renamed this task from Parsoid: use current page rendering to enable selser, when no stash key/etag is provided. to Parsoid: use current revision rendering to enable selser, when no stash key/etag is provided..Sep 26 2022, 3:40 PM

Change 835695 had a related patch set uploaded (by Daniel Kinzler; author: Daniel Kinzler):

[mediawiki/core@master] WIP: Selser: fall back to re-rendering if needed.

https://gerrit.wikimedia.org/r/835695

Change 835695 merged by jenkins-bot:

[mediawiki/core@master] html2wt: fall back to re-rendering if needed.

https://gerrit.wikimedia.org/r/835695