Keep file-watch observation from serializing unrelated IO

Scope open-registration and rename/remove ordering to overlapping paths;
let descriptor mutations and directory creation proceed without that lock.
Prove blocked opens/writes cannot stall unrelated namespaces, including a
queued rename, and retain post-rename descriptor notifications. Document
handler-owned watch lifetimes and narrow paths; test natural idle exit.

Card: SAU-359
This commit is contained in:
SAU-359 implementer
2026-10-30 21:06:10 +00:00
parent ff6fc62f05
commit 0c1ef74f6e
5 changed files with 336 additions and 19 deletions
+10 -4
View File
@@ -27,10 +27,16 @@ impl Call {
}
/// Receive progress notifications before the result arrives.
///
/// For `core.watch`, await this call in a background task for the process's
/// lifetime. Scan only after `armed`, and rescan on `changed`; events can
/// coalesce. The call has no cancellation API. Do not use endpoint connect
/// retries to wait for file publication.
/// For `core.watch`, poll the call future alongside work in the handler, then
/// drop it when the handler returns. Do not put it in `background()` just to
/// keep the watch alive: background tasks keep the process alive, while the
/// watch only ends when the process ends. Dropping the future does not cancel
/// the host watch, but it lets an otherwise idle process exit normally.
///
/// Scan only after `armed`, and rescan on `changed`. Events may coalesce, but
/// are not rate-limited: watch the narrowest useful path to avoid rescanning
/// for unrelated writes (for example, watch a mailbox, not all session data).
/// Do not use endpoint connect retries to wait for file publication.
pub fn on_notify(mut self, f: impl FnMut(&str, Value) + 'static) -> Self {
self.notify = Some(Box::new(f));
self