Skip to content

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

Merged
kinyoklion merged 1 commit into
rlamb/overridesfrom
rlamb/sdk-2656/ldoverrides-file-source
Jul 7, 2026
Merged

feat: add file-based override source (ldoverrides)#412
kinyoklion merged 1 commit into
rlamb/overridesfrom
rlamb/sdk-2656/ldoverrides-file-source

Conversation

@kinyoklion

Copy link
Copy Markdown
Member

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, so every reload is serialized, debounced, all-or-nothing with last-good retention, retried after failures, and skipped when file contents are unchanged. A malformed or mid-write edit can never empty the override layer or stall the source; missing files at startup just mean no overrides until they appear.
  • Change detection is watching by default (ldfilewatch/fsnotify, which already handles rename-replace editors by watching the parent directory), with an optional stat-based Poll mode for filesystems where notifications are unreliable — network mounts, some containers, Kubernetes ConfigMap symlink swaps. Both may run together; the poll interval defaults to one second and is clamped to a one-second minimum.
  • The package is named for the feature rather than the mechanism so anticipated future sources (HTTP, object storage) have a home.

Package tests cover initial load, YAML, multi-file ordering and duplicate handling, 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 the whole loop end-to-end: an uninitialized client picks up an operator's file edits — add, change, remove — with evaluations, the isOverride reason, and the restored short-circuit following along, no restart involved.

This PR targets the rlamb/overrides integration branch because it is the junction of the two in-flight stacks: the internal/filedata reload machinery (#405#407) and the override system (#404, #408#411).

SDK-2656

@kinyoklion kinyoklion merged commit d026e0c into rlamb/overrides Jul 7, 2026
3 of 4 checks passed
@kinyoklion kinyoklion deleted the rlamb/sdk-2656/ldoverrides-file-source branch July 7, 2026 22:17
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