fix: a store that cannot brick itself on its own history
Startup built its index by jsonDecode-ing every line of the message log to read
one short field. Each line carries its attachment inline as base64, so building
the index cost the size of the entire history — and once that history was large
enough, launch exceeded the iOS watchdog and the app could never be opened
again. 9.5 seconds of CPU, killed at 0x8BADF00D, on a store that had grown a
few megabytes at a time for weeks.
The index needs only the session id, which is a scan rather than a parse.
Compaction now also triggers on bytes: 200 messages per session bounds the
count and nothing else when a message can carry a screenshot.
Also: a saved file is no longer named by appending an extension to a caption
that already ends in one, which produced names with two dots and, when the type
was unknown, a .bin no player would open. The type table gained the video,
audio and image types it never had, and falls back to a self-naming subtype
instead of bin.