Summary
Implement a FileWatch trigger strategy that fires when files or directories matching configurable glob patterns change. Uses the notify crate for native OS filesystem events (inotify/FSEvents/kqueue) with an mtime polling fallback for environments where native watchers are unavailable.
Goals
- Evaluate and integrate the
notify crate for cross-platform filesystem watching
- Implement
FileWatchStrategy producing tasks on file change events
- Add mtime polling fallback mode for restricted environments
- Add
FileWatch variant to TriggerConfig with path patterns, event types, and debounce
- Support glob patterns for flexible path matching (e.g.,
src/**/*.rs, config/*.toml)
- Wire into the strategy factory, API validation, and CLI
Design Notes
- The
notify crate (v6+) provides RecommendedWatcher with native OS integration
- Debounce is essential — file saves often produce multiple events; use
notify-debouncer-full or manual debounce
- Glob matching via the
globset crate (already used by notify)
- Task
source_id should encode the changed file path for deduplication
- Template variables should include
{{file_path}}, {{event_type}}, {{file_name}}
- Polling fallback: periodically scan watched paths and compare mtime values
Acceptance Criteria
Blocked By
Stack Base
Stack on: feature/autonomous-pipeline — this epic's issues can be worked in parallel with other Phase 6 epics.
Key Files
crates/orchestrator/src/scheduler/strategy.rs — add FileWatchStrategy
crates/orchestrator/src/scheduler/types.rs — add FileWatch variant
crates/orchestrator/src/scheduler/runner.rs — wire into create_strategy()
crates/orchestrator/Cargo.toml — add notify, globset dependencies
Summary
Implement a FileWatch trigger strategy that fires when files or directories matching configurable glob patterns change. Uses the
notifycrate for native OS filesystem events (inotify/FSEvents/kqueue) with an mtime polling fallback for environments where native watchers are unavailable.Goals
notifycrate for cross-platform filesystem watchingFileWatchStrategyproducing tasks on file change eventsFileWatchvariant toTriggerConfigwith path patterns, event types, and debouncesrc/**/*.rs,config/*.toml)Design Notes
notifycrate (v6+) providesRecommendedWatcherwith native OS integrationnotify-debouncer-fullor manual debounceglobsetcrate (already used bynotify)source_idshould encode the changed file path for deduplication{{file_path}},{{event_type}},{{file_name}}Acceptance Criteria
FileWatchStrategyimplementsTriggerStrategytraitnotifycrateFileWatchvariant added toTriggerConfigBlocked By
Stack Base
Stack on:
feature/autonomous-pipeline— this epic's issues can be worked in parallel with other Phase 6 epics.Key Files
crates/orchestrator/src/scheduler/strategy.rs— add FileWatchStrategycrates/orchestrator/src/scheduler/types.rs— add FileWatch variantcrates/orchestrator/src/scheduler/runner.rs— wire into create_strategy()crates/orchestrator/Cargo.toml— add notify, globset dependencies