From 033809102d2b5ea2824d9378039ac6c89121c6ae Mon Sep 17 00:00:00 2001 From: HTMLGuy <2415447+HTMLGuyLLC@users.noreply.github.com> Date: Sun, 29 Nov 2026 14:39:42 -0500 Subject: [PATCH] Fix notify license row and handle dropped watcher events notify 9 is CC0-1.0; the BSL-1.0 crate is its dependency xxhash-rust. The watcher starts a pass on rescan events and errors, logging the first error once with the home folder shortened. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 7 ++++++- THIRD_PARTY_NOTICES.md | 2 +- app/src-tauri/src/tracker.rs | 31 ++++++++++++++++++++++++++++++- crates/sources/src/time.rs | 2 +- deny.toml | 2 +- 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 896d749..4bbcf86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,16 @@ All notable changes are listed here. Format follows [Keep a Changelog](https://k ## [Unreleased] +### Fixed + +- The third-party notices list the right license for notify (CC0-1.0). +- When the system drops file-change events, the app checks your chats within a minute. + ## [0.5.12] - 2026-11-29 ### Changed -- Updated jiff to 1.0 and notify to 9. +- Updated the libraries that handle dates and file watching (jiff 1.0, notify 9). The app works the same. - Building from source needs Rust 1.91 or later. ## [0.5.11] - 2026-11-25 diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 8f47b63..2550a75 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -117,7 +117,7 @@ These are the direct runtime dependencies from the `Cargo.toml` files (versions | `thiserror` | MIT OR Apache-2.0 | | `memchr`, `jiff` | Unlicense OR MIT | | `ruzstd`, `rusqlite` | MIT | -| `notify` | BSL-1.0 | +| `notify` | CC0-1.0 | `rusqlite` is built with the `bundled` feature, so it includes SQLite, which is in the public domain. diff --git a/app/src-tauri/src/tracker.rs b/app/src-tauri/src/tracker.rs index 55f0853..d2d1575 100644 --- a/app/src-tauri/src/tracker.rs +++ b/app/src-tauri/src/tracker.rs @@ -41,10 +41,27 @@ fn watched_roots(app: &App) -> Vec { roots } +/// Whether a watcher report should start a pass. A rescan or an error means the OS dropped events +/// (a full buffer, a lost watch), so files may have changed without a create or modify event. +fn wants_pass(res: ¬ify::Result) -> bool { + match res { + Ok(e) => e.kind.is_create() || e.kind.is_modify() || e.need_rescan(), + Err(_) => true, + } +} + fn watch(app: &App, tx: &mpsc::Sender) -> Option { let tx = tx.clone(); + let mut logged_error = false; let mut w = notify::recommended_watcher(move |res: notify::Result| { - if res.is_ok_and(|e| e.kind.is_create() || e.kind.is_modify()) { + if let (Err(e), false) = (&res, logged_error) { + log::warn!( + "file watcher error, checking files now: {}", + shorten_home_in(&e.to_string(), std::env::home_dir().as_deref()) + ); + logged_error = true; + } + if wants_pass(&res) { let _ = tx.send(Msg::FilesChanged); } }) @@ -289,6 +306,18 @@ mod tests { tx } + #[test] + fn a_pass_follows_changes_rescans_and_errors_but_not_reads() { + use notify::event::{AccessKind, CreateKind, EventKind, Flag, ModifyKind}; + let ev = |kind| Ok(notify::Event::new(kind)); + assert!(wants_pass(&ev(EventKind::Create(CreateKind::File)))); + assert!(wants_pass(&ev(EventKind::Modify(ModifyKind::Any)))); + assert!(wants_pass(&Ok(notify::Event::new(EventKind::Other).set_flag(Flag::Rescan)))); + assert!(wants_pass(&Err(notify::Error::generic("buffer overflow")))); + assert!(!wants_pass(&ev(EventKind::Access(AccessKind::Any)))); + assert!(!wants_pass(&ev(EventKind::Other))); + } + #[test] fn stopping_waits_for_the_tracking_thread_and_says_if_it_ran_out_of_time() { assert!(stop(&tracker_busy_for(Duration::ZERO), Duration::from_secs(5))); diff --git a/crates/sources/src/time.rs b/crates/sources/src/time.rs index cb62a6e..c825b8e 100644 --- a/crates/sources/src/time.rs +++ b/crates/sources/src/time.rs @@ -17,7 +17,7 @@ pub fn local_day(ts: Timestamp) -> Date { ts.to_zoned_datetime(TimeZone::system()).date() } -/// The time zone the computer is in, to look up many times with [`Timestamp::to_zoned`]. +/// The time zone the computer is in, to look up many times with [`Timestamp::to_zoned_datetime`]. pub fn local_zone() -> TimeZone { TimeZone::system() } diff --git a/deny.toml b/deny.toml index b53362e..94330f2 100644 --- a/deny.toml +++ b/deny.toml @@ -30,7 +30,7 @@ allow = [ "CC0-1.0", "0BSD", "CDLA-Permissive-2.0", - "BSL-1.0", + "BSL-1.0", # xxhash-rust, via notify 9 ] confidence-threshold = 0.9