Skip to content

Commit 8cc2141

Browse files
committed
Add watch flake smoke test scaffolding
1 parent e1cd1f3 commit 8cc2141

13 files changed

Lines changed: 549 additions & 16 deletions

AGENTS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ without hard-coding knowledge of any one repository.
1818
avoid baking it into the core.
1919
- Do not push unless explicitly asked. This repository may not even have a
2020
remote during early development.
21+
- Do not use `sleep` to resolve races. Races must be resolved with
22+
deterministic logic, explicit readiness signals, or ordered state
23+
transitions.
2124
- Run quality gates for code changes: `cargo fmt`, `cargo test`,
2225
`cargo clippy --all-targets --all-features -- -D warnings`.
2326

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ All notable changes to `devloop` will be recorded in this file.
44

55
## [Unreleased]
66

7+
### Added
8+
- Added a configurable watcher backend with non-breaking `native`
9+
default behavior plus a `poll` fallback mode for environments where
10+
native filesystem notifications are unreliable.
11+
- Added a Rust repeated-edit watch flake smoke test that runs under
12+
`cargo test` and therefore in GitHub Actions alongside the existing
13+
runtime smoke test.
14+
15+
### Changed
16+
- `devloop` now derives concrete watch targets from configured watch
17+
patterns and asks the backend to watch only those files or
18+
directories instead of always watching the whole repository root.
19+
720
## [0.7.0] - 2026-03-27
821

922
### Added

Cargo.lock

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ toml = "0.8.22"
2121
tracing = "0.1.41"
2222
tracing-subscriber = { version = "0.3.19", features = ["env-filter", "fmt"] }
2323
unicode-width = "0.2"
24+
25+
[dev-dependencies]
26+
tempfile = "3.20.0"

docs/behavior.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,17 @@ merged back into the live session.
4949

5050
## Watching and debounce
5151

52-
`devloop` watches the configured `root` recursively.
52+
`devloop` derives concrete filesystem watch targets from the configured
53+
watch-group patterns and watches only those files or directories.
5354

5455
- Only relevant file-system events are considered.
5556
- Events are batched for `debounce_ms`.
5657
- Matching changes are grouped by workflow name before execution.
5758
- Each workflow receives the set of changed relative paths that matched
5859
it during the debounce window.
60+
- The default backend uses native filesystem notifications. A polling
61+
backend can be selected in config as a fallback for environments
62+
where native events are unreliable.
5963

6064
If multiple watch groups map to the same workflow, their matched paths
6165
are merged for that workflow run.

docs/configuration.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ startup_workflows = ["startup"]
2626
- `startup_workflows`: workflows to run after autostart processes have
2727
been started.
2828

29+
Optional watcher backend config:
30+
31+
```toml
32+
[watcher]
33+
kind = "native"
34+
poll_interval_ms = 250
35+
```
36+
37+
- `watcher.kind`: watcher backend to use. `native` is the default and
38+
uses the platform-recommended `notify` backend. `poll` uses
39+
`notify`'s polling watcher as a fallback for environments where
40+
native filesystem events are unreliable.
41+
- `watcher.poll_interval_ms`: polling interval used when
42+
`watcher.kind = "poll"`. Default: `250`.
43+
2944
Optional browser reload server config:
3045

3146
```toml
@@ -51,6 +66,10 @@ workflow = "rust"
5166
- `workflow`: workflow to run when a matching file changes. If omitted,
5267
the watch-group name is used as the workflow name.
5368

69+
`devloop` derives concrete watch targets from these patterns and asks
70+
the backend to watch only those literal files or directories instead of
71+
always watching the whole repository root recursively.
72+
5473
## Processes
5574

5675
Processes are long-running commands supervised by `devloop`.

examples/blog/devloop.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ debounce_ms = 300
66
state_file = "./.devloop/state.json"
77
startup_workflows = ["startup"]
88

9+
[watcher]
10+
kind = "native"
11+
912
[watch.rust]
1013
paths = ["src/**/*.rs", "Cargo.toml", "content/layout.html", "content/banner.html", "content/site.toml"]
1114
workflow = "rust"

src/browser_reload.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ mod tests {
135135
Config {
136136
root: ".".into(),
137137
debounce_ms: 100,
138+
watcher: crate::config::WatcherConfig::default(),
138139
state_file: Some("./state.json".into()),
139140
startup_workflows: vec![],
140141
watch: BTreeMap::new(),

0 commit comments

Comments
 (0)