feat: Add debounce, retry, and last-good retention to file data loading - #220
Draft
kinyoklion wants to merge 1 commit into
Draft
kinyoklion wants to merge 1 commit into
kinyoklion wants to merge 1 commit into
Conversation
The file data source reloaded on every file system event with no debounce or retry, and any missing file failed the load. The flag overrides feature needs a file source that reloads reliably: coalesced change notifications, retry after a failed read, retention of the last good data, sequential reloads, and files that do not exist yet. This adds the shared file infrastructure in the integrations package: - FileDataReloader serializes reloads, debounces change signals, keeps the last good data on failure by not applying, retries a failed load after a bounded delay, reports an identical repeated failure once, and skips a reload whose raw content did not change. Close never waits for an in-flight read. - FileDataPoller detects changes by examining each file's modification time and size on a fixed interval, including a file that appears or disappears. - FileDataWatcher is the WatchService watcher extracted from FileSynchronizer, with one extra signal after start so a change between the initial load and the start of watching is not missed. - DataLoader gains options to skip a file path that does not exist and to keep the versions that a document specifies, a per-source summary of what each file supplied, and a content digest for the skip-unchanged check. FileSynchronizer now reloads through the reloader. The file data source keeps its behavior for existing users: every configured file must exist, entries get a load version, and a value-only entry is an on flag with a single fallthrough variation. FileDataException.getDescription no longer fails when the exception has no cause.
This branch has not been deployed
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.
Summary
The flag overrides feature defined by the OVERRIDE specification needs a file-based override source that reloads reliably: coalesced change notifications, retry after a failed read, retention of the last good data, sequential reloads, and support for files that do not exist yet. The existing file data source reloaded on every file system event with no debounce or retry, and any missing file failed the whole load.
This change adds the shared file infrastructure that both the file data source and the upcoming override source use, in the integrations package:
FileDataReloaderserializes reloads, debounces change signals with a 100 ms settle window, keeps the last good data on failure by not applying, retries a failed load after one second, reports an identical repeated failure once, and skips a reload whose raw content did not change. Close never waits for an in-flight read.FileDataPollerdetects changes by examining each file's modification time and size on a fixed interval, including a file that appears or disappears.FileDataWatcheris the WatchService-based watcher extracted fromFileSynchronizer, with one extra signal after start so a change made between the initial load and the start of watching is not missed.DataLoadergains options to skip a file path that does not exist and to keep the versions that a document specifies, a per-source summary of what each file supplied, and a content digest for the skip-unchanged check. A document that parses but holds flag data the model cannot accept is now reported as a file data error instead of escaping as a runtime exception.FileSynchronizernow reloads through the reloader. The file data source keeps its behavior for existing users: every configured file must exist, entries get a load version, and a value-only entry is an on flag with a single fallthrough variation.FileDataException.getDescriptionno longer fails when the exception has no cause.