Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/rules/theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ paths:
## Sync

- **Each user theme syncs as the `AppSettings` record `theme.<id>`**, holding only its schema 3 keys, encoded at schema 3, so the previous stable reads and edits it. A theme that sets a key schema N introduced also syncs `themeSchema<N>.<id>`, holding the whole theme at schema N. An older Mac skips a record it cannot read but keeps it as the merge base, so a single record at the newer schema would be overwritten by its next edit.
- **Each record owns its keys.** Applying `theme.<id>` keeps the local theme's keys newer than 3, and applying `themeSchema<N>.<id>` changes only the keys schema N introduced. `theme.<id>` also owns the name, author and appearance. A user edit marks `theme.<id>` dirty, which changes nothing on the server unless its keys changed or the server lacks it. It marks `themeSchema<N>.<id>` only when the keys schema N introduced changed or the record was never uploaded, since that record holds the whole theme and a stale copy would revert another Mac's edit. A trash marks both deleted once the trash lands, an undo of it keeps no deletion it does not replace, and a load or migration marks nothing. Built-ins never sync.
- **Each record owns its keys.** Applying `theme.<id>` keeps the local theme's keys newer than 3, and applying `themeSchema<N>.<id>` changes only the keys schema N introduced. `theme.<id>` also owns the name, author and appearance. A user edit marks a record dirty when the keys it owns changed, or when this Mac holds no copy of it and the theme sets its keys. Each record pushes whole, so a re-push of keys the edit did not touch would revert another Mac's edit of them. While the first full pull is pending, theme records wait for it, as the seed does. A trash marks both deleted once the trash lands, an undo of it keeps no deletion it does not replace, and a load or migration marks nothing. Built-ins never sync.
- **A synced theme is untrusted.** `ThemeCatalog.applyRemote(category:data:)` checks the category id (never a built-in), a 64 KB cap, nesting depth, a full decode and the file id, and never writes over bytes it has not read. A validation failure is a logged skip; only a disk failure returns `.failed`, which withholds the change token so the pull replays. A remote delete trashes the file through `removeWithoutSync(ids:)`.
- The light and dark theme ids sync. The appearance mode and fonts are device-local, and a received `appearance` record never changes them.
- `SyncCoordinator.themeContentKind` names `ThemeSchema.current`, so a Mac upgraded past a bump refetches the zone once. After the first full pull, only local themes the server lacks are marked dirty, once.
Loading