Skip to content

fix(serve): ignore chmod events so rebuilds don't loop - #9

Merged
lucasnevespereira merged 1 commit into
mainfrom
fix/watch-ignore-chmod
Oct 6, 2026
Merged

lucasnevespereira merged 1 commit into
mainfrom
fix/watch-ignore-chmod

Conversation

@lucasnevespereira

Copy link
Copy Markdown
Member

Summary

On macOS inkssg serve rebuilt in a loop after the first change. The watcher reacted to attribute-only (Chmod) events, and each rebuild was followed by another one on the page it had just read.

 on(file event)
   if path is in the output dir or is a dotfile
     skip
+  if only attributes changed (Chmod)
+    skip
   debounce, then rebuild and reload

Evidence

Instrumented the watcher and ran serve on a one-page site (macOS, Go 1.24.6):

  • Before: one touch pages/index/content.md gave 3 rebuilds in 3 seconds, every one triggered by CHMOD .../pages/index/content.md. In normal use it does not stop:
✓ index → index.html
↻ rebuilt in 5ms
✓ index → index.html
↻ rebuilt in 6ms
...
  • After: a touch gives 0 rebuilds, and rewriting the file gives exactly 1 over the next 4 seconds.
  • go vet and go test pass. No automated test for the watcher.
  • Not checked on Linux.

Merge Danger

Door: two-way

Blast Radius: small

  • Only inkssg serve is affected, build does not use the watcher.
  • A change that touches nothing but permissions or timestamps no longer triggers a rebuild.

@lucasnevespereira
lucasnevespereira merged commit a5fb8ed into main Oct 6, 2026
2 checks passed
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