Page MenuHomePhabricator

Page is blank when edited a page on gomwiktionary with VisualEditor (new pages are missing on some RESTBase servers)
Open, MediumPublic

Description

When one tries to edit a page on gomwiktionary with VisualEditor, the page is still blank. Sometimes, the second time one loads VE, the contents appear in the editor. Perhaps it will take some time for the performance to improve?

Event Timeline

Urbanecm added a subscriber: Urbanecm.

That's interesting. I doubt this is related to VisualEditor itself, but to the fact the REST API sometimes throws 404. See my test attempts through curl:

urbanecm@titanium  ~
$ for i in {0..10}; do curl -I 'https://gom.wiktionary.org/api/rest_v1/page/html/%E0%A4%B5%E0%A4%BE%E0%A4%AA%E0%A4%B0%E0%A4%AA%E0%A5%80%3AMartin_Urbanec%2Fsand/17967?redirect=false&stash=true' 2> /dev/null | gre
p HTTP; done
HTTP/2 200
HTTP/2 200
HTTP/2 200
HTTP/2 404
HTTP/2 200
HTTP/2 404
HTTP/2 404
HTTP/2 404
HTTP/2 200
HTTP/2 404
HTTP/2 404
urbanecm@titanium  ~
$

I tried to modify that command to find out which servers return the incorrect results:

curl -s -I "https://gom.wiktionary.org/api/rest_v1/page/html/%E0%A4%B5%E0%A4%BE%E0%A4%AA%E0%A4%B0%E0%A4%AA%E0%A5%80%3AMartin_Urbanec%2Fsand/17967?redirect=false&stash=true" | grep -P "HTTP|server:"

I ran that 100 times.

  • Received HTTP 200s from: restbase1016, restbase1017, restbase1020, restbase1021, restbase1022, restbase1024, restbase1025, restbase1026, 404: restbase1018
  • Received HTTP 404s from: restbase1019, restbase1023, restbase1027

VisualEditor should be able to detect this situation though, and display an error message, instead of believing RESTBase when it says the page doesn't exist. We have checks in place for when the page already exists but RESTBase returns an older revision than MediaWiki (to avoid data loss by accidentally overwriting newer changes), it seems to me that this should also work when RESTBase returns nothing but MediaWiki returns a revision. Not sure why it doesn't.

matmarex renamed this task from Page is blank when edited a page on gomwiktionary with VisualEditor to Page is blank when edited a page on gomwiktionary with VisualEditor (new pages are missing on some RESTBase servers).Jul 5 2020, 5:31 PM

Pinging @The_Discoverer as they were the one who originally reported this in T253226#6279178

Change 609585 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] Also check for revid conflict when RESTBase says page doesn't exist

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

JTannerWMF moved this task from To Triage to Triaged on the VisualEditor board.
JTannerWMF added a subscriber: JTannerWMF.

Do you have ownership of Restbase Platform Engineering ? There isn't anything left for the Editing team to do here.

@JTannerWMF , we are trying to triage this and it is unclear what is needed. Review on the patch, or does something need to be done to RESTBase?

No, the patch doesn't fix the issue, it only makes VE display a message when this issue occurs (and we'll review it).

The RESTBase problem is that URLs like https://gom.wiktionary.org/api/rest_v1/page/html/%E0%A4%B5%E0%A4%BE%E0%A4%AA%E0%A4%B0%E0%A4%AA%E0%A5%80%3AMartin_Urbanec%2Fsand/17967?redirect=false&stash=true sometimes return a HTTP 404 instead of the expected content.

(Or at least, that was the case a week ago T257124#6279748, I can't reproduce that when trying now… I think we'd still appreciate you having a look to find out what fixed it and to avoid it happening again in the future)

Change 609585 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Also check for revid conflict when RESTBase says page doesn't exist

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

(That patch only improves the error message in VE – I'm still curious to hear what you did to fix the actual error, or why it fixed itself.)

After updating my local dev environment today, VisualEditor broke for me. I was able to track it down to the patch https://gerrit.wikimedia.org/r/609585. Before, the check for conflicting revision IDs was only done when an about attribute could be found in the document. I'm not sure, but I assume this attribute is only there when the document is rendered with Parsoid. My dev environment currently doesn't use Parsoid. The attribute is missing, and the new code assumes it must be 0, which results in the error "Revision IDs returned by the server do not match (document: 0, metadata: 1015)" every time I open VisualEditor.

I'm aware I can't save in VisualEditor without Parsoid. That's fine for me.

Is it possible to restore the previous behavior and skip the check when the document does not have this about attribute, or possibly fall back to mw.config.get( 'wgRevisionId' )?

@thiemowmde How did editing pages work for you before that, anyway? Did the editor just open with no content? (If so, can you just continue using it without Parsoid by testing only on pages that don't exist?)

Personally I found the added check to be useful when I accidentally broke my local PHP Parsoid installation and it returned a fatal error page instead of the page content (the usual PHP <b>Fatal error:</b> blah blah), which prior to this change would have resulted in the fatal error's HTML being loaded for editing.

The editor opens as expected. The only thing that doesn't work with this setup is saving. That's fine for what I want to test locally.

Editing non-existing pages is a great idea. I can use this as a workaround. Thank you!

There are two more reasons why I bring this up:

  1. I suspect this broke the possibility to use VisualEditor with the old PHP parser as the main parser. Let's say all pages in a wiki are saved from a plain wikitext editor, parsed by the old parser. There is no about in these documents, or is it? Still opening VisualEditor should work. I mean, it worked before. Why does it need to stop working now?
  2. The error message isn't helpful. To be useful for inexperienced users it would need to say something like "This page wasn't saved with Parsoid. VisualEditor requires Parsoid to be fully functional." Possibly offering to "continue at your own risk".

Isn't it possible to detect if a page was saved with Parsoid (e.g. by looking for the mw:html:version meta tag, or the parsoid-body class), and only then do this revision ID comparison?