Skip to content

feat: add file-based override source (ldoverrides)#415

Draft
kinyoklion wants to merge 4 commits into
rlamb/overrides-basefrom
rlamb/sdk-2656/ldoverrides-file-source
Draft

feat: add file-based override source (ldoverrides)#415
kinyoklion wants to merge 4 commits into
rlamb/overrides-basefrom
rlamb/sdk-2656/ldoverrides-file-source

Conversation

@kinyoklion

Copy link
Copy Markdown
Member

Reopens #412, which GitHub auto-marked as merged when its branch was merged into the old integration branch it was based on. The branch is rebuilt as clean cherry-picks onto rlamb/overrides-base, the junction of the two prerequisite stacks (file machinery #405#407, override system #404/#408#411); the diff is identical in content to #412 plus its follow-up lifecycle comment. Review discussion lives on #412.

Adds the public ldoverrides package with FileSource(), the file-based override source defined by the OVERRIDE spec, completing the user-facing feature:

config := ld.Config{
    DataSystem: ldcomponents.DataSystem().Default().
        Overrides(ldoverrides.FileSource().FilePaths("/etc/ld/overrides.json")),
}
  • Same document format as the file data sources (flags, flagValues, segments; JSON and YAML), with flagValues entries expanded into full flag definitions. Multiple files merge in configured order under the configured duplicate-key handling.
  • Built on the shared internal/filedata machinery: every reload is serialized, debounced, all-or-nothing with last-good retention, retried after failures, and skipped when contents are unchanged. Missing files at startup just mean no overrides until they appear.
  • Watching by default (ldfilewatch/fsnotify), with an optional stat-based Poll mode for filesystems where notifications are unreliable; both may run together. Poll interval defaults to one second, clamped to a one-second minimum.

Package tests cover initial load, YAML, multi-file ordering and duplicates, missing-file startup and recovery, watch and poll reload modes, malformed-edit retention and recovery, interval clamping, and close semantics; a client-level test drives hot add/change/remove end-to-end on a running uninitialized client.

SDK-2656

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