Skip to content

Phase 2b: Port file watching to Rust - #31

Merged
zackees merged 1 commit into
mainfrom
rust/phase-2b-file-watcher
Apr 12, 2026
Merged

zackees merged 1 commit into
mainfrom
rust/phase-2b-file-watcher

Conversation

@zackees

@zackees zackees commented Apr 12, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds crates/fastled-cli/src/watcher.rs — a Rust file watcher backed by the notify-7 crate, porting the core logic from src/fastled/filewatcher.py
  • Watches a directory recursively, filters ignored path segments (fastled_js, .build, __pycache__, .git, etc.), deduplicates events via SHA-256 content hashing, and debounces rapid bursts (default 300 ms window)
  • Adds watch_available() -> bool PyO3 stub in fastled-py so Python can probe native-watcher availability
  • No existing Python files were modified

Closes #19

Test plan

  • ./_cargo build --workspace — compiles clean
  • ./_cargo test --workspace — 7 new Rust tests pass (hash stability, ignored-path filtering, event detection, debounce coalescing)
  • ./_cargo clippy --workspace --all-targets -- -D warnings — no warnings
  • ./_cargo fmt --all --check — clean
  • bash lint — all checks pass (ruff, black, isort, pyright, clippy, fmt)
  • bash test — all 121 Python tests pass

Add crates/fastled-cli/src/watcher.rs implementing FileWatcher backed by
the notify-7 crate. Mirrors the Python filewatcher.py behaviour: recursive
directory watching, ignored-segment filtering (fastled_js, .build,
__pycache__, .git, etc.), SHA-256 hash-based change deduplication, and a
300 ms debounce window. Seven unit tests cover hash stability, ignored-path
filtering, event detection, and debounce coalescing. Wire in via `mod
watcher` in main.rs (not yet integrated into CLI flow). Add `watch_available`
PyO3 stub to fastled-py so Python can probe native-watcher support.
@zackees
zackees merged commit 3127500 into main Apr 12, 2026
1 of 9 checks passed
@zackees zackees mentioned this pull request Apr 12, 2026
7 tasks
@zackees
zackees deleted the rust/phase-2b-file-watcher branch November 5, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phase 2b: Port file watching to Rust

1 participant