fix(core): sort tags on every write and make the v6 migration tolerant and transactional

Tags are sorted and deduplicated by title_key in the migration and in
write_page_row (remote ops included). The migration runs in one transaction,
rebuilds page_tags once and repairs malformed tags/types values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Opus 5.5 committed 2026-10-26 03:49:42 +01:00
1 parent 50e5572575
commit 3585ce67af
5 files changed
+125 -35

No files matched your search

+1
View File
@@ -41,6 +41,7 @@ crates may add their own tables to the same database (prefix them: `search_*`, `
the first; `PageKind` has no `Tag` any more and "tag" parses as a note.
- In the graph (`synapse-ffi`) every tag in use is a virtual node (`GraphNode.is_tag`, id
`tag:<title_key>`, no page), with a `TAGGED` edge from each tagged page (type included).
- 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`).
## Hubs and namespaces (`synapse-core::structure`)