Repository navigation
feat: Add the file-based override source - #453
Draft
kinyoklion wants to merge 4 commits into
Draft
kinyoklion wants to merge 4 commits into
kinyoklion wants to merge 4 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 |
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 703e368. Configure here.
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
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.
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
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),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: 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
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 carry aFileOverrideSourceprefix.Verification: specs for the builder (defaults, absolute paths, every invalid option,
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. Full suite and RuboCop are clean. 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
Note
Overview
Adds
LaunchDarkly::Integrations::FileData.override_source, an experimental file-based override source wired throughDataSystem::ConfigBuilder#overrides. Operators can point at JSON/YAML files (same format as the file data source) so per-key flag and segment definitions override LaunchDarkly at evaluation time while the client stays connected.The implementation (
FileOverrideSource) loads and merges files via the sharedFileData::Reloader, with missing paths ignored, unchanged content skipped, polling orlisten-based watching, and strict option validation atLDClientconstruction. Each successful apply pushes a full snapshot to the override sink and logs what is in effect per file.FileData::Reloadergains a configurablelog_prefix(used by the override source) and inlines unexpected-error logging instead ofUtil.log_exception. Existing FDv1/FDv2 file data sources are unchanged.Specs cover the builder, load/reload behavior, logging, change detection, and client-level override evaluation.
Reviewed by Cursor Bugbot for commit 703e368. Bugbot is set up for automated code reviews on this repo. Configure here.