{ "description": "Views vectors: bot-created, thread-scoped data surfaces (docs/views.md). A view is schema+data, never code; these vectors pin the fold's clamping — payloads aren't sender-signed, so the fold re-validates every event regardless of what the sidecar checked. Source of truth: web/static/apps/views.js (the views system app).", "app": "views", "source": "web/static/apps/views.js", "state_shape": { "views": [{ "id": "string", "title": "string (≤80)", "glyph": "string (≤4)", "items": [{ "id": "string", "title": "string (≤300)", "subtitle": "string (≤300)", "note": "string (≤500)", "url": "string (https only, ≤600, else \"\")", "accent": "bool" }], "by": "string (creator name)", "ts": "number (epoch ms)" }] }, "notes": [ "view.create upserts by id; view.update is a full replacement and NEVER creates (an update for an unknown id is a no-op).", "Item ids are assigned positionally (i0, i1, …) when absent, so the schema's keyed list stays stable.", "A non-https url (http:, javascript:, data:) folds to \"\" — the row renders but isn't tappable. The renderer re-checks the scheme at click time.", "Items without a title are dropped; an event whose items all drop is a no-op. Max 50 items, 20 views per thread (oldest evicted), whole view ≤ 32KB.", "Views are chat-silent: no chatMessage projection — the bot's reply (with its open_view chip) is the visible artifact." ], "vectors": [ { "name": "view_create", "description": "A bot creates a view of two issues; the second has no url and no explicit id.", "initial_state": { "views": [] }, "event": { "type": "view.create", "id": "vw-1", "title": "Top GitHub issues", "glyph": "⬢", "items": [ { "id": "412", "title": "Crash on login", "subtitle": "#412 · amy", "note": "Priority: urgent", "url": "https://github.com/o/r/issues/412", "accent": true }, { "title": "Dark mode flicker" } ], "name": "Eleven", "ts": 1700000000000 }, "expected_state_update": { "views": [ { "id": "vw-1", "title": "Top GitHub issues", "glyph": "⬢", "items": [ { "id": "412", "title": "Crash on login", "subtitle": "#412 · amy", "note": "Priority: urgent", "url": "https://github.com/o/r/issues/412", "accent": true }, { "id": "i1", "title": "Dark mode flicker", "subtitle": "", "note": "", "url": "", "accent": false } ], "by": "Eleven", "ts": 1700000000000 } ] } }, { "name": "view_create_drops_unsafe_url", "description": "A crafted event carrying a javascript: url folds with the url stripped — the row displays but never links.", "initial_state": { "views": [] }, "event": { "type": "view.create", "id": "vw-2", "title": "Links", "items": [{ "id": "a", "title": "Click me", "url": "javascript:alert(1)" }], "name": "Mallory", "ts": 1700000001000 }, "expected_state_update": { "views": [ { "id": "vw-2", "title": "Links", "glyph": "", "items": [{ "id": "a", "title": "Click me", "subtitle": "", "note": "", "url": "", "accent": false }], "by": "Mallory", "ts": 1700000001000 } ] } }, { "name": "view_create_same_id_replaces", "description": "Re-creating an existing id replaces the view in place (a bot refreshing its data).", "initial_state": { "views": [ { "id": "vw-1", "title": "Old", "glyph": "", "items": [{ "id": "x", "title": "Stale", "subtitle": "", "note": "", "url": "", "accent": false }], "by": "Eleven", "ts": 1700000000000 } ] }, "event": { "type": "view.create", "id": "vw-1", "title": "Fresh", "items": [{ "id": "y", "title": "New row" }], "name": "Eleven", "ts": 1700000002000 }, "expected_state_update": { "views": [ { "id": "vw-1", "title": "Fresh", "glyph": "", "items": [{ "id": "y", "title": "New row", "subtitle": "", "note": "", "url": "", "accent": false }], "by": "Eleven", "ts": 1700000002000 } ] } }, { "name": "view_update_unknown_is_noop", "description": "view.update never creates: an update for an id not in state leaves state untouched.", "initial_state": { "views": [] }, "event": { "type": "view.update", "id": "vw-9", "title": "Ghost", "items": [{ "id": "a", "title": "Nope" }], "name": "Eleven", "ts": 1700000003000 }, "expected_state_update": { "views": [] } }, { "name": "view_create_untitled_is_noop", "description": "An event with no usable title is hopeless and folds to a no-op.", "initial_state": { "views": [] }, "event": { "type": "view.create", "id": "vw-3", "title": "", "items": [{ "id": "a", "title": "Row" }], "name": "Eleven", "ts": 1700000004000 }, "expected_state_update": { "views": [] } }, { "name": "view_remove", "description": "view.remove deletes by id.", "initial_state": { "views": [ { "id": "vw-1", "title": "Top GitHub issues", "glyph": "", "items": [{ "id": "a", "title": "Row", "subtitle": "", "note": "", "url": "", "accent": false }], "by": "Eleven", "ts": 1700000000000 } ] }, "event": { "type": "view.remove", "id": "vw-1" }, "expected_state_update": { "views": [] } } ] }