feat(internal): add stat-based file change poller#407
Draft
kinyoklion wants to merge 8 commits into
Draft
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a693af0. Configure here.
| // Poller detects changes to a set of files by examining them on a fixed interval, as an | ||
| // alternative or supplement to filesystem change notifications for environments where those | ||
| // are unavailable or unreliable. A change to any file's modification time or size — including | ||
| // the file appearing or disappearing — invokes the onChange callback. A file that cannot be |
There was a problem hiding this comment.
Unicode dashes in poller comments
Low Severity
The new Poller godoc uses Unicode em dashes (—) in two phrases. Project Go comment style expects ASCII -- instead of em dashes for readability across editors and terminals.
Additional Locations (1)
Triggered by learned rule: Go comments: use ASCII dashes and arrows, not Unicode
Reviewed by Cursor Bugbot for commit a693af0. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Adds a
Pollertointernal/filedatathat detects file changes by examining modification time and size on a fixed interval. It exists for environments where filesystem notifications are unavailable or unreliable (network mounts, some containers, Kubernetes ConfigMap symlink swaps): the file-based override source will offer it as a configurable alternative or supplement to watching, and it can later back a polling option on the file data sources if wanted.A file appearing, disappearing, or becoming unreadable all count as changes. Detection is deliberately generous — the callback feeds a
Reloader.Trigger, whose debouncing and skip-unchanged handling absorb spurious detections, so the poller itself stays trivial. The known blind spot (a same-size rewrite within the filesystem's timestamp granularity) is acceptable for the same reason: the retry path covers the failure half of that window, and tests sidestep it by explicitly bumping mtimes.Internal only; nothing consumes it yet.
SDK-2654
Note
Low Risk
New internal-only utility with no callers yet; behavior is isolated behind tests and designed to pair with existing Reloader debouncing.
Overview
Adds an
internal/filedataPollerthat watches a list of paths on a fixed interval viaos.Stat(existence, mod time, size) and callsonChangewhen any observed state changes, including create/delete/unreadable transitions. It is meant as a fallback or complement to fsnotify for unreliable mounts/containers, withReloader.Triggerexpected to debounce and skip no-op reloads.Lifecycle is
NewPoller(immediate baseline snapshot, goroutine + ticker) and idempotentClosethat waits for shutdown. Tests cover modification, file appearing/disappearing, multi-path watching, and that callbacks stop after close (tests force distinct mtimes to avoid timestamp granularity blind spots).Reviewed by Cursor Bugbot for commit a693af0. Bugbot is set up for automated code reviews on this repo. Configure here.