Requests for comment/Support for user-specific page lists in core

This request for comment proposes to take MediaWiki's implementation of watchlists and abstract it in to a more generic facility for working with user-specific lists of pages. This could be done with only a modest refactoring of existing code, and without changing the watchlist feature itself. Finally, it illustrates how this generic facility could drive a range of powerful features, including some that have long been requested by users.

Schema changes
We propose the following changes:


 * 1) The addition of two columns to the watchlist table: a varbinary(14)   column, representing the time the entry was created, and , a varbinary(100) column representing the type of the entry. Both columns would likely require an index.
 * 2) The tag "watchlist" would be applied to all existing rows in the table. Existing queries for watchlist items in core would need to be amended to add an additional constraint,.
 * 3) The `wl_user` key would be altered to enforce uniqueness on

Doesn't the proposed schema limit (with an additional wl_tag column) limit each watchlist entry to a single tag? A separate, normalized table may make more sense here. --MZ

API
User-specific page list would be managed by a new  class:

Use cases
Like revision tags, wl_tags are metadata that could be used in a variety of ways. Tags could be added, edited, or removed; both manually by users or programmatically by extensions, gadgets, and so on.
 * Revision tags have a number of issues with regard to normalization: spaces v. dashes v. underscores, non-ASCII characters, length limitations, case sensitivity, etc. We should be cautious of following this approach. --MZ
 * Good point. We should try and solve some of these issues before they come and bite us in the butt. --SW
 * Let's avoid creating a schema that can't be effectively sorted, though. I'm thinking here about the externallinks table, where there's no good way to page through a long query since the partial column indexes don't support non-filesorting sorts. Anomie (talk) 13:48, 21 June 2013 (UTC)


 * Tags could be added directly to the current Special:Watchlist interface, for which there is a lengthy wishlist of features. In particular, this schema change would be a step toward the following ideas...
 * Tags could be used to create watchlist items that expire within a given time period (bug 6964).
 * Grouping of watchlist items (bug 5875, bug 20444)
 * Watching bundles of pages (bug 2308)
 * Creating multiple or sub-watchlists, some of which might be public (bug 7467)
 * Tags could be used to create a to-do list for editors (using structured data, as opposed to a simple wiki page).
 * Tags could be used to create a "read later" or favorites list.
 * Tags could be used to create reminders about pages (bug 582)
 * Users could create custom tags for things they care about. (Ideally, users would be able to bulk edit, add, or remove tags, just like they can with watchlist items. bug 33888)
 * Extensions -- such as GettingStarted or PageTriage -- could keep track of tasks you've started or completed on a page.
 * Tags, such as for pages you've created or files you've uploaded, could be shared publicly in a list on your userpage or in other places.
 * Widely-used community tools like bots or gadgets could create tagged lists (or add to lists) for users who wanted them. For example, a bot could deliver a list of new pages associated with a WikiProject to interested users. Bots that suggest tasks to do, like SuggestBot and DPL Bot, could store and deliver suggestions in better ways. Gadgets like Twinkle could more easily help users keep track of pages on which they have taken certain actions, such as nominating for deletion.

Comments

 * I like the proposal. It's generally clear and to the point.  Please specify that wl_tags is intended to be a human-readable string, and that only reason it's binary is because that's how core handles strings.  I'd like to go further and suggest a naming convention for extension-started or extension-managed tags (e.g. "Extension:GettingStarted/tasks"), rather than every extension coming up with its own naming convention (like was done with i18n message keys). Superm401 - Talk 00:09, 21 June 2013 (UTC)


 * I think the timestamp is essential. The tag would seemingly enable users to have individual todo lists.  That seems useful.  What would it take to enable a user to share a distinctly tagged portion of such watchlist with others.  If we do not do that we may pass up a chance to enhance collaboration. DCDuring (talk) 00:43, 21 June 2013 (UTC)


 * In its current state, the watchlist serves only one use case really well: I care about a page enough to monitor all changes to it for the indefinite future. It's not very intelligent, and doesn't help me distinguish between different types of pages I care about. There are numerous reasonable outstanding requests for feature enhancements around the watchlist, but the current schema for the watchlist table is inflexible enough to block many of these requests, because it was designed solely to denote the binary watch/unwatch state and single gargantuan list to present users with. With fairly minimal changes, I think it is possible to make the underlying structure meet the needs of a variety of features MediaWiki users need for organizing user-specific lists of pages. With the proposal in its current state, we tried to outline a way to gain more power and flexibility without needing to change the way watchlists behave as far as editors are concerned. Steven Walling (WMF) &bull; talk   00:40, 21 June 2013 (UTC)
 * Could the tag be used for what users perceive as multiple tags? Could one tag indicate the sections (header or some CSS) that a user was interested in. Could such a tag be read by the watchlist software to offer the user only items changed in the designated sections. This matters for Wiktionary a great deal because we can have many language sections on a page with a given user normally only interested in one or a few of them. It has come up repeatedly at the top of desiderata for the watchlist. DCDuring (talk) 21 June 2013 (UTC)
 * Yes. There'd be nothing stopping us from literally exposing tags ala Flickr-style tags. We're not tied to doing it that way, though. Steven Walling (WMF) &bull; talk   01:03, 21 June 2013 (UTC)
 * Andre K. is a pretty big opponent of free-form tagging. He makes a reasonable case against its use (it came up in the context of Bugzilla's keywords field, which requires an administrator to add or remove a defined keyword). You should ask him to weigh in here. --MZMcBride (talk) 02:32, 21 June 2013 (UTC)
 * Andre's input would be great, but for the sake of accuracy, I think I should point out there is nothing in these schema changes that requires us to support free-form tagging by users. We could in fact set tags only using a predetermined set allowed by core and/or extensions. Unlike categories, which are set via free-form wikitext syntax, you could potentially disallow willy-nilly creation of new tags. Personally I think the success of projects like Delicious and Flickr strongly suggests tagging by users works though. Steven Walling (WMF) &bull; talk   05:05, 21 June 2013 (UTC)
 * OTOH, "willy-nilly creation of new tags" is what is needed to allow some of the suggested use cases. Anomie (talk) 13:43, 21 June 2013 (UTC)
 * This sounds great. I'd also love it if this could be extended with a notion of private and public lists. It would be great to be able to group various articles and share them with a wider audience who can subscribe to them. This would open up so many features... Jdlrobson (talk) 02:44, 21 June 2013 (UTC)
 * Instead of implementing a new simple tagging system, why not just finish https://gerrit.wikimedia.org/r/#/c/16419/ ? Eran (talk) 05:27, 21 June 2013 (UTC)
 * That patch is pretty big, and enables just one feature. This schema change would enable many features. Steven Walling (WMF) &bull; talk   06:28, 21 June 2013 (UTC)
 * I suspect you're using the verb "to enable" with different meanings here: one is "make active and available" (the paginated watchlist/multiple watchlist features, IIRC); the other "make it possible for future changes". --Nemo 07:10, 21 June 2013 (UTC)
 * I like the concept, but the specific proposal seems a bit unfocused. First, "tag" seems like a poor name; "list" or "group" seems more accurate IMO. And then there's the comment that watchlists would use the "watchlist" tag, and later talk about watchlists using an unspecified (and possibly user-defined!) list of tags. I'm also not sure about the comment about todo lists using "structured data", as there isn't much structure possible here (you get date and page, but no comment on what it was you were intending to do). Anomie (talk) 13:43, 21 June 2013 (UTC)