Page MenuHomePhabricator

Recover gracefully from session expiration
Closed, ResolvedPublic

Description

Currently if you lose session (get logged out) while having Special:Translate open, and then try to Translate a message, a following happens:

mw.api.post fails due to invalid token. It tries to re-fetch the token, which fails as well. It will then cache this error [1]. The translation will go to "unsaved" state, which does not have yellow highlight, so it is hard to spot. If you open such a message you will see that saving failed due to "Unknown error".

[1] While debugging you wont see any ajax requests being made for saving. This confused me for a long while while debugging.

Suggested behavior as incremental improvements:

  1. Those messages should get the "saving failed" label.
  2. The error message should say that session has expired.
  3. We should detect the situation and display a modal alert asking the user to log in another tab to prevent creating further unsaved work.
  4. We should detect the situation and provide login via ajax and immediately retry saving the translation.

Version: master
Severity: major

Details

Reference
bz69314

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:32 AM
bzimport set Reference to bz69314.

Marking as major due to data loss aspects. I believe this bug is the main cause for the occasional reports of data loss. Aiming to fix for MLEB 2014.08.

This is a duplicate though.

  • Bug 48775 has been marked as a duplicate of this bug. ***
  • Bug 48773 has been marked as a duplicate of this bug. ***
  • Bug 48657 has been marked as a duplicate of this bug. ***
  • Bug 47184 has been marked as a duplicate of this bug. ***

Comment 0 appears to span all cases covered by the 4 previous bug reports now merged into this.

(In reply to Nemo from comment #7)

Comment 0 appears to span all cases covered by the 4 previous bug reports
now merged into this.

I'm not sure one large bug makes more sense than four small bugs, especially when we have tracking bugs and the child bugs were already filed. But okay.

It helps me to have a concise plan and a goal. It's really just a one bug with multiple non-overlapping solutions to address it.

Umm. Bug 48657 is about MediaWiki core's editing ability, and has nothing to do with the Translate extension. I'm restoring it as a blocker to this.

Change 154245 had a related patch set uploaded by Nikerabbit:
Assert that user is logged in when saving

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

Change 154246 had a related patch set uploaded by Nikerabbit:
Give yellow warning background to the status if saving failed

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

Change 154248 had a related patch set uploaded by Nikerabbit:
Show an alert to the user if session has expired

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

The above three patches cover cases 1-3. We can still improve on 3 by providing a link. Implementing case 4 is tricky due to captchas etc.

Change 154245 merged by jenkins-bot:
Assert that user is logged in when saving

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

Change 154246 merged by jenkins-bot:
Give yellow warning background to the status if saving failed

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

Change 154248 merged by jenkins-bot:
Show an alert to the user if session has expired

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

Change 156098 had a related patch set uploaded by Nikerabbit:
Implement session expiry checking for proofread actions

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

Change 156098 merged by jenkins-bot:
Implement session expiry checking for proofread actions

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

I have split the remaining part to bug 70122 as it has a blocker in core.