authoravatarclover caruso<git@paperclover.net>2026-10-19 12:24:25-07:00
committeravatarclover caruso<git@paperclover.net>2026-10-19 23:39:58-07:00
loga4c43834fe0b1f842728249f263c9dc06ebd702c
treec0b99e5327f2deda0c339fbabfe4f968e3fd96b1
parentb77c879d3ca88201a13162025edad2643f9a374f
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

fix(desktop): merge back uploads iCloud Drive lost on the Mac

The Mac's iCloud Drive notebooks had the gap the phone's had: an upload another device's replaced with no conflict version kept was gone at the next sync. The macOS file remote now keeps each image it publishes beside the section's replica and lists the ones the file lost among its versions, as the iOS one does (notebook::published), naming its conflict pages for the computer as Sharing names it. The "Name (Device).one" naming and the choice of folder move into notebook::published, so both hosts, and the Mac's handling of iCloud's own conflict versions, share them. A test lands another device's upload over this Mac's in a scratch folder; it fails before. - Edits you make on the Mac to an iCloud Drive notebook come back if iCloud lets another device's upload replace them, instead of being lost. Assisted-by: claude-opus-5.5

7 files changed, 223 insertions(+), 67 deletions(-)

arc/sync.md+4-4
......@@ -296,12 +296,12 @@ device that wrote it. A version of another section, or one that cannot be read,
296296the file as `Name (Device).one` instead.
297297
298298iCloud Drive can also lose an upload outright: another device's lands over it and no conflict
299version reaches this one. So on the iPhone and on Android each image a section publishes to a
300file a provider keeps stays in the cache (`notebook::published`) until the file is seen
299version reaches this one. So on the Mac, the iPhone and Android each image a section publishes
300to a file a provider keeps stays in the cache (`notebook::published`) until the file is seen
301301otherwise, then lists as one more version: one the file holds merges as nothing and goes, one
302302it lost merges back as a conflict version does, its conflict pages named for this device. One
303that cannot merge is kept beside the file as `Name (Device).one` on the iPhone, and in the
304cache on Android, where no provider takes a new document beside it.
303that cannot merge is kept beside the file as `Name (Device).one` on the Mac and the iPhone, and
304in the cache on Android, where no provider takes a new document beside it.
305305
306306On a cloud drive every read and write of a section file runs under `NSFileCoordinator`, so the
307307iCloud daemon never swaps a file between the stamp check and the append. A file iCloud evicted
crates/mobile/src/library.rs+5-24
......@@ -131,23 +131,12 @@ struct Coordinated {
131131}
132132
133133impl Coordinated {
134 /// The file `file` of the notebook folder, or lone section, at `notebook`. Its images are
135 /// kept beside its replica, so that they move with the notebook (`location::moved`).
134 /// The file `file` of the notebook folder, or lone section, at `notebook`.
136135 fn new(file: &Path, notebook: &Path, cache: &Path, elsewhere: bool) -> Self {
137 use notebook::location::{PUBLISHED, local, section_folder};
136 let device = VERSIONS.get().map(|(.., device)| device.clone());
138137 let published = elsewhere
139 .then(|| {
140 Some(section_folder(
141 cache,
142 &local(notebook).ok()?,
143 &local(file).ok()?,
144 ))
145 })
146 .flatten()
147 .map(|folder| {
148 let device = VERSIONS.get().map(|(.., device)| device.clone());
149 Published::new(folder.join(PUBLISHED), device)
150 });
138 .then(|| Published::of(cache, notebook, file, device))
139 .flatten();
151140 Self {
152141 file: file.to_owned(),
153142 published,
......@@ -232,16 +221,8 @@ impl Remote for Coordinated {
232221 && published.holds(id)
233222 {
234223 if keep {
235 let stem = self.file.file_stem().unwrap_or_default().to_string_lossy();
236224 let device = VERSIONS.get().map_or("this device", |(.., device)| device);
237 let beside = (1..)
238 .map(|n| match n {
239 1 => format!("{stem} ({device}).one"),
240 _ => format!("{stem} ({device} {n}).one"),
241 })
242 .map(|name| self.file.with_file_name(name))
243 .find(|beside| std::fs::symlink_metadata(beside).is_err())
244 .ok_or(io::ErrorKind::AlreadyExists)?;
225 let beside = notebook::published::beside(&self.file, device);
245226 coordinated(&beside, true, || std::fs::copy(id, &beside))??;
246227 }
247228 return std::fs::remove_file(id);
crates/notebook/src/published.rs+27
......@@ -48,6 +48,15 @@ impl Published {
4848 }
4949 }
5050
51 /// The images kept of the section file `file` of the notebook folder, or lone section, at
52 /// `notebook`, which `cache` holds the replicas of: beside the section's replica, so that
53 /// they move with the notebook (`location::moved`).
54 pub fn of(cache: &Path, notebook: &Path, file: &Path, device: Option<String>) -> Option<Self> {
55 use crate::location::{PUBLISHED, local, section_folder};
56 let folder = section_folder(cache, &local(notebook).ok()?, &local(file).ok()?);
57 Some(Self::new(folder.join(PUBLISHED), device))
58 }
59
5160 fn kept(&self) -> Vec<Kept> {
5261 let entries = crate::fs::read_dir(&self.folder).into_iter().flatten();
5362 entries
......@@ -139,12 +148,30 @@ impl Published {
139148 .collect()
140149 }
141150
151 pub fn device(&self) -> Option<&str> {
152 self.device.as_deref()
153 }
154
142155 /// Whether version `id` is an image kept here.
143156 pub fn holds(&self, id: &str) -> bool {
144157 Path::new(id).parent() == Some(self.folder.as_path())
145158 }
146159}
147160
161/// Where a version of `file` that cannot merge is kept beside it, as iCloud Drive keeps a
162/// conflict version: "Name (Device).one", numbered past any name taken.
163pub fn beside(file: &Path, device: &str) -> PathBuf {
164 let stem = file.file_stem().unwrap_or_default().to_string_lossy();
165 (1..)
166 .map(|n| match n {
167 1 => format!("{stem} ({device}).one"),
168 n => format!("{stem} ({device} {n}).one"),
169 })
170 .map(|name| file.with_file_name(name))
171 .find(|beside| std::fs::symlink_metadata(beside).is_err())
172 .unwrap_or_default()
173}
174
148175/// The hex of a stamp's digest, which names an image this device keeps.
149176pub(crate) fn digest(stamp: &Stamp) -> String {
150177 use sha2::Digest;
crates/snowbound/Cargo.toml+1-1
......@@ -65,7 +65,7 @@ web-sys = { version = "0.3", features = ["console", "Document", "Element", "Html
6565libc = "0.2"
6666objc2 = "0.5.2"
6767objc2-app-kit = { version = "0.2.2", default-features = false, features = ["NSAlert", "NSButton", "NSCell", "NSControl", "NSView", "NSResponder", "NSWindow", "NSApplication", "NSEvent", "NSMenu", "NSMenuItem", "NSColor", "NSColorSpace", "NSDatePicker", "NSDatePickerCell", "NSOpenPanel", "NSPanel", "NSSavePanel", "NSWorkspace"] }
68objc2-foundation = { version = "0.2.2", default-features = false, features = ["NSString", "NSThread", "NSAttributedString", "NSDate", "NSCalendar", "NSDateFormatter", "NSGeometry", "NSLocale", "NSPathUtilities", "NSTimeZone", "NSURL", "NSArray", "NSRange", "NSError", "NSFileCoordinator", "NSFilePresenter", "NSFileVersion", "NSFileManager", "NSNotification", "NSOperation", "block2"] }
68objc2-foundation = { version = "0.2.2", default-features = false, features = ["NSString", "NSThread", "NSAttributedString", "NSDate", "NSCalendar", "NSDateFormatter", "NSGeometry", "NSLocale", "NSPathUtilities", "NSTimeZone", "NSURL", "NSArray", "NSRange", "NSError", "NSFileCoordinator", "NSFilePresenter", "NSFileVersion", "NSFileManager", "NSHost", "NSNotification", "NSOperation", "block2"] }
6969block2 = "0.5.1"
7070
7171[target.'cfg(not(any(target_os = "macos", target_arch = "wasm32")))'.dependencies]
crates/snowbound/src/icloud_linux.rs+3
......@@ -24,6 +24,7 @@ pub fn drive() -> Option<PathBuf> {
2424pub fn section(
2525 notebook: &Notebook,
2626 _: &Path,
27 _: &Path,
2728 path: &str,
2829 key: Option<&onestore::protected::Key>,
2930 offline: bool,
......@@ -46,6 +47,8 @@ pub fn lone_section(
4647
4748pub fn background(
4849 notebook: &Notebook,
50 _: &Path,
51 _: &Path,
4952 notify: impl Fn() + Send + 'static,
5053) -> Result<Background, notebook::Error> {
5154 notebook.background(false, true, notify)
crates/snowbound/src/icloud_macos.rs+175-33
......@@ -6,6 +6,7 @@
66use block2::{RcBlock, StackBlock};
77use notebook::{
88 Remote, Version,
9 published::{Published, Written},
910 session::{Background, Notebook, Section},
1011};
1112use objc2::{
......@@ -13,6 +14,8 @@ use objc2::{
1314 rc::Retained,
1415 runtime::{AnyObject, NSObject, NSObjectProtocol, ProtocolObject},
1516};
17#[allow(deprecated)]
18use objc2_foundation::NSHost;
1619use objc2_foundation::{
1720 NSFileCoordinator, NSFileCoordinatorReadingOptions, NSFileCoordinatorWritingOptions,
1821 NSFileManager, NSFilePresenter, NSFileVersion, NSNotification, NSNotificationCenter,
......@@ -26,7 +29,7 @@ use std::{
2629 io,
2730 path::{Path, PathBuf},
2831 ptr::NonNull,
29 sync::Mutex,
32 sync::{Mutex, OnceLock},
3033 time::Duration,
3134};
3235
......@@ -238,8 +241,13 @@ pub fn download(root: &Path) -> usize {
238241const SF_DATALESS: u32 = 0x4000_0000;
239242
240243/// A section file in iCloud Drive, read and published under file coordination, with the
241/// conflict versions iCloud keeps beside it.
242pub struct Coordinated(pub PathBuf);
244/// conflict versions iCloud keeps beside it and the images this Mac published to it, kept
245/// until the file holds them: an upload another device's replaced merges back
246/// (`notebook::published`).
247pub struct Coordinated {
248 file: PathBuf,
249 published: Option<Published>,
250}
243251
244252fn uncommitted(error: io::Error) -> CommitError {
245253 CommitError {
......@@ -249,8 +257,24 @@ fn uncommitted(error: io::Error) -> CommitError {
249257}
250258
251259impl Coordinated {
260 /// The file `file` of the notebook folder, or lone section, at `notebook`, whose replicas
261 /// `cache` holds.
262 pub fn new(file: &Path, notebook: &Path, cache: &Path) -> Self {
263 static DEVICE: OnceLock<Option<String>> = OnceLock::new();
264 // The computer's name as Sharing shows it, as iCloud names this Mac's versions; the
265 // Network framework that deprecates NSHost has no such name.
266 #[allow(deprecated)]
267 let device = DEVICE.get_or_init(|| {
268 unsafe { NSHost::currentHost().localizedName() }.map(|name| name.to_string())
269 });
270 Self {
271 file: file.to_owned(),
272 published: Published::of(cache, notebook, file, device.clone()),
273 }
274 }
275
252276 fn conflicts(&self) -> io::Result<Vec<Retained<NSFileVersion>>> {
253 let url = url(&self.0).ok_or_else(|| io::Error::from(io::ErrorKind::InvalidInput))?;
277 let url = url(&self.file).ok_or_else(|| io::Error::from(io::ErrorKind::InvalidInput))?;
254278 Ok(
255279 unsafe { NSFileVersion::unresolvedConflictVersionsOfItemAtURL(&url) }
256280 .map(|versions| versions.to_vec_retained())
......@@ -272,15 +296,15 @@ fn version_path(version: &NSFileVersion) -> Option<PathBuf> {
272296
273297impl Remote for Coordinated {
274298 fn read(&mut self) -> io::Result<Vec<u8>> {
275 present(&self.0)?;
276 coordinated(&self.0, false, || onestore::read_file(&self.0))?
299 present(&self.file)?;
300 coordinated(&self.file, false, || onestore::read_file(&self.file))?
277301 }
278302
279303 fn stamp(&mut self) -> io::Result<Stamp> {
280 present(&self.0)?;
281 coordinated(&self.0, false, || {
304 present(&self.file)?;
305 coordinated(&self.file, false, || {
282306 use std::io::Read;
283 let mut file = std::fs::File::open(&self.0)?;
307 let mut file = std::fs::File::open(&self.file)?;
284308 let mut header = [0; 1024];
285309 file.read_exact(&mut header)?;
286310 Ok(Stamp {
......@@ -291,18 +315,29 @@ impl Remote for Coordinated {
291315 }
292316
293317 fn publish(&mut self, transaction: &Transaction) -> Result<(), CommitError> {
294 present(&self.0).map_err(uncommitted)?;
295 coordinated(&self.0, true, || transaction.commit_file(&self.0)).map_err(uncommitted)?
318 present(&self.file).map_err(uncommitted)?;
319 coordinated(&self.file, true, || {
320 transaction.commit_file(&self.file)?;
321 if let Some(published) = &self.published {
322 // A copy it could not keep only leaves the publication unprotected.
323 let _ = std::fs::File::open(&self.file)
324 .and_then(|mut file| published.keep(Written::InPlace(&mut file), transaction));
325 }
326 Ok(())
327 })
328 .map_err(uncommitted)?
296329 }
297330
298331 fn confirm(&mut self, base: &Stamp) -> Result<(), CommitError> {
299 coordinated(&self.0, true, || onestore::confirm_file(&self.0, base)).map_err(uncommitted)?
332 coordinated(&self.file, true, || {
333 onestore::confirm_file(&self.file, base)
334 })
335 .map_err(uncommitted)?
300336 }
301337
338 /// iCloud's conflict versions, then this Mac's publications the file lost.
302339 fn versions(&mut self) -> io::Result<Vec<Version>> {
303 Ok(self
304 .conflicts()?
305 .into_iter()
340 let mut listed: Vec<Version> = (self.conflicts()?.into_iter())
306341 .filter_map(|version| {
307342 Some(Version {
308343 id: version_path(&version)?.to_string_lossy().into_owned(),
......@@ -310,10 +345,26 @@ impl Remote for Coordinated {
310345 .map(|name| name.to_string()),
311346 })
312347 })
313 .collect())
348 .collect();
349 if self.published.is_some() {
350 let stamp = self.stamp()?;
351 listed.extend(
352 self.published
353 .iter()
354 .flat_map(|published| published.versions(&stamp)),
355 );
356 }
357 Ok(listed)
314358 }
315359
316360 fn version(&mut self, id: &str) -> io::Result<Vec<u8>> {
361 if self
362 .published
363 .as_ref()
364 .is_some_and(|published| published.holds(id))
365 {
366 return std::fs::read(id);
367 }
317368 let version = self.conflict(id)?;
318369 if !unsafe { version.hasLocalContents() } {
319370 return Err(io::Error::new(
......@@ -324,28 +375,33 @@ impl Remote for Coordinated {
324375 std::fs::read(id)
325376 }
326377
378 /// A version that cannot merge is kept beside the file under a name of its own:
379 /// "Section (Clover's iPhone).one".
327380 fn retire(&mut self, id: &str, keep: bool) -> io::Result<()> {
381 if let Some(published) = &self.published
382 && published.holds(id)
383 {
384 if keep {
385 let device = published.device().unwrap_or("this Mac");
386 let beside = notebook::published::beside(&self.file, device);
387 coordinated(&beside, true, || std::fs::copy(id, &beside))??;
388 }
389 return std::fs::remove_file(id);
390 }
328391 let version = match self.conflict(id) {
329392 Ok(version) => version,
330393 // Another device resolved it first.
331394 Err(error) if error.kind() == io::ErrorKind::NotFound => return Ok(()),
332395 Err(error) => return Err(error),
333396 };
334 coordinated(&self.0, true, || {
397 coordinated(&self.file, true, || {
335398 if keep {
336 // Beside the file, under a name of its own: "Section (Clover's iPhone).one".
337399 let device = unsafe { version.localizedNameOfSavingComputer() }
338400 .map_or_else(|| "another device".to_owned(), |name| name.to_string());
339 let stem = self.0.file_stem().unwrap_or_default().to_string_lossy();
340 let folder = self.0.parent().unwrap_or(Path::new("."));
341 let kept = (1..)
342 .map(|n| match n {
343 1 => folder.join(format!("{stem} ({device}).one")),
344 n => folder.join(format!("{stem} ({device} {n}).one")),
345 })
346 .find(|kept| !kept.exists())
347 .unwrap_or_default();
348 std::fs::write(kept, std::fs::read(id)?)?;
401 std::fs::write(
402 notebook::published::beside(&self.file, &device),
403 std::fs::read(id)?,
404 )?;
349405 }
350406 unsafe {
351407 version.setResolved(true);
......@@ -363,6 +419,7 @@ impl Remote for Coordinated {
363419pub fn section(
364420 notebook: &Notebook,
365421 root: &Path,
422 cache: &Path,
366423 path: &str,
367424 key: Option<&onestore::protected::Key>,
368425 offline: bool,
......@@ -371,7 +428,8 @@ pub fn section(
371428 if !notebook.replica_path(path)?.exists() {
372429 fetch(&root.join(path))?;
373430 }
374 let connect = |file: &Path| Ok(Coordinated(file.to_owned()));
431 let (root, cache) = (root.to_owned(), cache.to_owned());
432 let connect = move |file: &Path| Ok(Coordinated::new(file, &root, &cache));
375433 let section = match key {
376434 Some(key) => notebook.section_unlocked_with(path, key, connect, offline, notify)?,
377435 None => notebook.section_with(path, connect, offline, notify)?,
......@@ -400,7 +458,10 @@ pub fn lone_section(
400458 let section = Section::open_with(
401459 file,
402460 cache,
403 |file| Ok(Coordinated(file.to_owned())),
461 {
462 let cache = cache.to_owned();
463 move |file: &Path| Ok(Coordinated::new(file, file, &cache))
464 },
404465 offline,
405466 notify,
406467 )?;
......@@ -414,9 +475,13 @@ pub fn lone_section(
414475/// presenter or the folder's watch reports it.
415476pub fn background(
416477 notebook: &Notebook,
478 root: &Path,
479 cache: &Path,
417480 notify: impl Fn() + Send + 'static,
418481) -> Result<Background, notebook::Error> {
419 notebook.background_with(false, true, |file| Coordinated(file.to_owned()), notify)
482 let (root, cache) = (root.to_owned(), cache.to_owned());
483 let remote = move |file: &Path| Coordinated::new(file, &root, &cache);
484 notebook.background_with(false, true, remote, notify)
420485}
421486
422487struct Ivars {
......@@ -590,7 +655,7 @@ mod tests {
590655 let notebook = Notebook::create(&root, &cache, Notebook::NEW_COLOR, &page).unwrap();
591656 assert!(ubiquitous(&root));
592657 let path = notebook.catalog().sections[0].path.clone();
593 let section = section(&notebook, &root, &path, None, false, || {}).unwrap();
658 let section = section(&notebook, &root, &cache, &path, None, false, || {}).unwrap();
594659 let (space, ..) = section.pages().unwrap()[0].clone();
595660 let title = section
596661 .page(space)
......@@ -622,7 +687,7 @@ mod tests {
622687 .unwrap();
623688 // Wakes skip the pause in typing, as leaving the window does.
624689 let file = root.join(&path);
625 let mut remote = Coordinated(file.clone());
690 let mut remote = Coordinated::new(&file, &root, &cache);
626691 let deadline = std::time::Instant::now() + Duration::from_secs(30);
627692 loop {
628693 section.wake();
......@@ -646,4 +711,81 @@ mod tests {
646711 let _ = std::fs::remove_dir_all(&cache);
647712 result.unwrap();
648713 }
714
715 /// This Mac's upload to a notebook in iCloud Drive is lost, another device's landing over
716 /// it with no conflict version kept: the next sync merges it back. Coordination works on
717 /// any folder, so a scratch one stands in for iCloud Drive's.
718 #[test]
719 fn an_upload_icloud_lost_merges_back() {
720 use onestore::op::{Edit, Op, PageOp};
721 let folder = std::env::temp_dir().join(format!("snowbound-lost-{}", std::process::id()));
722 let (root, cache) = (folder.join("Notes"), folder.join("cache"));
723 std::fs::create_dir_all(&folder).unwrap();
724 let page = onestore::PageCreation::new(None, Some("Shared"), "Test").unwrap();
725 let notebook = Notebook::create(&root, &cache, Notebook::NEW_COLOR, &page).unwrap();
726 let path = notebook.catalog().sections[0].path.clone();
727 let file = root.join(&path);
728 let section = section(&notebook, &root, &cache, &path, None, false, || {}).unwrap();
729 let space = section.pages().unwrap()[0].0;
730 let stored = || {
731 let arena = onestore::Arena::default();
732 let section = onestore::Section::open(&arena, std::fs::read(&file).unwrap()).unwrap();
733 section.page(space).unwrap()
734 };
735 let published = |what: &str, ready: &dyn Fn(&onestore::page::Page) -> bool| {
736 let deadline = std::time::Instant::now() + Duration::from_secs(20);
737 while !ready(&stored()) {
738 assert!(
739 std::time::Instant::now() < deadline,
740 "{what}: {:?}",
741 stored()
742 );
743 section.wake();
744 std::thread::sleep(Duration::from_millis(50));
745 }
746 };
747 let edit = |op| Edit {
748 at: 134_030_000_000_000_000,
749 ops: vec![Op::Page { space, op }],
750 };
751 section
752 .apply("Test", edit(PageOp::Color(Some(0x0011_2233))))
753 .unwrap();
754 published("the shared edit", &|page| page.color == Some(0x0011_2233));
755 // Another device's copy, sharing that edit.
756 let mut theirs = std::fs::read(&file).unwrap();
757 let title = (stored().objects.iter())
758 .find_map(|object| match object {
759 onestore::page::PageObject::Title(title) => {
760 title.outlines[0].paragraphs[0].text().map(|text| text.id)
761 }
762 _ => None,
763 })
764 .unwrap();
765 section
766 .apply(
767 "Test",
768 edit(PageOp::Text {
769 text: title,
770 range: 0..0,
771 with: "Mac ".into(),
772 }),
773 )
774 .unwrap();
775 published("this Mac's edit", &|page| page.title.starts_with("Mac "));
776 let arena = onestore::Arena::default();
777 let mut other = onestore::Section::open(&arena, theirs.clone()).unwrap();
778 other
779 .apply("Other", &edit(PageOp::Color(Some(0x00ab_cdef))))
780 .unwrap();
781 other.seal().unwrap().unwrap().apply(&mut theirs).unwrap();
782 // iCloud Drive: the other device's upload lands over this Mac's, with no version.
783 std::fs::write(&file, &theirs).unwrap();
784 published("the lost edit merged back", &|page| {
785 page.title.starts_with("Mac ") && page.color == Some(0x00ab_cdef)
786 });
787 section.close().unwrap();
788 drop(notebook);
789 let _ = std::fs::remove_dir_all(&folder);
790 }
649791}
crates/snowbound/src/library.rs+8-5
......@@ -413,7 +413,7 @@ impl Library {
413413 }
414414 let mut notebook = Notebook::open(location, cache);
415415 let (background, watch) = match &mut notebook {
416 Ok(notebook) => local_background(notebook, location),
416 Ok(notebook) => local_background(notebook, location, cache),
417417 Err(_) => (None, None),
418418 };
419419 let name = display_name(cache, location).unwrap_or_else(|| file_name(Path::new(location)));
......@@ -819,7 +819,7 @@ impl Library {
819819
820820 /// A notebook `Notebook::create` just made in the folder at `location`.
821821 pub fn created(location: &str, mut notebook: Notebook, cache: &Path) -> Self {
822 let (background, watch) = local_background(&mut notebook, location);
822 let (background, watch) = local_background(&mut notebook, location, cache);
823823 Self {
824824 background,
825825 watch,
......@@ -935,8 +935,9 @@ impl Library {
935935 let file = Path::new(&self.location).join(path);
936936 #[cfg(target_os = "macos")]
937937 if self.in_icloud() {
938 section.relocate_with(file, |file| {
939 Ok(crate::icloud::Coordinated(file.to_owned()))
938 let (root, cache) = (PathBuf::from(&self.location), self.cache.clone());
939 section.relocate_with(file, move |file| {
940 Ok(crate::icloud::Coordinated::new(file, &root, &cache))
940941 })?;
941942 } else {
942943 section.relocate(file)?;
......@@ -1024,6 +1025,7 @@ impl Library {
10241025 crate::icloud::section(
10251026 notebook,
10261027 root,
1028 &self.cache,
10271029 path,
10281030 key.as_ref(),
10291031 offline(),
......@@ -1533,12 +1535,13 @@ fn read_tag_art(notebook: &Notebook) -> TagArt {
15331535fn local_background(
15341536 notebook: &mut Notebook,
15351537 location: &str,
1538 cache: &Path,
15361539) -> (Option<Arc<Background>>, Option<Arc<crate::watch::Watch>>) {
15371540 let reports = Arc::new(OnceLock::new());
15381541 let watch = watcher(location, Arc::clone(&reports));
15391542 let copies = !crate::watch::on_this_computer(Path::new(location));
15401543 let background = match crate::icloud::ubiquitous(Path::new(location)) {
1541 true => crate::icloud::background(notebook, notify_background),
1544 true => crate::icloud::background(notebook, Path::new(location), cache, notify_background),
15421545 false => notebook.background(watch.is_some(), copies, notify_background),
15431546 };
15441547 let Some(background) = background