Skip to content

fix: Prevent the async FDv2 data system from writing to a persistent store after close - #589

Merged
keelerm84 merged 1 commit into
feat/10.xfrom
mk/SDK-3708/async-store-writes-after-close
Nov 19, 2026
Merged

keelerm84 merged 1 commit into
feat/10.xfrom
mk/SDK-3708/async-store-writes-after-close

Conversation

@keelerm84

@keelerm84 keelerm84 commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Summary

The async FDv2 data system's store wrapper ignored its closed flag for writes, so init, upsert and delete could still reach a persistent store after close(). The sync wrapper has refused writes after close since the FDv1 data system was removed (#573). This ports the same guard to the async wrapper.

  • Each write and close() hold one async lock. A write that starts after close does nothing: upsert and delete return False and init returns without writing.
  • close() waits for a write in progress before it closes the store.

No live path is known today, because stop_all cancels the data source tasks before the store closes. A task that outlives the 5s stop timeout could still write, and this closes that gap.


Note

Overview
The async FDv2 _AsyncFeatureStoreClientWrapper now matches the sync store wrapper’s close semantics: an AsyncLock serializes init, upsert, delete, and close().

init / upsert / delete run through a new _write helper that no-ops when the wrapper is already closed (upsert/delete return False; init returns without touching the inner store). close() takes the same lock before setting _closed, so it blocks until any in-flight write finishes, then proceeds with poller shutdown and inner close().

Tests cover post-close writes not reaching the fake store and close() waiting on a slow upsert.

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

@keelerm84
keelerm84 requested a review from a team as a code owner November 19, 2026 16:05
@cursor cursor Bot added the risk:low label Nov 19, 2026

@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.

Risk: low.

Automated risk review (dry run): Low

This PR would be automatically approved.

Why: Narrow, tested port of the existing sync FDv2 store wrapper’s post-close write guard into _AsyncFeatureStoreClientWrapper in ldclient/impl/datasystem/async_fdv2.py, with coverage in ldclient/testing/impl/datasystem/test_async_fdv2.py. Cursor Bugbot completed successfully with no findings.

If you disagree with this review, share this PR in #feedback-agent-approvals or submit a changes-requested review explaining why.

Open in Web View Automation 

Sent by Cursor Approval Agent: Dry-Run PR Approver

@keelerm84
keelerm84 merged commit 2265718 into feat/10.x Nov 19, 2026
19 checks passed
@keelerm84
keelerm84 deleted the mk/SDK-3708/async-store-writes-after-close branch November 19, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants