The card type has changed, so we need a state upgrade. As I understand
it, these existed for a particular upgrade to get around the fact that
Ford Turbo updates apps in random order. In Ford Fusion, all apps are
started in parallel before any of their moves are emitted, so this is
no longer a problem.
Since these will no longer be needed and they don't load properly when
+card changes, we deleted them. While trying to find a bug that I
introduced, I refactored +on-load a little bit -- I can revert this if
it's confusing.
Improved the namespacing by dropping the app prefix on types, e.g.
chat-hook-action -> action. Compensated for shadowing by importing the
/sur files behind a face. End result is that a chat-hook-action becomes
an action:hook. Splits chat-json into lib/chat-{hook,store,view}. Uses
^? on changes files in /lib and /sur to discourage deeply nested
importing.
When a group is left, the permissions no longer exist and the mailbox
subscription is kicked. Before attempting to resubscribe, we simply
check if we still have permissions and if not, leave the chat.
We weren't accounting for backlog subscriptions with non-zero message
indexes in their wires. Now, we look through all of our outgoing
subscriptions to identify relevant backlog subscriptions, and leave all
of those.
The more proper fix here is to not include message indexes in the wire
in the first place, since we don't ever reuse that anywhere. But that's
a more invasive change, so we just leave a TODO for it instead.
Previously, we were removing the relevant entry from the `synced` map
before calling `+pull-wire`, which requires an entry to still be there.
This lead to subscriptions not actually being pulled, commonly leading
to "subscribe wire not unique" errors on re-join.
In addition to fixing that, `%remove` actions now try to pull the
subscription regardless of whether they have an entry in the `synced`
map or not. `%leave` is always safe, and we might want to clean up
subscriptions that shouldn't be there anymore in the first place.