Page MenuHomePhabricator

[BUG] Adding an article to a reading list should make it available offline by default, even when it was previously saved and remove from offline
Closed, ResolvedPublic1 Estimated Story Points

Description

Unexpected behavior since user is advised that adding an article to a reading list by default saves it offline. This is the expectation even when saving an article that may have been saved to another list before and removed from offline.

Steps to reproduce

  1. Add an article to a reading list (by default, the article will be made available offline)
  2. Go to the reading list and remove that article from being available offline
  3. Add the same article to another reading list
  4. View the article in the second reading list to which it has just been added

Expected

The article is shown as added to the second reading list and is once again made available for offline reading.

Actual

Article is added to the second reading list, but remains unavailable for offline reading.

Event Timeline

Change 347655 had a related patch set uploaded (by Mholloway):
[apps/android/wikipedia@master] Set page to be available offline when adding to another reading list

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

This was an easy fix, but upon reflection I want to take a minute to register my dissent. This is a loss for data-sensitive users, since if they want to save an online-only article to a second or subsequent list, they'll be forced to download and then re-unsave it each time when they probably didn't want to download it in the first place because it was too big. Since a user only makes a reading list article online-only by choice, I think we should respect that when adding to subsequent lists.

As described above, I'm not sure I agree with this change. What do you think?

Actually, this will now depend on what the new cache setup does with an un-saved page. Depending on what happens in the new caching layer, this might actually be fine.

OK, upon reviewing the saved page deletion code, it looks like the page is removed from the secondary (saved page) cache but not the HTTP cache, so that a user who adds a recently viewed page to a list, marks it online-only, then adds it to a second list and thereby re-"saves" it won't incur the data penalty of having to re-download it again. @Niedzielski, is this correct?

I still think flipping the page back to offline violates expectations more than the status quo does, but I can live with this.

Deleting saved pages always acts on the save cache. The page may or may not exist in the net cache but the page is purged from the save cache.

Because of our usage of max-stale and must-revalidate, the network is always tried for a new copy unfortunately. This is currently necessary because OkHttp will not attempt to refresh merely a stale page. Maybe we can improve this by replacing must-revalidate with max-age.

As a caveat, if a page exists in the net cache, and the user is offline, the save cache could be updated from the net cache if the save page sync service was allowed to run offline.

QA procedure should be evident from the description but please don't hesitate to reach out with any questions.

Change 347655 merged by jenkins-bot:
[apps/android/wikipedia@master] Set page to be available offline when adding to another reading list

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

Because of our usage of max-stale and must-revalidate, the network is always tried for a new copy unfortunately.

Hmm, I hadn't realized this. You probably mentioned it but I didn't quite process it. In retrospect I wish we'd rolled this out incrementally with some A/B testing for things like data usage or network requests for content already in cache. As is I guess we'll just have to keep an eye out for data usage complaints.

Maybe we can improve this by replacing must-revalidate with max-age.

Yeah. I'd prefer to avoid any more mucking with HTTP headers than necessary but this is something to keep in mind if people start seeing a jump in data usage and complaining about it.

As a caveat, if a page exists in the net cache, and the user is offline, the save cache could be updated from the net cache if the save page sync service was allowed to run offline.

This makes sense in light of the cache architecture update. Optimistically we'd find the content in the cache, and otherwise we'd just log an error. If there are no negative consequences you can think of that I'm overlooking, I'll upload a patch.

Change 348034 had a related patch set uploaded (by Mholloway):
[apps/android/wikipedia@master] Don't prevent SavedPageSyncService from running when offline

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

ABorbaWMF subscribed.

Tested on the App Build 2.5.192-alpha-2017-04-12

Saved articles are behaving as desired. The offline availability option is working. Ready for signoff.

Change 348034 merged by jenkins-bot:
[apps/android/wikipedia@master] Don't prevent SavedPageSyncService from running when offline

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