Create a [`FileWatcher`] using the best available backend. The factory reports the selected tier explicitly (review R4): a detected Watchman daemon is named, and the fact that the Watchman turn-watcher adapter is **unshipped** (Phase 16.2–16.3 in ATOMIC-AGENT-TASKS.md) is stated as the reason the snapshot fallback runs — it is never silently attributed to missing test infrastructure. # Arguments
(
config: WatcherConfig,
)
| 339 | /// A boxed `FileWatcher` implementation together with the tier that was |
| 340 | /// selected, so callers can log/observe the honest tier. |
| 341 | pub async fn create_watcher_with_tier( |
| 342 | config: WatcherConfig, |
| 343 | ) -> AgentResult<(Box<dyn FileWatcher>, WatcherTier)> { |
| 344 | if watchman_available() { |
| 345 | // The Watchman adapter is unshipped in this release. The fallback |
| 346 | // is a deliberate, explicitly-reported substitute — not an |
| 347 | // implementation hidden behind a missing daemon. |
| 348 | log::warn!( |
| 349 | "watcher tier: watchman daemon detected, but the Watchman turn-watcher adapter \ |
| 350 | is unshipped (Phase 16.2-16.3); using the snapshot fallback watcher — \ |
| 351 | state enter/leave and since-queries are NOT implemented" |
| 352 | ); |
| 353 | return Ok(( |
| 354 | Box::new(fallback::FallbackWatcher::new(config)), |
| 355 | // CB-13D ::24 R4 tier truth: the constructed adapter IS the |
| 356 | // snapshot fallback — reporting `Watchman` here made consumers |
| 357 | // believe state-enter/leave bracketing existed when it does |
| 358 | // not. The detection fact stays in the diagnostic above; the |
| 359 | // tier reports what actually runs. |
| 360 | WatcherTier::Fallback, |
| 361 | )); |
| 362 | } |
| 363 | log::info!( |
| 364 | "watcher tier: snapshot fallback (Watchman not reachable; \ |
| 365 | install/enable Watchman when the adapter ships)" |
| 366 | ); |
| 367 | Ok(( |
| 368 | Box::new(fallback::FallbackWatcher::new(config)), |
| 369 | WatcherTier::Fallback, |
| 370 | )) |
| 371 | } |
| 372 | |
| 373 | /// Create a [`FileWatcher`] using the best available backend. |
| 374 | /// |