Page MenuHomePhabricator

Providing a baserevid for a section edit always results in edit result "Success"
Open, Needs TriagePublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):
Run this on https://commons.wikimedia.beta.wmflabs.org/wiki/:

var api = new mw.Api();
api.postWithEditToken( {
format: 'json', title: 'User_talk:AJ-test', action: 'edit', summary: 'test3', text: 'baserevid 258476 again', baserevid: 258476, section: 2
} ).done( function ( data ) {
} );

What happens?:

{"edit":{"result":"Success","pageid":104974,"title":"User talk:AJ-test","contentmodel":"wikitext","nochange":"","watched":""}}

But no actual edit has been made. Also note the absence of edit.newtimestamp.
What should have happened instead?:
Edit conflict or error about invalid baserevid. Using an obviously wrong baserevid like "2" yields the same result.

Using a "good" baserevid results in the edit being made as expected with the appropriate API response, it's just the response when triggering an edit conflict or using an invalid baserevid that's bad.

Update: this actually seems to be the same response that you get from null edits.

Event Timeline

Same on enwiki production:

Attempted section edit with invalid baserevid

var api = new mw.Api();
api.postWithEditToken( {
format: 'json', title: 'User_talk:AJ-test/T299809', action: 'edit', summary: 'test on production', baserevid:1, text: '==T299809==\nthis text does not exist on the current page, this is not a null edit', section: 1
} );

Response:

{"edit":{"result":"Success","pageid":70097862,"title":"User talk:AJ-test/T299809","contentmodel":"wikitext","nochange":"","watched":""}}

This is wrong.

Attempted sectionless edit with invalid baserevid

var api = new mw.Api();
api.postWithEditToken( {
format: 'json', title: 'User_talk:AJ-test/T299809', action: 'edit', summary: 'test on production', baserevid:1, text: '==T299809==\nthis text does not exist on the current page, this is not a null edit'
} );

Response:

{"error":{"code":"editconflict","info":"Edit conflict.","*":"See https://en.wikipedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes."},"servedby":"mw1316"}

This is right.

Section null edit without baserevid

var api = new mw.Api();
api.postWithEditToken( {
format: 'json', title: 'User_talk:AJ-test/T299809', action: 'edit', summary: 'this is a null edit', text: '==T299809==\ntest', section: 1
} );

Response:

{"edit":{"result":"Success","pageid":70097862,"title":"User talk:AJ-test/T299809","contentmodel":"wikitext","nochange":"","watched":""}}

This is right.

Section null edit with invalid baserevid

var api = new mw.Api();
api.postWithEditToken( {
format: 'json', title: 'User_talk:AJ-test/T299809', action: 'edit', summary: 'this is a null edit with invalid baserevid', baserevid:1, text: '==T299809==\ntest', section: 1
} );

Response:

{"edit":{"result":"Success","pageid":70097862,"title":"User talk:AJ-test/T299809","contentmodel":"wikitext","nochange":"","watched":""}}

This is right, but for the wrong reason.