mirror of
https://github.com/block/buzz.git
synced 2026-11-24 18:21:59 +00:00
Mobile Home now reads desktop's unified sidebar from block/buzz-app#3791 and shows the same workspaces, filings, icons and section order as the desktop sidebar. It is read-only while a unified record exists. ## What changed - **Reads desktop's records.** Mobile reads `channel-workspaces` and `channel-workspace-sort`. Until the unified record exists, it falls back to the legacy `channel-sections` and Solo groups, merging them the way desktop imports them (`expandWorkspaceRecord`, `importWorkspaceFallback`, `mergeLegacyWorkspaces`). Sort follows desktop's `meta.g` registers. - **Layout.** Sections are Starred, then the workspaces, Team, Solo and Direct messages, in desktop's `sectionOrder`. A workspace holds Team channels and Solo chats alike, and shows its icon: Unicode emoji as text, `:shortcode:` as the community's custom emoji, and nothing for an unknown shortcode. - **Read-only lock.** While a unified record exists, mobile hides rename, delete, move, New project and sort edits, and never publishes the legacy records desktop would ignore. That includes: - an edit queued before the lock; - a unified head arriving during a relay rate-limit wait (`mayPublish`); - a Team publish whose preflight read failed; - a New project or workspace pick opened before the lock (the chat is still created, without the filing). - **Recovery.** A foreground refresh with a pending legacy sort still applies a missed unified head. - **No All/Solo/Team filter.** Desktop removed its tabs in #3791, since workspaces now hold Solo and team chats together, so Home drops its chips too. The Messages header keeps its title and actions and no longer collapses on scroll. - **Filters.** The Unreads filter uses Solo's own unread state for Solo rows. - **NIP-44.** Decryption accepts the extended length prefix for payloads over 65535 bytes. A nostr-tools vector is included. ## Tests - `workspace_layout_interop_test.dart`: a table generated by running desktop's TypeScript from buzz-app `main` (11 layouts and 10 invalid records). It checks that mobile computes the same sections, assignments and order. - `sidebar_workspaces_journey_test.dart`: Home runs on the real sections and sort notifiers over the relay fixture. It starts on legacy sections, receives desktop's signed heads live, then checks the order, filings, icon, read-only sheet and Unreads. It also checks that only the filter choice is published. - `unified_sidebar_records_test.dart`: Team and sort publish nothing once a unified head is seen: before an edit, while one waits, or past a failed preflight. - `project_creation_test.dart`: the unified layout arrives while a workspace is being named. Nothing is written, and nothing is left to resume. - `solo_creation_tags_test.dart` and `me_sync_test.dart`: a project picked or a filing queued before the lock doesn't stop a new Solo chat from being created. Each new guard was mutation-checked: removing it fails its test. `flutter analyze` is clean and `flutter test` passes (5450). ## Not in this PR (open questions) - **Forums** stay hidden on Home, as before. Desktop shows them, so a forum filed into a workspace or starred on desktop doesn't appear on mobile. Should mobile add a Forums section? - **Filters** still use the legacy `channel-filter` record. Desktop prefers `channel-workspace-filter`. - **Solo creation without a unified record** still writes the legacy Solo groups, as before. - **Empty workspaces** are shown, as on desktop. Mobile rejects a unified record that carries `meta` without `filings`; desktop never writes that shape. - Built-in titles now match desktop: "Team" (was "Channels") and "Direct messages" (was "DMs"). ## How to test 1. On desktop (buzz-app with #3791), create two workspaces, give one an emoji icon, and file a Team channel and a Solo chat into it. Reorder the sections. 2. Open mobile Home in the same community. The sections, order, icon and filings should match desktop. 3. Open a workspace's options. You should see only Sort (disabled) and Show. Long-press a channel: there's no "Move to section…". 4. There is no All/Solo/Team filter row under the Messages title. 5. Change the order on desktop. Mobile should follow live, or after you foreground the app. Screenshots are in the comment below. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Wes <wesbillman@users.noreply.github.com> Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: Carl <32a2e2c9d428ee08902cab75d956da2c1d235a22d4766b0dd4138bf6e2e5db1d@buzz.block.builderlab.xyz> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Tom Brow <tomb@block.xyz> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost>
839 lines
16 KiB
JSON
839 lines
16 KiB
JSON
{
|
|
"cases": [
|
|
{
|
|
"name": "legacy team only",
|
|
"team": {
|
|
"version": 1,
|
|
"sections": [
|
|
{
|
|
"id": "eng",
|
|
"name": "Engineering",
|
|
"order": 0,
|
|
"icon": "🛠️"
|
|
},
|
|
{
|
|
"id": "ops",
|
|
"name": "Ops",
|
|
"order": 1
|
|
}
|
|
],
|
|
"assignments": {
|
|
"c1": "eng",
|
|
"c2": "ops",
|
|
"c3": "gone"
|
|
}
|
|
},
|
|
"expected": {
|
|
"sections": [
|
|
{
|
|
"id": "eng",
|
|
"name": "Engineering",
|
|
"icon": "🛠️"
|
|
},
|
|
{
|
|
"id": "ops",
|
|
"name": "Ops"
|
|
}
|
|
],
|
|
"assignments": {
|
|
"c1": "eng",
|
|
"c2": "ops"
|
|
},
|
|
"sectionKeys": [
|
|
"starred",
|
|
"group:eng",
|
|
"group:ops",
|
|
"solo",
|
|
"channels",
|
|
"forums",
|
|
"dms"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "legacy team and Solo merge Solo first",
|
|
"team": {
|
|
"version": 1,
|
|
"sections": [
|
|
{
|
|
"id": "eng",
|
|
"name": "Engineering",
|
|
"order": 0,
|
|
"icon": "🛠️"
|
|
},
|
|
{
|
|
"id": "ops",
|
|
"name": "Ops",
|
|
"order": 1
|
|
}
|
|
],
|
|
"assignments": {
|
|
"c1": "eng",
|
|
"c2": "ops",
|
|
"c3": "gone"
|
|
}
|
|
},
|
|
"solo": {
|
|
"groups": [
|
|
{
|
|
"id": "proj",
|
|
"name": "Project",
|
|
"defaultTemplateId": "t1"
|
|
}
|
|
],
|
|
"assignments": {
|
|
"s1": "proj",
|
|
"c2": "proj"
|
|
}
|
|
},
|
|
"expected": {
|
|
"sections": [
|
|
{
|
|
"id": "proj",
|
|
"name": "Project"
|
|
},
|
|
{
|
|
"id": "eng",
|
|
"name": "Engineering",
|
|
"icon": "🛠️"
|
|
},
|
|
{
|
|
"id": "ops",
|
|
"name": "Ops"
|
|
}
|
|
],
|
|
"assignments": {
|
|
"c1": "eng",
|
|
"c2": "proj",
|
|
"s1": "proj"
|
|
},
|
|
"sectionKeys": [
|
|
"starred",
|
|
"group:proj",
|
|
"group:eng",
|
|
"group:ops",
|
|
"solo",
|
|
"channels",
|
|
"forums",
|
|
"dms"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "legacy id collision renames the team section",
|
|
"team": {
|
|
"version": 1,
|
|
"sections": [
|
|
{
|
|
"id": "eng",
|
|
"name": "Engineering",
|
|
"order": 0,
|
|
"icon": "🛠️"
|
|
},
|
|
{
|
|
"id": "ops",
|
|
"name": "Ops",
|
|
"order": 1
|
|
},
|
|
{
|
|
"id": "proj",
|
|
"name": "Team proj",
|
|
"order": 2
|
|
}
|
|
],
|
|
"assignments": {
|
|
"c4": "proj"
|
|
}
|
|
},
|
|
"solo": {
|
|
"groups": [
|
|
{
|
|
"id": "proj",
|
|
"name": "Project",
|
|
"defaultTemplateId": "t1"
|
|
}
|
|
],
|
|
"assignments": {
|
|
"s1": "proj",
|
|
"c2": "proj"
|
|
}
|
|
},
|
|
"expected": {
|
|
"sections": [
|
|
{
|
|
"id": "proj",
|
|
"name": "Project"
|
|
},
|
|
{
|
|
"id": "eng",
|
|
"name": "Engineering",
|
|
"icon": "🛠️"
|
|
},
|
|
{
|
|
"id": "ops",
|
|
"name": "Ops"
|
|
},
|
|
{
|
|
"id": "legacy-team:proj",
|
|
"name": "Team proj"
|
|
}
|
|
],
|
|
"assignments": {
|
|
"c4": "legacy-team:proj",
|
|
"s1": "proj",
|
|
"c2": "proj"
|
|
},
|
|
"sectionKeys": [
|
|
"starred",
|
|
"group:proj",
|
|
"group:eng",
|
|
"group:ops",
|
|
"group:legacy-team:proj",
|
|
"solo",
|
|
"channels",
|
|
"forums",
|
|
"dms"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "unified record with default order",
|
|
"unified": {
|
|
"version": 1,
|
|
"sections": [
|
|
{
|
|
"id": "w1",
|
|
"name": "One",
|
|
"order": 1
|
|
},
|
|
{
|
|
"id": "w0",
|
|
"name": "Zero",
|
|
"icon": ":party:",
|
|
"order": 0
|
|
}
|
|
],
|
|
"assignments": {
|
|
"c1": "w1",
|
|
"c9": "nope"
|
|
},
|
|
"sectionOrder": []
|
|
},
|
|
"team": {
|
|
"version": 1,
|
|
"sections": [],
|
|
"assignments": {}
|
|
},
|
|
"expected": {
|
|
"sections": [
|
|
{
|
|
"id": "w0",
|
|
"name": "Zero",
|
|
"icon": ":party:"
|
|
},
|
|
{
|
|
"id": "w1",
|
|
"name": "One"
|
|
}
|
|
],
|
|
"assignments": {
|
|
"c1": "w1"
|
|
},
|
|
"sectionKeys": [
|
|
"starred",
|
|
"group:w0",
|
|
"group:w1",
|
|
"solo",
|
|
"channels",
|
|
"forums",
|
|
"dms"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "unified saved order keeps home keys and adds new workspaces",
|
|
"unified": {
|
|
"version": 1,
|
|
"sections": [
|
|
{
|
|
"id": "w0",
|
|
"name": "Zero",
|
|
"order": 0
|
|
},
|
|
{
|
|
"id": "w1",
|
|
"name": "One",
|
|
"order": 1
|
|
},
|
|
{
|
|
"id": "w2",
|
|
"name": "Two",
|
|
"order": 2
|
|
}
|
|
],
|
|
"assignments": {},
|
|
"sectionOrder": [
|
|
"dms",
|
|
"group:w1",
|
|
"solo",
|
|
"pages",
|
|
"group:w0",
|
|
"channels"
|
|
]
|
|
},
|
|
"team": {
|
|
"version": 1,
|
|
"sections": [],
|
|
"assignments": {}
|
|
},
|
|
"expected": {
|
|
"sections": [
|
|
{
|
|
"id": "w0",
|
|
"name": "Zero"
|
|
},
|
|
{
|
|
"id": "w1",
|
|
"name": "One"
|
|
},
|
|
{
|
|
"id": "w2",
|
|
"name": "Two"
|
|
}
|
|
],
|
|
"assignments": {},
|
|
"sectionKeys": [
|
|
"starred",
|
|
"dms",
|
|
"group:w1",
|
|
"solo",
|
|
"group:w0",
|
|
"group:w2",
|
|
"channels",
|
|
"forums"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "unified saved order without workspaces puts new ones after starred",
|
|
"unified": {
|
|
"version": 1,
|
|
"sections": [
|
|
{
|
|
"id": "w0",
|
|
"name": "Zero",
|
|
"order": 0
|
|
}
|
|
],
|
|
"assignments": {},
|
|
"sectionOrder": [
|
|
"channels",
|
|
"starred",
|
|
"dms"
|
|
]
|
|
},
|
|
"team": {
|
|
"version": 1,
|
|
"sections": [],
|
|
"assignments": {}
|
|
},
|
|
"expected": {
|
|
"sections": [
|
|
{
|
|
"id": "w0",
|
|
"name": "Zero"
|
|
}
|
|
],
|
|
"assignments": {},
|
|
"sectionKeys": [
|
|
"channels",
|
|
"starred",
|
|
"group:w0",
|
|
"dms",
|
|
"solo",
|
|
"forums"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "unified imports legacy sections and filings it has not seen",
|
|
"unified": {
|
|
"version": 1,
|
|
"sections": [
|
|
{
|
|
"id": "eng",
|
|
"name": "Renamed",
|
|
"order": 0
|
|
}
|
|
],
|
|
"assignments": {
|
|
"c1": "eng"
|
|
},
|
|
"sectionOrder": []
|
|
},
|
|
"team": {
|
|
"version": 1,
|
|
"sections": [
|
|
{
|
|
"id": "eng",
|
|
"name": "Engineering",
|
|
"order": 0,
|
|
"icon": "🛠️"
|
|
},
|
|
{
|
|
"id": "ops",
|
|
"name": "Ops",
|
|
"order": 1
|
|
}
|
|
],
|
|
"assignments": {
|
|
"c1": "ops",
|
|
"c2": "ops",
|
|
"c5": "eng"
|
|
}
|
|
},
|
|
"solo": {
|
|
"groups": [
|
|
{
|
|
"id": "proj",
|
|
"name": "Project",
|
|
"defaultTemplateId": "t1"
|
|
}
|
|
],
|
|
"assignments": {
|
|
"s1": "proj",
|
|
"c2": "proj"
|
|
}
|
|
},
|
|
"expected": {
|
|
"sections": [
|
|
{
|
|
"id": "eng",
|
|
"name": "Renamed"
|
|
},
|
|
{
|
|
"id": "proj",
|
|
"name": "Project"
|
|
},
|
|
{
|
|
"id": "ops",
|
|
"name": "Ops"
|
|
}
|
|
],
|
|
"assignments": {
|
|
"c1": "eng",
|
|
"c2": "proj",
|
|
"c5": "eng",
|
|
"s1": "proj"
|
|
},
|
|
"sectionKeys": [
|
|
"starred",
|
|
"group:eng",
|
|
"group:proj",
|
|
"group:ops",
|
|
"solo",
|
|
"channels",
|
|
"forums",
|
|
"dms"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "unified import skips removed sections and unfiled rows",
|
|
"unified": {
|
|
"version": 1,
|
|
"sections": [],
|
|
"assignments": {},
|
|
"sectionOrder": [],
|
|
"removedSections": [
|
|
"ops"
|
|
],
|
|
"unfiled": [
|
|
"c1"
|
|
]
|
|
},
|
|
"team": {
|
|
"version": 1,
|
|
"sections": [
|
|
{
|
|
"id": "eng",
|
|
"name": "Engineering",
|
|
"order": 0,
|
|
"icon": "🛠️"
|
|
},
|
|
{
|
|
"id": "ops",
|
|
"name": "Ops",
|
|
"order": 1
|
|
}
|
|
],
|
|
"assignments": {
|
|
"c1": "eng",
|
|
"c2": "ops",
|
|
"c3": "gone"
|
|
}
|
|
},
|
|
"solo": {
|
|
"groups": [
|
|
{
|
|
"id": "proj",
|
|
"name": "Project",
|
|
"defaultTemplateId": "t1"
|
|
}
|
|
],
|
|
"assignments": {
|
|
"s1": "proj",
|
|
"c2": "proj"
|
|
}
|
|
},
|
|
"expected": {
|
|
"sections": [
|
|
{
|
|
"id": "proj",
|
|
"name": "Project"
|
|
},
|
|
{
|
|
"id": "eng",
|
|
"name": "Engineering",
|
|
"icon": "🛠️"
|
|
}
|
|
],
|
|
"assignments": {
|
|
"c2": "proj",
|
|
"s1": "proj"
|
|
},
|
|
"sectionKeys": [
|
|
"starred",
|
|
"group:proj",
|
|
"group:eng",
|
|
"solo",
|
|
"channels",
|
|
"forums",
|
|
"dms"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "unified import is closed",
|
|
"unified": {
|
|
"version": 1,
|
|
"sections": [
|
|
{
|
|
"id": "w",
|
|
"name": "W",
|
|
"order": 0
|
|
}
|
|
],
|
|
"assignments": {},
|
|
"sectionOrder": [
|
|
"group:w"
|
|
],
|
|
"legacyImportClosed": true
|
|
},
|
|
"team": {
|
|
"version": 1,
|
|
"sections": [
|
|
{
|
|
"id": "eng",
|
|
"name": "Engineering",
|
|
"order": 0,
|
|
"icon": "🛠️"
|
|
},
|
|
{
|
|
"id": "ops",
|
|
"name": "Ops",
|
|
"order": 1
|
|
}
|
|
],
|
|
"assignments": {
|
|
"c1": "eng",
|
|
"c2": "ops",
|
|
"c3": "gone"
|
|
}
|
|
},
|
|
"solo": {
|
|
"groups": [
|
|
{
|
|
"id": "proj",
|
|
"name": "Project",
|
|
"defaultTemplateId": "t1"
|
|
}
|
|
],
|
|
"assignments": {
|
|
"s1": "proj",
|
|
"c2": "proj"
|
|
}
|
|
},
|
|
"expected": {
|
|
"sections": [
|
|
{
|
|
"id": "w",
|
|
"name": "W"
|
|
}
|
|
],
|
|
"assignments": {},
|
|
"sectionKeys": [
|
|
"starred",
|
|
"group:w",
|
|
"solo",
|
|
"channels",
|
|
"forums",
|
|
"dms"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "unified without Solo does not import",
|
|
"unified": {
|
|
"version": 1,
|
|
"sections": [],
|
|
"assignments": {},
|
|
"sectionOrder": []
|
|
},
|
|
"team": {
|
|
"version": 1,
|
|
"sections": [
|
|
{
|
|
"id": "eng",
|
|
"name": "Engineering",
|
|
"order": 0,
|
|
"icon": "🛠️"
|
|
},
|
|
{
|
|
"id": "ops",
|
|
"name": "Ops",
|
|
"order": 1
|
|
}
|
|
],
|
|
"assignments": {
|
|
"c1": "eng",
|
|
"c2": "ops",
|
|
"c3": "gone"
|
|
}
|
|
},
|
|
"expected": {
|
|
"sections": [],
|
|
"assignments": {},
|
|
"sectionKeys": [
|
|
"starred",
|
|
"solo",
|
|
"channels",
|
|
"forums",
|
|
"dms"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "compact filings expand packed ids",
|
|
"unified": {
|
|
"version": 1,
|
|
"sections": [
|
|
{
|
|
"id": "w",
|
|
"name": "W",
|
|
"order": 0
|
|
}
|
|
],
|
|
"filings": {
|
|
"w": [
|
|
"~qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqo",
|
|
"~~tilde",
|
|
"plain"
|
|
]
|
|
},
|
|
"packedUnfiled": [
|
|
"~ASNFZ4mrze8BI0VniavN7wEjRWeJq83vASNFZ4mrze8"
|
|
],
|
|
"sectionOrder": []
|
|
},
|
|
"team": {
|
|
"version": 1,
|
|
"sections": [
|
|
{
|
|
"id": "x",
|
|
"name": "X",
|
|
"order": 0
|
|
}
|
|
],
|
|
"assignments": {
|
|
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef": "x",
|
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa": "x"
|
|
}
|
|
},
|
|
"solo": {
|
|
"groups": [],
|
|
"assignments": {}
|
|
},
|
|
"expected": {
|
|
"sections": [
|
|
{
|
|
"id": "w",
|
|
"name": "W"
|
|
},
|
|
{
|
|
"id": "x",
|
|
"name": "X"
|
|
}
|
|
],
|
|
"assignments": {
|
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa": "w",
|
|
"~tilde": "w",
|
|
"plain": "w"
|
|
},
|
|
"sectionKeys": [
|
|
"starred",
|
|
"group:w",
|
|
"group:x",
|
|
"solo",
|
|
"channels",
|
|
"forums",
|
|
"dms"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"invalid": [
|
|
{
|
|
"name": "wrong version",
|
|
"unified": {
|
|
"version": 2,
|
|
"sections": [],
|
|
"assignments": {},
|
|
"sectionOrder": []
|
|
}
|
|
},
|
|
{
|
|
"name": "missing section order",
|
|
"unified": {
|
|
"version": 1,
|
|
"sections": [],
|
|
"assignments": {}
|
|
}
|
|
},
|
|
{
|
|
"name": "duplicate section ids",
|
|
"unified": {
|
|
"version": 1,
|
|
"sections": [
|
|
{
|
|
"id": "a",
|
|
"name": "A",
|
|
"order": 0
|
|
},
|
|
{
|
|
"id": "a",
|
|
"name": "B",
|
|
"order": 1
|
|
}
|
|
],
|
|
"assignments": {},
|
|
"sectionOrder": []
|
|
}
|
|
},
|
|
{
|
|
"name": "blank section name",
|
|
"unified": {
|
|
"version": 1,
|
|
"sections": [
|
|
{
|
|
"id": "a",
|
|
"name": " ",
|
|
"order": 0
|
|
}
|
|
],
|
|
"assignments": {},
|
|
"sectionOrder": []
|
|
}
|
|
},
|
|
{
|
|
"name": "unknown section order key",
|
|
"unified": {
|
|
"version": 1,
|
|
"sections": [],
|
|
"assignments": {},
|
|
"sectionOrder": [
|
|
"forums",
|
|
"bogus"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "duplicate section order key",
|
|
"unified": {
|
|
"version": 1,
|
|
"sections": [],
|
|
"assignments": {},
|
|
"sectionOrder": [
|
|
"dms",
|
|
"dms"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "legacy import closed with tombstones",
|
|
"unified": {
|
|
"version": 1,
|
|
"sections": [],
|
|
"assignments": {},
|
|
"sectionOrder": [],
|
|
"legacyImportClosed": true,
|
|
"unfiled": [
|
|
"c"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "filings for an unknown workspace",
|
|
"unified": {
|
|
"version": 1,
|
|
"sections": [],
|
|
"filings": {
|
|
"w": [
|
|
"c"
|
|
]
|
|
},
|
|
"sectionOrder": []
|
|
}
|
|
},
|
|
{
|
|
"name": "filings beside assignments",
|
|
"unified": {
|
|
"version": 1,
|
|
"sections": [
|
|
{
|
|
"id": "w",
|
|
"name": "W",
|
|
"order": 0
|
|
}
|
|
],
|
|
"filings": {
|
|
"w": [
|
|
"c"
|
|
]
|
|
},
|
|
"assignments": {},
|
|
"sectionOrder": []
|
|
}
|
|
},
|
|
{
|
|
"name": "non-canonical packed id",
|
|
"unified": {
|
|
"version": 1,
|
|
"sections": [
|
|
{
|
|
"id": "w",
|
|
"name": "W",
|
|
"order": 0
|
|
}
|
|
],
|
|
"filings": {
|
|
"w": [
|
|
"~AAAA"
|
|
]
|
|
},
|
|
"sectionOrder": []
|
|
}
|
|
}
|
|
]
|
|
}
|