Skip to content

Conversation

@keelerm84
Copy link
Member

@keelerm84 keelerm84 commented Nov 13, 2025

Note

Add FDv2 file-based data source implementing Initializer/Synchronizer with auto-update and expose via Files.new_data_source_v2, plus comprehensive tests.

  • Files integration (FDv2):
    • Add ldclient/impl/integrations/files/file_data_sourcev2.py implementing _FileDataSourceV2 as both an Initializer (fetch) and Synchronizer (sync) using local files.
    • Builds TRANSFER_FULL ChangeSet with Selector.no_selector() from flags, flagValues, and segments (JSON/YAML), ensuring versions and duplicate-key checks.
    • Supports auto-update via watchdog-based _WatchdogAutoUpdaterV2 or polling _PollingAutoUpdaterV2 with RepeatingTask; emits Update with VALID or INTERRUPTED states; stop() to clean up.
  • API:
    • Expose Files.new_data_source_v2(paths, poll_interval, force_polling) returning a builder for FDv2 data system usage; update imports and typing.
  • Tests:
    • Add ldclient/testing/integrations/test_file_data_sourcev2.py covering initializer and synchronizer (initial load, YAML, multiple files, duplicates, invalid data, file change detection, stop behavior, single-path handling).

Written by Cursor Bugbot for commit 5d483f6. This will update automatically on new commits. Configure here.

@keelerm84 keelerm84 requested a review from a team as a code owner November 13, 2025 15:10
new_times = self._check_file_times()
changed = False
for file_path, file_time in self._file_times.items():
if new_times.get(file_path) is not None and new_times.get(file_path) != file_time:
Copy link

Choose a reason for hiding this comment

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

Bug: Polling Misses Inaccessible File Changes

The polling mechanism doesn't detect when a previously accessible file becomes inaccessible. The condition new_times.get(file_path) is not None prevents detecting changes when a file's modification time changes from a valid timestamp to None. This means if a file is deleted or becomes unreadable, the synchronizer won't reload and report an error until the file becomes accessible again or another file changes.

Fix in Cursor Fix in Web

Copy link
Member

Choose a reason for hiding this comment

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

I assume this is how the existing implementation works, but dependence on file modification timestamp precision isn't amazing.

try:
ret[path] = os.path.getmtime(path)
except Exception:
ret[path] = None
Copy link
Member

Choose a reason for hiding this comment

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

Do we need any log for this situation?

Base automatically changed from mk/sdk-1567/x-ld-envid to feat/fdv2 November 18, 2025 16:18
@keelerm84 keelerm84 force-pushed the mk/sdk-1553/file-ds-fdv2 branch from 54cbdff to c0570e2 Compare November 18, 2025 16:24
@keelerm84 keelerm84 merged commit 26fdfca into feat/fdv2 Nov 18, 2025
42 of 45 checks passed
@keelerm84 keelerm84 deleted the mk/sdk-1553/file-ds-fdv2 branch November 18, 2025 18:06
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.

3 participants