Skip to content

Epic: FileWatch trigger — filesystem event-driven workflows #804

Description

@geoffjay

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

  • FileWatchStrategy implements TriggerStrategy trait
  • Native filesystem events via notify crate
  • Mtime polling fallback with configurable interval
  • Glob pattern matching for watched paths
  • Debounce support to avoid duplicate triggers
  • FileWatch variant added to TriggerConfig
  • Template variables for file change context
  • API and CLI support for creating file-watch workflows
  • Unit and integration tests
  • Documentation

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions