Allow sorting/grouping conversations in the list
A commonly requested feature is to be able to "show all unread/starred messages at the top".
This can be seen as either as a sorting ("sort by starred messages first, then by received date") or a grouping ("show all unread at the top"), or a filtering ("show only starred messages"). The latter is maybe best handled by a dedicated folder for starred messages (e.g. #3). Perhaps grouping is conceptually more straight-forward, since you can just say just as something like "Show unread first" or "Show starred first", and since there probably doesn't need to be a means to get the reverse, e.g. show unstarred first. These could be menu items in a hamburger menu for the conversation list.
The grouping could be indicated using a header between the have vs have nots, with an optional label to indicate more complex groupings. Despite it being called "grouping", this might actually best be implemented as a sort ordering anyway, then letting the conversation list do the grouping.
Other things we may want to to allow grouping by are received date ("Yesterday's mail", "Friday's mail", etc), which would let us display a more useful date for individual conversations, by contact ("All mail from $SENDER"), and in the junk folder by people in your address book vs people not in your address book (or more precisely "junk that may not be junk" vs "junk that probably is junk".
Since we don't load all conversations up front for a folder, to make the sorting done by the Engine work properly would require adding a Conversations table to the database, so we could load all matching conversations sorted without needing to calculate the closure of all messages. We might be able to get away with sorting only on in-folder messages first, and this would likely work for unread messages fine, but wouldn't for conversations that have out-of-folder messages that match other criteria, e.g. a conversation further down in the Inbox that has a starred message in Archives. This would lead to some pretty confusing behaviour, so adding Conversations to the db really needs to be done before implementing this.
Some prior art includes in Nextcloud, where starring ("Favouriting") things automatically sorts those first (see #54 (closed)). GMail requires users to go in to their settings and select their "Inbox type", so I wonder if they have done some research that shows people don't change this that often, but it has near-zero discoverability. Outlook.com phrases it as sorting, but that's hidden under a "Filtering" menu.