Page MenuHomePhabricator

Edit Recovery: Configuration in LocalSettings.php for expiration time for Data removal in indexedDB
Closed, ResolvedPublicFeature

Description

Feature summary (what you would like to be able to do and where):
Environment: Local
When testing, QA would like to have a configurable item in LocalSettings.php for pages that have not been edited for 30 days are removed from the edit recovery indexedDB storage.

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):
See related task, https://phabricator.wikimedia.org/T341956

Benefits (why should this be implemented?):
When testing, we don't have to wait 30 days since this is hardcoded.

We can get by changing the code to 1 day but if we can have a configurable item in the LocalSettings.php to seconds, that would be great, thanks!

2023-10-10_15-14-03.png (224Γ—1 px, 98 KB)

Event Timeline

Would it be good to make this configurable as a number of seconds rather than days? Looking at other configuration variables there seem to be both approaches used (e.g. $wgRCMaxAge defaults to 90 days, in seconds) and seconds seem more common. People can then do e.g. $wgEditRecoveryDeleteAfter = 30 * 24 * 3600; to get the default, or $wgEditRecoveryDeleteAfter = 60 * 5; for five minutes for easier local testing.

I wondered about calling it $wgEditRecoveryMaxAge but entries could end up being older than that if the user doesn't interact with the site, so it's not strictly a maximum.

Change 965179 had a related patch set uploaded (by Samtar; author: Samtar):

[mediawiki/core@master] EditRecovery: Add $wgEditRecoveryDeleteAfter config var

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

Change 965179 merged by jenkins-bot:

[mediawiki/core@master] EditRecovery: Add $wgEditRecoveryExpiry config var

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

nb. for QA, the config variable to set in LocalSettings.php is $wgEditRecoveryExpiry, defaulting to 2592000 seconds (30 days)

@Samwilson & @TheresNoTime I updated to core and added $wgEditRecoveryExpiry = 120; in my LocalSettings.php which should be two minutes but after 15 minutes, it's still showing even when going in and out of pages and browsers as seen in the screenshots below. Am I missing anything else? Also, Storage is now showing expiry compared to expiryDate like before.

Status: ❓NMI
Environment: Local: 1.42.0-alphaΒ (7eb8efa) 16:46, 23 October 2023
OS: macOS Sonoma 14.0
Browser: Chrome 117
Skins. n/a
Device: MBA M2
Emulated Device:: n/a
Test Links:
http://localhost:8080/w/index.php?title=Harry_potter&action=edit
http://localhost:8080/w/index.php?title=Beer&action=edit

❓AC1: https://phabricator.wikimedia.org/T348593

Latest Patch- Edit RecoveryLatest Patch- expiryDatePrevious Patch
2023-10-23_13-15-25.png (1Γ—3 px, 765 KB)
2023-10-23_13-18-16.png (1Γ—3 px, 411 KB)
2023-10-23_13-19-15.png (1Γ—1 px, 462 KB)

Also if you do two separate edits on the same article, should it show more than once in the Edit Storage? Since it's within the 120 seconds, shouldn't I see the edit saved on Safari too besides just Chrome since I'm under the same login?
Chrome & Firefox

2023-10-23_13-33-49.png (1Γ—3 px, 738 KB)

Finally got somewhere with figuring out why this was working for me and not you β€” some recent changes have maybe caused:

:8080/w/load.php?lan…&version=5695o:1125 Uncaught (in promise) DOMException: Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing.
    at http://localhost:8080/w/load.php?lang=en&modules=ext.CodeMirror.lib%7Cext.wikiEditor.realtimepreview%7Cjquery%2Coojs-ui-core%2Coojs-ui-toolbars%2Coojs-ui-widgets%2Coojs-ui-windows%7Cjquery.makeCollapsible%2Cui%7Cmediawiki.base%2Cnotification%2Cpulsatingdot%2Cwidgets%7Cmediawiki.diff.styles%7Cmediawiki.editRecovery.edit%7Coojs-ui.styles.icons-content&skin=vector&version=5695o:1125:716
    at new Promise (<anonymous>)
    at Object.deleteData (http://localhost:8080/w/load.php?lang=en&modules=ext.CodeMirror.lib%7Cext.wikiEditor.realtimepreview%7Cjquery%2Coojs-ui-core%2Coojs-ui-toolbars%2Coojs-ui-widgets%2Coojs-ui-windows%7Cjquery.makeCollapsible%2Cui%7Cmediawiki.base%2Cnotification%2Cpulsatingdot%2Cwidgets%7Cmediawiki.diff.styles%7Cmediawiki.editRecovery.edit%7Coojs-ui.styles.icons-content&skin=vector&version=5695o:1125:625)
    at saveFormData (http://localhost:8080/w/load.php?lang=en&modules=ext.CodeMirror.lib%7Cext.wikiEditor.realtimepreview%7Cjquery%2Coojs-ui-core%2Coojs-ui-toolbars%2Coojs-ui-widgets%2Coojs-ui-windows%7Cjquery.makeCollapsible%2Cui%7Cmediawiki.base%2Cnotification%2Cpulsatingdot%2Cwidgets%7Cmediawiki.diff.styles%7Cmediawiki.editRecovery.edit%7Coojs-ui.styles.icons-content&skin=vector&version=5695o:1122:220)

Change 982782 had a related patch set uploaded (by Samtar; author: Samtar):

[mediawiki/core@master] EditRecovery: Use ResourceLoader dynamic config

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

Change 982782 merged by jenkins-bot:

[mediawiki/core@master] EditRecovery: Use ResourceLoader dynamic config

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

dom_walden subscribed.

Testing locally, I have been able to set $wgEditRecoveryExpiry in LocalSettings.php to a number of seconds. The expiration date added to the Edit Recovery entry in IndexedDB is the current date plus that number of seconds. This expiration date appears to be updated everytime Edit Recovery is triggered (e.g. 5 seconds after you type something or switch tabs).

I couldn't really test this on beta as I cannot change the configs there. But, I see that when an Edit Recovery entry is stored on beta the expiration date is roughly 2592000 seconds in the future, which is the default value of $wgEditRecoveryExpiry.