git clone https://garage44.eu/jeroen/pinnacle.gitcartopolis-agent · 2026-11-30T17:54:33Z
feat(sync): keep the display server's folder on its own device The display server is about to keep past notifications in the vault, at data:/display/notices: what this device showed and how many were seen here. Another device's list is not this one's, so data:/display/ is left out of sync as the Bluetooth keys are.
docs/backup-and-sync.md | 1 +
sync/src/lib.rs | 6 +++++-
sync/src/tests.rs | 15 +++++++++++++++
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/docs/backup-and-sync.md b/docs/backup-and-sync.md
index d13fd0c..8010128 100644
--- a/docs/backup-and-sync.md
+++ b/docs/backup-and-sync.md
@@ -50,6 +50,7 @@ Every file in the vault (`data:/`), but what belongs to one device:
| `data:/bt/bonds` | A Bluetooth bond is the key of one radio with one other radio. |
| `data:/bt/identity` | This device's Bluetooth identity key: devices paired with know it by it, and a second device with it would pass for this one. |
| `data:/sync/` | The sync service's own state: what each device last agreed on. |
+| `data:/display/` | The display server's: the past notifications this device showed, and how many were seen here. |
So the apps' folders (`data:/apps/notes`, …), the address book and the
contacts' cards, conversations, texts, Wi-Fi networks and their passwords,
diff --git a/sync/src/lib.rs b/sync/src/lib.rs
index 74011bb..29530a6 100644
--- a/sync/src/lib.rs
+++ b/sync/src/lib.rs
@@ -49,7 +49,11 @@ const NAME_MAX: usize = 58;
/// What is kept in step: every path in the vault but what belongs to one
/// device. Paths are the vault's (`/apps/notes/x`, no `data:`).
pub fn synced(path: &str) -> bool {
- !(path == "/p2p/identity" || path == "/bt/bonds" || path == "/bt/identity" || path.starts_with("/sync/"))
+ !(path == "/p2p/identity"
+ || path == "/bt/bonds"
+ || path == "/bt/identity"
+ || path.starts_with("/sync/")
+ || path.starts_with("/display/"))
}
/// A file as one device has it.
diff --git a/sync/src/tests.rs b/sync/src/tests.rs
index ec7318d..3349a6e 100644
--- a/sync/src/tests.rs
+++ b/sync/src/tests.rs
@@ -416,3 +416,18 @@ fn bluetooth_keys_stay_on_their_device() {
assert_eq!(phone.text("/bt/identity"), Some("phone's radio"));
assert_eq!(phone.text("/bt/bonds"), None);
}
+
+/// Each device's list of past notifications stays its own: what it showed
+/// and what was seen there, which the display server writes whole.
+#[test]
+fn notifications_stay_on_their_device() {
+ let mut laptop = Disk::with(&[
+ ("/apps/notes/shopping", "bread\n"),
+ ("/display/notices", "laptop's list"),
+ ]);
+ let mut phone = Disk::with(&[("/display/notices", "phone's list")]);
+ sync(&mut laptop, &mut phone, &[], None);
+ assert_eq!(phone.text("/apps/notes/shopping"), Some("bread\n"));
+ assert_eq!(phone.text("/display/notices"), Some("phone's list"));
+ assert_eq!(laptop.text("/display/notices"), Some("laptop's list"));
+}