Skip to content

Add watch paths so integrations refresh on file changes - #18

Merged
shayan-ys merged 1 commit into
mainfrom
feat/integration-watch
Oct 9, 2026
Merged

shayan-ys merged 1 commit into
mainfrom
feat/integration-watch

Conversation

@shayan-ys

Copy link
Copy Markdown
Owner

📝 Summary

This PR adds a per-integration watch option. devdash re-runs a watched integration soon after anything under its watched files or directories changes, so a section such as prompt-tutor's updates within about half a second instead of on the next interval. A watched integration without its own interval stops polling on the global interval.


🛠️ Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • ⚡ Performance / Refactor (code optimization without behavior changes)
  • 📚 Documentation update

🔍 Changes Made

  • watch = ["~/.local/share/prompt-tutor", "~/.config/prompt-tutor"]: a list of paths, validated strictly, with ~ and environment variables expanded. Directories are watched recursively, and a missing path is watched until it is created.
  • Detection uses only the standard library: each pass takes a stat snapshot of every watched path. The configured roots follow symlinks; symlinks inside them are not followed, so a link cannot cause a loop. Each pass waits at least 0.25 s, or four times the previous pass's cost, so a large tree cannot keep a core busy.
  • Debounce: run once writes are quiet for 0.2 s, or 2 s after the first change in a write burst that never pauses. Runs go through the existing per-integration queue, so a change during a run queues one follow-up.
  • Scheduling: with watch and no interval, the integration runs at start, on changes, on its keys, and on r. An explicit interval still applies alongside watching.
  • Heading: fetched 3s ago · watching for a watched integration without an interval. --once does not watch.
  • Docs: the README integration section and the prompt-tutor example, config.example.toml, and the CHANGELOG.

🧪 How to Test

  1. git checkout feat/integration-watch && uv sync
  2. uv run pytest -q && uv run ruff check .
  3. Add watch = ["/some/dir"] to an integration that lists that directory, then run devdash. Create a file in the directory: the section shows it within about half a second, and its heading says watching.

✅ Review and verification

  • Review path: material, agent code review; omitted optional reviews: none. CodeRabbit is not active on this repository.
  • Review fixes:
    • watch combined with an explicit interval turned watching off.
    • A symlinked watch root never saw changes.
    • Each pass now waits longer when the previous one was slow.
    • A 2 s cap stops a write burst that never pauses from blocking the refresh. The cap is checked on every pass, so it still applies while writes continue.
    • The watched-run test now allows up to 5 s per run.
  • Verification:
    • uv run pytest -q: 115 passed; uv run ruff check .: clean.
    • The new test for writes that never pause fails on the earlier elif version and passes now.
    • Terminal smoke with a temporary directory and a stub gh: create and delete events reached the screen in about 0.5 s, the heading said watching, and q exited.
    • The real devdash with the real prompt-tutor re-ran within 0.43 s after its config file was touched.
  • Declined findings: none.
  • Remaining non-blocking findings: none.

@shayan-ys
shayan-ys marked this pull request as ready for review October 9, 2026 17:33
@shayan-ys
shayan-ys merged commit fedda8f into main Oct 9, 2026
6 checks passed
@shayan-ys
shayan-ys deleted the feat/integration-watch branch October 9, 2026 17:33
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.

1 participant