Page MenuHomePhabricator

Post-processing jobs are not executed in autoedit
Open, Needs TriagePublic

Description

When there are some SMW queries with @annotation (see here and this PR) and the page is edited with some editor, then on the next page view SMW is recomputing these queries (which have self-referencing values) and reloads the page.

With the autoedit these postproc operations are not executed and the resulting semantic state is wrong. A workaround is to open the edited page to trigger the refresh, but it is suboptimal.

Event Timeline

Is this a bug in Page Forms or in Semantic MediaWiki?

Probably more in Page Forms, but perhaps Semantic MediaWiki could be improved also to better handle this situation.

According to my first researches, the annotated queries are discovered during the parse and it is then needed to trigger the API { action: 'smwtask', task: 'check-query', params: { subject: 'title#0##', origin: 'api-postproc', ref: ['50811…'] } to finalize the rendering, where the refs comes from the parsing (through ParserOutput::getExtensionData( 'smw-postedit-update' )). I have not an extensive understanding of the internal mechanisms, perhaps @mwjames you could have a more informed viewpoint than me.

If I understand correctly, autoedit does an internal save with the EditPage, but does not parse the result (right?). If it is needed to parse the result to discover if there are or not annotated queries, it would be a possibly expansive operation hence it would probably be better to do it only if the user requests it -- to avoid penalizing most pages where there are no annotated queries.

On the (internal) wiki where I saw these annotated queries with autoedit used, I hacked MediaWiki ApiParse.php to access the ParserOutput::getExtensionData( 'smw-postedit-update' ) and modified lib/PF_autoedit.js to first parse the modified page, requesting the refs, then executing the API smwtask. It adds significant delay time.