Page MenuHomePhabricator

ApiVisualEditor parsefragment behaves unexpectedly when context page has Flow-board content model
Closed, ResolvedPublic1 Story Points

Description

This happens locally too, and I don't think it has anything to do with configuration that differs on private wikis.

I'm just using a test page on Office wiki as an example, because I was unable to find any other pages in production where both VisualEditor and Flow are enabled (there is a check that the namespace is enabled for VE).

While logged in, on any page in Office wiki (this doesn't matter because the parameter is specified explicitly), run the following two statements in the JavaScript console:

$.post( '/w/api.php', { 
	action: 'visualeditor', 
	format: 'json', 
	paction: 'parsefragment', 
	page: 'Main Page', 
	wikitext: "{{ping|1=Username}}",
	pst: "1" 
} ).done( 
	function ( resp ) { 
		console.log( 'Main Page', resp.visualeditor ); 
	}
);

$.post( '/w/api.php', { 
	action: 'visualeditor', 
	format: 'json', 
	paction: 'parsefragment', 
	page: 'LQT TestZero', 
	wikitext: "{{ping|1=Username}}",
	pst: "1" 
} ).done( 
	function ( resp ) { 
		console.log( 'LQT TestZero', resp.visualeditor ); 
	}
);

The Main Page one responds normally with an expansion of the ping template. The one with the test page responds with:

{ result: "success", content: "<body data-parsoid='{"dsr":[0,2,0,0]}' lang="en" class="mw-content-ltr sitedir-ltr ltr mw-body mw-body-content mediawiki" dir="ltr"><p data-parsoid='{"dsr":[0,2,0,0]}'>[]</p></body>" }

It looks like Parsoid is hitting an edge case somewhere and serializing an empty array.

Details

Related Gerrit Patches:
mediawiki/extensions/VisualEditor : masterEnsure wikitext is treated as such in PST

Event Timeline

Mattflaschen-WMF raised the priority of this task from to Needs Triage.
Mattflaschen-WMF updated the task description. (Show Details)
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 17 2015, 5:20 AM
Mattflaschen-WMF renamed this task from ApiVisualEditor parsefragment behaves unexpectedly when context page flow-board content model to ApiVisualEditor parsefragment behaves unexpectedly when context page has flow-board content model.Mar 17 2015, 5:23 AM

Part of (probably the root cause, so retitling the bug) is either in Flow or core (or an interaction of the two). Compare:

https://www.mediawiki.org/w/api.php?action=parse&title=MediaWiki&text={{ping|1=Username}}

to:

https://www.mediawiki.org/w/api.php?action=parse&title=Talk:Sandbox&text={{ping|1=Username}}

In the second, instead of rendering the provided text, it renders the Flow board.

Mattflaschen-WMF renamed this task from ApiVisualEditor parsefragment behaves unexpectedly when context page has flow-board content model to API:Parse wrongly outputs the Flow board when the board is only being used as a context title.Mar 17 2015, 5:37 AM
Mattflaschen-WMF claimed this task.
Mattflaschen-WMF updated the task description. (Show Details)
Mattflaschen-WMF triaged this task as High priority.Mar 17 2015, 5:40 AM
Mattflaschen-WMF updated the task description. (Show Details)
In T92934#1124227, @Mattflaschen wrote:

Part of (probably the root cause, so retitling the bug) is either in Flow or core (or an interaction of the two).

It does use the context page's content model by default (giving those results). However, it works fine when contentmodel is specified, which Parsoid already does (@EBernhardson fixed this a while back):

https://www.mediawiki.org/w/api.php?action=parse&title=Talk:Sandbox&text={{ping|1=Username}}&contentmodel=wikitext

So I'm not sure what the issue is. Removing MediaWiki-Parser since I don't see any sign the problem is there.

I'd appreciate if the Parsoid and VE teams could take a look.

Mattflaschen-WMF renamed this task from API:Parse wrongly outputs the Flow board when the board is only being used as a context title to ApiVisualEditor parsefragment behaves unexpectedly when context page has flow-board content model.Mar 17 2015, 5:28 PM
Mattflaschen-WMF removed Mattflaschen-WMF as the assignee of this task.
Mattflaschen-WMF updated the task description. (Show Details)

Change 197412 had a related patch set uploaded (by Mattflaschen):
Ensure wikitext is treated as such in PST

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

Change 197412 merged by jenkins-bot:
Ensure wikitext is treated as such in PST

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

Jdforrester-WMF renamed this task from ApiVisualEditor parsefragment behaves unexpectedly when context page has flow-board content model to ApiVisualEditor parsefragment behaves unexpectedly when context page has Flow-board content model.Mar 29 2015, 11:31 PM
Jdforrester-WMF edited a custom field.
Jdforrester-WMF moved this task from To Triage to Q4 on the VisualEditor board.Apr 1 2015, 4:13 PM
Restricted Application added a project: Collaboration-Team-Triage. · View Herald TranscriptApr 1 2015, 4:13 PM