Repository navigation
feat: Add the file-based override source - #453
Draft
kinyoklion wants to merge 8 commits into
Draft
kinyoklion wants to merge 8 commits into
kinyoklion wants to merge 8 commits into
Conversation
kinyoklion
force-pushed
the
rlamb/overrides-ruby-events
branch
from
September 25, 2026 22:51
89f544e to
be39b66
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-file-source
branch
from
September 25, 2026 22:51
52a065f to
605d0ab
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-events
branch
from
September 28, 2026 20:36
be39b66 to
6ff51f4
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-file-source
branch
from
September 28, 2026 20:36
605d0ab to
5bda436
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-events
branch
from
October 1, 2026 23:43
6ff51f4 to
e0dd518
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-file-source
branch
from
October 1, 2026 23:43
5bda436 to
4287523
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-events
branch
from
October 3, 2026 00:46
e0dd518 to
356fee9
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-file-source
branch
from
October 3, 2026 00:46
4287523 to
703e368
Compare
Member
Author
|
bugbot review |
kinyoklion
force-pushed
the
rlamb/overrides-ruby-events
branch
from
October 3, 2026 01:54
356fee9 to
de05ef4
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-file-source
branch
from
October 3, 2026 01:54
703e368 to
18d4335
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-events
branch
from
October 8, 2026 16:54
de05ef4 to
aae4984
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-file-source
branch
from
October 8, 2026 16:55
18d4335 to
d4f7481
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-events
branch
from
October 13, 2026 22:12
aae4984 to
db462f2
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-file-source
branch
from
October 13, 2026 22:12
d4f7481 to
ddada85
Compare
Member
Author
|
bugbot review |
kinyoklion
force-pushed
the
rlamb/overrides-ruby-events
branch
from
October 16, 2026 21:40
db462f2 to
21046ad
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-file-source
branch
from
October 16, 2026 21:40
d0a8633 to
e0adc16
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-events
branch
from
October 28, 2026 22:18
21046ad to
d5133ec
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-file-source
branch
from
October 28, 2026 22:18
e0adc16 to
15125ab
Compare
Member
Author
|
bugbot review |
kinyoklion
force-pushed
the
rlamb/overrides-ruby-events
branch
from
October 28, 2026 22:41
d5133ec to
0b2876b
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-file-source
branch
from
October 28, 2026 22:41
15125ab to
647d385
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-events
branch
from
October 28, 2026 22:53
0b2876b to
d02bf8a
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-file-source
branch
from
October 28, 2026 22:53
647d385 to
357c6ae
Compare
Member
Author
|
bugbot review |
Member
Author
|
bugbot review |
kinyoklion
force-pushed
the
rlamb/overrides-ruby-events
branch
from
October 28, 2026 23:28
d02bf8a to
1cd5585
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-file-source
branch
from
October 28, 2026 23:28
68137e0 to
d5a0b9c
Compare
Member
Author
|
bugbot review |
kinyoklion
force-pushed
the
rlamb/overrides-ruby-events
branch
from
October 29, 2026 16:49
1cd5585 to
e58b756
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-file-source
branch
from
October 29, 2026 16:49
d5a0b9c to
79e08c0
Compare
Adds `LaunchDarkly::Integrations::FileData.override_source`, the file-based override source that the OVERRIDE specification defines, for use with `LaunchDarkly::DataSystem::ConfigBuilder#overrides`. The source reads one or more JSON or YAML files in the file data source document format (`flags`, `flagValues`, `segments`) and supplies complete snapshots to the SDK's override store. Options: `paths` (required, in precedence order), `duplicate_keys_handling` (`:fail`, the default, or `:ignore`, which keeps the first file's entry), `change_detection` (`:polling`, the default, or `:watching` through the optional listen gem), and `poll_interval` (default 1 second, raised to the 1 second minimum with a warning). Invalid options, including an unknown option key, raise `ArgumentError` when the client is created. Behavior comes from the shared file data code: a configured file that does not exist contributes no overrides, so a file can be created later and deleting a file removes its overrides. A file that exists but cannot be read or parsed fails that reload and keeps the last good overrides, with a logged failure and a retry. A rewrite with identical content is not reapplied. The initial load completes before the client constructor returns. A `flagValues` entry expands into a flag that is off and serves the value, so the evaluation reports the OFF reason kind. Every applied change is logged at Info with the overrides in effect and what each file supplied. The reloader's log lines for this source carry a FileOverrideSource prefix. Flag overrides are currently experimental and subject to change.
…ntries as duplicate keys A path listed more than once would make every entry of that file a duplicate of itself: under the default fail handling the load failed, and under ignore the first listing won by accident. The builder now drops the repeats, keeps the first occurrence in its place in the order, and logs a warning once at build time. This is the behavior the Node SDK has.
… SDKs A flagValues entry becomes a flag without client-side availability, so all_flags_state with client_side_only leaves it out even when the flag it overrides is client-side. A full definition with clientSide is the way to override such a flag. A spec pins both.
The override source chooses each file's format by its name: a name that
ends in .yaml or .yml, in any case, is YAML, and any other file is JSON.
Files must be UTF-8. An override file can be rewritten in place: while the
source finds a file empty during a rewrite, it keeps the overrides in
effect until the new content is written. An empty JSON file is not a valid
document; to remove a file's overrides, delete it or write `{}`.
The override source tests rewrite their files in place, and end-to-end
tests check that the source never supplies a snapshot without the
override, and that a client never serves the LaunchDarkly value, while a
JSON or YAML file is rewritten in place with polling and watching change
detection; also for a YAML file that starts with a comment, for rewrites
about once a second with the default timing, and for files that are not
UTF-8.
kinyoklion
force-pushed
the
rlamb/overrides-ruby-events
branch
from
November 3, 2026 23:58
e58b756 to
11d2d5c
Compare
kinyoklion
force-pushed
the
rlamb/overrides-ruby-file-source
branch
from
November 3, 2026 23:58
79e08c0 to
704e7bd
Compare
Member
Author
|
bugbot review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 704e7bd. Configure here.
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
This PR is stacked on #452 because it supplies the override store that the earlier PRs add, and its client-level spec relies on the marked reasons and events they produce.
This change adds
LaunchDarkly::Integrations::FileData.override_source, the file-based override source that the OVERRIDE specification defines. It is configured withLaunchDarkly::DataSystem::ConfigBuilder#overrides:The source reads one or more JSON or YAML files in the file data source document format (
flags,flagValues,segments) and supplies complete snapshots to the SDK's override store. Its options arepaths(required, non-empty strings in precedence order; a path listed more than once is logged and the repeats are ignored; on Windows, where file names ignore case, paths that differ only in case count as the same path),duplicate_keys_handling(:fail, the default, or:ignore, which keeps the first file's entry),change_detection(:polling, the default, or:watchingthrough the optionallistengem), andpoll_interval(default 1 second, raised to the 1 second minimum with a warning). Invalid options raiseArgumentErrorwhen the client is created, the same way other invalid component configuration is reported. Unlike the Go reference, an unrecognizedduplicate_keys_handlingvalue and an unknown option key are rejected rather than defaulted, because the specification treats invalid configuration as a construction error and an emergency mechanism should fail loudly.Behavior comes from the shared file data code added in #449:
.yamlor.yml, in any case, is YAML, and any other file, including one with no extension, is JSON. The existing file data sources read every file with the YAML parser, which also reads most JSON; the override source does not, so a YAML document in a.jsonfile, or JSON with a#comment or a trailing comma, does not load. Files must be UTF-8; a UTF-16 file, as Windows PowerShell 5.1 writes with>, fails to load with a clear message and keeps the overrides in effect.{}.---), it holds the file back and keeps the overrides in effect until the new content is written: until the file has stayed so, unwritten, for one retry delay (1 second), and for at most five retry delays while it keeps being rewritten. Changes to the other files wait with it, since a reload applies all files or none. The mechanism is described in feat: Add file loading code for flag overrides #449; the public docs say only what an application needs.A
flagValuesentry expands into a flag that is on and serves the value by fallthrough, so the evaluation reports the FALLTHROUGH reason kind. Every applied change is logged at Info with the overrides in effect and what each file supplied, and the reloader's log lines for this source, including the hold's debug lines, carry aFileOverrideSourceprefix.The
override_sourcedocs say how the format is chosen, that files must be UTF-8, that comments and repeated keys in JSON depend on the application'sjsongem, that files can be rewritten in place, how to remove a file's overrides, that an empty JSON file is not a valid document, and that replacing a YAML file in one operation avoids briefly applying a partly written file.Testing
listenrequirement, poll interval clamping), the initial load (merge, fallthrough-form expansion, YAML, missing file, all files missing, malformed file, duplicate keys under both handlings), the Info log format, polling change detection (change, appearance, deletion, malformed edit with recovery, identical rewrite, stop, stop before start), watching change detection (change, appearance, deletion), and a client-level check of serving and reloading overrides throughLDClient.flag overridessuite of sdk-test-harness (3.2.0-alpha.13, built from #515, whose override files are rewritten in place and have no extension) passes against the test service of feat: Add flag overrides to the contract test service #454: 79 tests ran, all passed.can be automatically loaded by Bundler.require, which needs write access to the system gem directory on the test machine. Each new spec was checked against a deliberate defect in the code it covers.The existing FDv1 and FDv2 file data sources keep their current behavior. This series does not change them; the override feature is additive.
SDK-3249
Opened from termag
Note
Overview
Adds
LaunchDarkly::Integrations::FileData.override_source, an experimental file-based override source wired throughDataSystem::ConfigBuilder#overrides. Operators can force per-key flag and segment overrides from JSON/YAML files while the client still uses LaunchDarkly for everything else.The new
FileOverrideSourcereuses the sharedFileData::Reloader(polling orlistenwatching), treats missing paths as empty, skips unchanged byte-identical reloads, and pushes full snapshots to the override sink with Info logs listing what each file contributed.FileOverrideSourceBuildervalidates paths and options at client construction (ArgumentErroron bad config).FileData::Reloadergains a configurablelog_prefix(default[LDClient]) on all its log lines and logs unexpected errors directly instead ofUtil.log_exception, so override reload logs are prefixed[LDClient] FileOverrideSource:.Docs on
FileDatadescribe the override source and how it differs from the all-local file data source. Large new integration specs cover builder validation, reload behavior, in-place rewrites, encoding edge cases, andLDClientevaluation with overrides.Reviewed by Cursor Bugbot for commit 704e7bd. Bugbot is set up for automated code reviews on this repo. Configure here.