From bd2236bb894d3e22b777bc1525e7faf95d6cc7b0 Mon Sep 17 00:00:00 2001 From: Dasemu Date: Mon, 26 Oct 2026 06:45:04 +0100 Subject: [PATCH] docs: type emoji, Tags & types view, type_defs sync and history Co-Authored-By: Claude Opus 5.5 --- docs/app.md | 14 ++++++++++++++ docs/architecture.md | 15 ++++++++++++++- docs/history.md | 4 ++++ docs/sync.md | 7 +++++++ 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/docs/app.md b/docs/app.md index 46af9fd..807f6c5 100644 --- a/docs/app.md +++ b/docs/app.md @@ -147,6 +147,20 @@ Both are plain names with no page, shown as one row of pills under the title. - **Hub as tag**: a note's direct hub also counts as a tag of the same name (not shown as a chip, not stored in the tags). It lists in that tag's view and graph node and merges with a same-name type or tag; "Rename" there never renames the hub itself. +- **Type emoji**: each type can have an emoji, stored in the graph (synced, in history). It is + shown before the names of pages of that type: page title, All pages, quick switcher, + recents, tabs, hub members, tag view (also its title when the tag is a type), linked + references, related pages, the type pill and picker, and the tree view labels. Never in the + network graph. `AppState.typeIcons` caches type → emoji (`loadTypeIcons`, at start and + after edits); list DTOs carry `pageType` and `TypeIcon` (`widgets/type_icon.dart`) looks + it up. +- **Tags & types view** (sidebar, under All pages; also a tab route): "Types" lists every type + with its emoji, page count and seeded suggestions; the emoji button opens a picker (curated + grid by category, a field to paste any single emoji, "Remove emoji"); "New type" creates a + type with no pages; the `⋯` menu renames (keeps the emoji) or deletes (confirms how many + pages lose it). "Tags" lists every tag with its count and sources (listed, type, hub); + explicit tags can be renamed or deleted, tags that only come from a type or a hub show a + lock explaining where to change them. Tapping a name opens its tag view. - In the graph every tag is a virtual node drawn as a hollow accent ring and linked to its pages with a separate edge kind (TAGGED); tapping one opens its tag view. A hub's implicit tag (or a tag named like a hub) has no ring of its own: the hub node diff --git a/docs/architecture.md b/docs/architecture.md index caa38ec..c75bd99 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -37,6 +37,18 @@ crates may add their own tables to the same database (prefix them: `search_*`, ` - **A page has at most one type** (`Page.types`, 0 or 1 entries; `Page::page_type()`), a name saying what the page is. It implies a tag of the same name. API: `set_page_type(page, Option<&str>)`, `type_catalog` (types in use by count, then the seeded `SUGGESTED_TYPES`). +- **Type definitions** (schema v8): graph-wide metadata of a type name lives in + `type_defs(type_key, name, icon, removed, hlc)` (`TypeDef`), synced with its own op + `Op::PutTypeDef { def }`, last writer wins per name key (like `SetAlias`). It carries the + type's emoji (`icon`, a short non-ASCII string, `normalize_icon`) and keeps a type in the + vocabulary while no page uses it; `removed` is a tombstone (it also hides a seeded + suggestion of that name). API: `create_type`, `set_type_icon(name, Option<&str>)`, + `rename_type` (`rename_tag` plus keeping an unused type), `remove_type` (clears the type + from its pages, tombstones the definition), `type_defs`, `all_page_types`. `rename_tag` + moves the definition to the new name (a target with its own icon keeps it). `type_catalog` + lists used types, then defined unused ones, then remaining suggestions, each with its icon; + `tag_catalog` counts per tag the pages listing it (`explicit`), typed with it (`typed`) + and carrying it through their hub (`from_hub`). - **A page's direct hub is an implicit tag**, like its type: members of hub "Anime" are filed under "Anime" (`page_tags`, `pages_with_tag`, `tag_catalog`, the graph's tag node). It is not stored in `Page.tags` and merges with a same-name type or tag. Only the direct hub @@ -50,7 +62,8 @@ crates may add their own tables to the same database (prefix them: `search_*`, ` A tag named like a hub in the graph uses the hub's node instead; its members, already linked by `CONTAINS`, get no `TAGGED` edge. - Known limitations: replicas still on the old schema may overwrite tags with stale values (LWW per page), and `rename_tag` is a bulk page edit, so concurrent edits on another replica can undo part of it. -- Exports use `synapse-tags::` and `synapse-type::` (see `history.md`). +- Exports use `synapse-tags::` and `synapse-type::` (see `history.md`); type definitions go + to `types.json`. ## Hubs and namespaces (`synapse-core::structure`) Two orthogonal ways to organise pages. diff --git a/docs/history.md b/docs/history.md index ac1f3cf..d08449c 100644 --- a/docs/history.md +++ b/docs/history.md @@ -16,6 +16,10 @@ works on it (`git --git-dir=/history log`, `clone`, ...). bullets). A page's tags (names, no pages) are listed in `synapse-tags:: ["a","b"]` and its single type in `synapse-type:: persona` (both restored with the page; the old list form `synapse-types::` is still read, first entry wins). Exports of older versions may carry `synapse-kind:: tag` on a former tag page; it is ignored and the page restores as a note. A page in hubs lists their titles in `synapse-hubs:: ["A","B"]`, so renaming a hub re-exports its members. Restore sets kinds first, then memberships (missing hubs or memberships that would now form a cycle are skipped). +- `types.json`: live type definitions (`[{name, icon}]`, sorted by name key; left out when + there are none). `restore_graph` defines each listed type with its icon; types defined + since keep existing but lose their icon (a tombstone would also hide a seeded suggestion). + A change alone commits as "types updated". - `assets.json`: manifest `hash → name/size/mime`, sorted. Asset bytes are **not** committed (the blob store is already content-addressed) unless `HistoryOptions::include_blobs`, which adds `blobs/`. diff --git a/docs/sync.md b/docs/sync.md index 0c743e6..e3b99f0 100644 --- a/docs/sync.md +++ b/docs/sync.md @@ -105,6 +105,13 @@ runtime (`start()` spawns onto the current one). After local edits call `trigger - **Uploads** only complete when the server reports the blob stored (`HEAD` 200); `202`/`409` responses make the client resume until done. +## Op kinds +`upsert_page`, `delete_page`, `upsert_block`, `delete_block`, `put_asset`, `set_alias` and +`put_type_def` (type metadata: name, emoji, tombstone; LWW per type name key, schema v8). +A client too old to know an op kind cannot parse a pull batch containing it: its sync stops +with an error (local edits stay pending) until it is updated. The protocol version was not +bumped for `put_type_def`, so update every client together with the server. + ## Limits / not in v1 - Per-user tokens and per-graph ACLs: `auth::Principal` already carries a graph allow-list; only the token source (env list) is implemented.