Skip to content

fix: Signal a link that resolves into a watched directory, and say which deployments watching does not follow - #484

Merged
kinyoklion merged 2 commits into
feat/overridesfrom
rlamb/overrides-ruby-watcher-links
Nov 12, 2026
Merged

kinyoklion merged 2 commits into
feat/overridesfrom
rlamb/overrides-ruby-watcher-links

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Summary

Follow-up to #449 for two findings raised on the Python port of the same watcher (launchdarkly/python-server-sdk#525), both of which apply here.

  • A configured link that cannot be resolved keeps the once-per-second retry running. When a retry resolved such a link to a target in a directory that was already watched, for example because another configured file is in it, it added no watch and so ran no callback. Content that appeared while the link could not be resolved was then not read until some later change. refresh_links now reports a change whenever a link leads to a target it did not lead to before, so the retry runs the callback once.
  • The watcher comment said that a link that comes to point elsewhere is followed. That holds when the old target's directory is deleted, as a ConfigMap update does, but not for a link further along the chain that is pointed elsewhere while its old target stays, a configured directory that is itself a link and is pointed elsewhere, or a configured directory that is renamed and replaced. The comment now names those cases and points such deployments, like a current link to a release directory, to polling, which is the default. The override source's change_detection documentation says the same in feat: Add the file-based override source #453.

Tests

A new watcher spec configures a link that leads through a directory that does not exist yet to a directory that another configured file keeps watched, then creates the missing directory as a link. It fails without the change and passes with it. The watcher specs pass (24 examples), the full suite passes apart from spec/launchdarkly-server-sdk_spec.rb:5, which fails the same way on feat/overrides on this box because Bundler cannot write its lock file, and RuboCop reports no offenses.

SDK-3249

Opened from termag


Note

Overview
Fixes file data watcher behavior when a configured symlink finally resolves to a file in a directory that was already being watched (e.g. another configured path). refresh_links now treats newly discovered link targets in existing watches as a change, so the retry loop invokes on_change once instead of silently skipping until some unrelated filesystem event.

Watcher docs are tightened to list symlink/deployment patterns inotify does not track (mid-chain repointing, directory-as-symlink swaps, rename-and-replace layouts) and to steer current → release style setups toward polling.

Specs cover resolution into an already-watched directory and assert the callback is not fired on every failed watch retry.

Reviewed by Cursor Bugbot for commit d232195. Bugbot is set up for automated code reviews on this repo. Configure here.

@kinyoklion

Copy link
Copy Markdown
Member Author

bugbot review

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

…ich deployments watching does not follow

A retry that resolved a configured link to a target in a directory that was already watched added no watch and so ran no callback, and the content that appeared meanwhile was not read until a later change. The retry now runs the callback whenever a link leads to a new target. The watcher comment now names the changes that watching does not follow, a link further along the chain or a configured directory that is pointed elsewhere or replaced, and points such deployments to polling.
A link whose target directory could not be watched counted as a new target on every retry, so the callback ran once a second while the watch kept failing. A target counts as new only in a directory that is already watched, and a new directory counts once its watch is added.
@kinyoklion
kinyoklion force-pushed the rlamb/overrides-ruby-watcher-links branch from 294127d to d232195 Compare November 10, 2026 21:32
@kinyoklion

Copy link
Copy Markdown
Member Author

bugbot review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 d232195. Configure here.

@kinyoklion
kinyoklion marked this pull request as ready for review November 10, 2026 23:36
@kinyoklion
kinyoklion requested a review from a team as a code owner November 10, 2026 23:36
@kinyoklion
kinyoklion merged commit 156611b into feat/overrides Nov 12, 2026
10 checks passed
@kinyoklion
kinyoklion deleted the rlamb/overrides-ruby-watcher-links branch November 12, 2026 17:02
kinyoklion added a commit that referenced this pull request Nov 12, 2026
<!-- TERMAG_PR_BODY_BEGIN -->
BEGIN_COMMIT_OVERRIDE
feat: Add experimental support for flag overrides, read from local JSON
or YAML files or supplied by a custom override source
feat: Mark evaluations that a flag override affected with
`override_affected` in the evaluation reason, and count them under
separate summary counters
END_COMMIT_OVERRIDE

Every change in this PR was already reviewed and merged through its own
PR against `feat/overrides`: #449, #450, #451, #452, #453, #454, #484,
#493. This PR merges the branch into `main` and adds nothing of its own.

Flag overrides let an operator force flags and segments to known
definitions on a running client, whether or not the client can reach
LaunchDarkly, and remove the override when the incident is over. They
are an option of the FDv2 data system
(`LaunchDarkly::DataSystem::ConfigBuilder#overrides`), with a file-based
source in `LaunchDarkly::Integrations::FileData.override_source`, and
are experimental.

`main` has one commit that `feat/overrides` does not (#490), and the two
merge without conflicts. CI on `feat/overrides` @ 156611b is green on
every job, Windows included.
<!-- TERMAG_PR_BODY_END -->

<!-- termag: box=i-0575d1c54853058d7 project=ruby-server-sdk -->
<sub>Opened from termag</sub>

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> Adds **experimental flag overrides** so operators can force known
flag/segment definitions at evaluation time without replacing
LaunchDarkly streaming or polling.
> 
> **Configuration & data path.** FDv2 gains an optional override source
via `DataSystemConfig` / `ConfigBuilder#overrides`. When set, the client
builds an override layer, overlays it on the feature store for reads,
and wires the layer’s dependency graph into the main store so
prerequisite/segment changes still fan out to affected flags. Contract
tests advertise `flag-overrides` and can wire file paths through
`LaunchDarkly::Integrations::FileData.override_source`.
> 
> **File-based source.** New `FileData` plumbing (parse/merge, poller,
reloader with in-place rewrite handling, optional `listen`-based
watcher) backs `FileData.override_source` with polling or watching,
duplicate-key policy, and resilient reload/retry. The `listen` gem is
added for contract tests’ watching mode.
> 
> **Evaluation & analytics.** Flag/segment models carry an internal
override marker. The evaluator propagates **override-affected** marking
through prerequisites and segment matches; `EvaluationReason` exposes
`overrideAffected` in JSON when true. Override-affected evaluations are
excluded from individual and debug events but get **separate summary
counters** keyed by the marker.
> 
> **Client behavior.** Before initialization (or when the store is
unavailable), evaluations and `all_flags_state` can serve override
entries only, with one-time warnings. Docs/examples shift to
`data_system_config: ... .build` instead of passing raw builders.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
156611b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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.

2 participants