fix(sync): honor paused object policies

This commit is contained in:
2026-05-16 03:53:42 -04:00
parent 8c2dffddc7
commit 47eaea28a2
3 changed files with 47 additions and 1 deletions
+40
View File
@@ -181,6 +181,24 @@ fn sync_snapshot_updates_existing_tab_metadata() -> Result<(), Box<dyn Error>> {
Ok(())
}
#[test]
fn sync_snapshot_omits_paused_tabs() -> Result<(), Box<dyn Error>> {
let mut source = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
source.open_tab(UrlText::parse("https://example.com/research")?);
source.set_sync_object_policy(SyncObjectKind::Tabs, SyncObjectPolicy::Paused);
let bytes = source.build_sync_snapshot_bytes()?;
let mut target = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
let summary = target.apply_sync_snapshot_bytes(&bytes)?;
let snapshot = target.snapshot()?;
assert_eq!(summary.imported(), 0);
assert_eq!(summary.updated(), 0);
assert_eq!(summary.skipped(), 0);
assert!(snapshot.tabs.iter().all(|tab| tab.url().as_str() != "https://example.com/research"));
Ok(())
}
#[test]
fn sync_snapshot_updates_existing_bookmark_metadata() -> Result<(), Box<dyn Error>> {
let mut source = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
@@ -212,6 +230,28 @@ fn sync_snapshot_updates_existing_bookmark_metadata() -> Result<(), Box<dyn Erro
Ok(())
}
#[test]
fn sync_snapshot_omits_paused_bookmarks() -> Result<(), Box<dyn Error>> {
let mut source = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
let source_home_tab_id = source.snapshot()?.active_tab_id;
source.set_tab_sync_enabled(&source_home_tab_id, false)?;
let source_tab_id = source.open_tab(UrlText::parse("https://example.com/research")?);
source.set_tab_sync_enabled(&source_tab_id, false)?;
source.bookmark_active_tab()?;
source.set_sync_object_policy(SyncObjectKind::Bookmarks, SyncObjectPolicy::Paused);
let bytes = source.build_sync_snapshot_bytes()?;
let mut target = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
let summary = target.apply_sync_snapshot_bytes(&bytes)?;
let snapshot = target.snapshot()?;
assert_eq!(summary.imported(), 0);
assert_eq!(summary.updated(), 0);
assert_eq!(summary.skipped(), 0);
assert!(snapshot.bookmarks.is_empty());
Ok(())
}
#[test]
fn sync_snapshot_rejects_unknown_schema_rev() -> Result<(), Box<dyn Error>> {
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;