| 1 | { |
| 2 | "description": "Space-apps registry vectors: which apps are installed FOR THE WHOLE SPACE. The registry is fold state from wire events in the hidden all-members space thread's encrypted log — the server never learns which app was installed. Source of truth: web/static/apps.js (the spaceapps system app); design: docs/space-apps.md.", |
| 3 | "app": "spaceapps", |
| 4 | "source": "web/static/apps.js (installsApp — one registry for every shared place; this file pins its spaceapps event family)", |
| 5 | "state_shape": { |
| 6 | "apps": [ |
| 7 | { |
| 8 | "id": "string (the installed app's name, e.g. \"bookmarks\")", |
| 9 | "by": "string (installer's sender name)", |
| 10 | "ts": "number (epoch ms)", |
| 11 | "uid": "string (the installer's user id — \"\" on pre-uid logs; the admins-only policy filters by it at read time)" |
| 12 | } |
| 13 | ] |
| 14 | }, |
| 15 | "notes": [ |
| 16 | "The fold is the groupapps registry's twin, one level up: the item id IS the app name, so a duplicate install (any member, any refold) is a no-op and a remove needs no lookup.", |
| 17 | "Unknown app names fold into state unchanged in shape — clients filter to registered, spaceCapable apps at READ time (spaceAppsFor), so old and new clients converge on the same log.", |
| 18 | "No chat projection: the space thread has no chat view and no sidebar row, so spaceapps declares no chatMessage/preview — the Apps sheet's \"Installed for everyone by …\" line is the visible record.", |
| 19 | "A space-installed app's own events posted into the space thread fold with the app's ordinary vectors — same events, same reducer, keyed by the space thread instead of a personal or group one." |
| 20 | ], |
| 21 | "vectors": [ |
| 22 | { |
| 23 | "name": "spaceapps_install", |
| 24 | "description": "A member installs an app for everyone in the space.", |
| 25 | "event": { |
| 26 | "type": "spaceapps.add", |
| 27 | "app": "bookmarks", |
| 28 | "name": "Ana", |
| 29 | "ts": 1700000000000, |
| 30 | "uid": "u-ana" |
| 31 | }, |
| 32 | "expected_state_update": { |
| 33 | "apps": [ |
| 34 | { |
| 35 | "id": "bookmarks", |
| 36 | "by": "Ana", |
| 37 | "ts": 1700000000000, |
| 38 | "uid": "u-ana" |
| 39 | } |
| 40 | ] |
| 41 | } |
| 42 | }, |
| 43 | { |
| 44 | "name": "spaceapps_install_duplicate", |
| 45 | "description": "Re-installing an already-installed app is a no-op (idempotent by app name).", |
| 46 | "event": { |
| 47 | "type": "spaceapps.add", |
| 48 | "app": "bookmarks", |
| 49 | "name": "Bob", |
| 50 | "ts": 1700000005000, |
| 51 | "uid": "u-bob" |
| 52 | }, |
| 53 | "initial_state": { |
| 54 | "apps": [ |
| 55 | { |
| 56 | "id": "bookmarks", |
| 57 | "by": "Ana", |
| 58 | "ts": 1700000000000, |
| 59 | "uid": "u-ana" |
| 60 | } |
| 61 | ] |
| 62 | }, |
| 63 | "expected_state_update": { |
| 64 | "apps": [ |
| 65 | { |
| 66 | "id": "bookmarks", |
| 67 | "by": "Ana", |
| 68 | "ts": 1700000000000, |
| 69 | "uid": "u-ana" |
| 70 | } |
| 71 | ] |
| 72 | } |
| 73 | }, |
| 74 | { |
| 75 | "name": "spaceapps_install_unknown_app", |
| 76 | "description": "An install naming an app this client doesn't know still folds — it stays inert at read time, so clients on different versions converge on the same log.", |
| 77 | "event": { |
| 78 | "type": "spaceapps.add", |
| 79 | "app": "someday-app", |
| 80 | "name": "Ana", |
| 81 | "ts": 1700000010000, |
| 82 | "uid": "u-ana" |
| 83 | }, |
| 84 | "initial_state": { |
| 85 | "apps": [ |
| 86 | { |
| 87 | "id": "bookmarks", |
| 88 | "by": "Ana", |
| 89 | "ts": 1700000000000, |
| 90 | "uid": "u-ana" |
| 91 | } |
| 92 | ] |
| 93 | }, |
| 94 | "expected_state_update": { |
| 95 | "apps": [ |
| 96 | { |
| 97 | "id": "bookmarks", |
| 98 | "by": "Ana", |
| 99 | "ts": 1700000000000, |
| 100 | "uid": "u-ana" |
| 101 | }, |
| 102 | { |
| 103 | "id": "someday-app", |
| 104 | "by": "Ana", |
| 105 | "ts": 1700000010000, |
| 106 | "uid": "u-ana" |
| 107 | } |
| 108 | ] |
| 109 | } |
| 110 | }, |
| 111 | { |
| 112 | "name": "spaceapps_remove", |
| 113 | "description": "Any member removes a space-wide install.", |
| 114 | "event": { |
| 115 | "type": "spaceapps.remove", |
| 116 | "app": "bookmarks", |
| 117 | "name": "Bob", |
| 118 | "ts": 1700000020000 |
| 119 | }, |
| 120 | "initial_state": { |
| 121 | "apps": [ |
| 122 | { |
| 123 | "id": "bookmarks", |
| 124 | "by": "Ana", |
| 125 | "ts": 1700000000000, |
| 126 | "uid": "u-ana" |
| 127 | } |
| 128 | ] |
| 129 | }, |
| 130 | "expected_state_update": { |
| 131 | "apps": [] |
| 132 | } |
| 133 | }, |
| 134 | { |
| 135 | "name": "spaceapps_remove_absent", |
| 136 | "description": "Removing an app that isn't installed is a no-op (a remove can race another member's remove).", |
| 137 | "event": { |
| 138 | "type": "spaceapps.remove", |
| 139 | "app": "bookmarks", |
| 140 | "name": "Bob", |
| 141 | "ts": 1700000030000 |
| 142 | }, |
| 143 | "initial_state": { |
| 144 | "apps": [] |
| 145 | }, |
| 146 | "expected_state_update": { |
| 147 | "apps": [] |
| 148 | } |
| 149 | }, |
| 150 | { |
| 151 | "name": "spaceapps_add_malformed", |
| 152 | "description": "A hostile or malformed install (missing/non-string app) folds to a no-op, never a crash.", |
| 153 | "event": { |
| 154 | "type": "spaceapps.add", |
| 155 | "name": "Mallory", |
| 156 | "ts": 1700000040000 |
| 157 | }, |
| 158 | "initial_state": { |
| 159 | "apps": [] |
| 160 | }, |
| 161 | "expected_state_update": { |
| 162 | "apps": [] |
| 163 | } |
| 164 | } |
| 165 | ] |
| 166 | } |
| 167 | |