Skip to content

fix: unstick property sending flag + invalidate named-key RC cache on attach/detach (DEV-1232) - #852

Merged
SpertsyanKM merged 3 commits into
mainfrom
kamo/dev-1232-android-sdk-zalipanie-issendingscheduled-posle-force-flasha
Jul 28, 2026
Merged

fix: unstick property sending flag + invalidate named-key RC cache on attach/detach (DEV-1232)#852
SpertsyanKM merged 3 commits into
mainfrom
kamo/dev-1232-android-sdk-zalipanie-issendingscheduled-posle-force-flasha

Conversation

@SpertsyanKM

@SpertsyanKM SpertsyanKM commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

A6 from the production-defects block of the Remote Config targeting review (dash-mono PR #674). Linear: DEV-1232.

Stuck isSendingScheduled flag

The flag was reset only on the non-empty send branch. If a scheduled job fired while a request was already in flight (early return), or fired on an already-drained storage, the flag stayed true — and every subsequent setUserProperty skipped scheduling until the app went to background or the next remote-config request. Now:

  • the flag is reset on both branches (in-progress and empty);
  • properties saved while a request was in flight (not part of the sent snapshot) get a follow-up send once the request completes.

Named context keys invalidation on attach/detach

Attaching/detaching an experiment or a remote configuration invalidated only the empty-context-key cache entry — configs under named context keys stayed stale until process restart. The SDK addresses attach by entity id and cannot know which context key that entity serves, so every cached config is dropped now (invalidateLoadedConfigs).

Tests

+5 unit tests (stuck flag on both branches, follow-up send, named-key invalidation for both config and experiment attach). :sdk:testDebugUnitTest and detektAll are green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Y4V5cx2SMU4VrfPntwfKJ9

…on attach

Two remote-config-review defects (A6):

isSendingScheduled could stay true forever: the flag was reset only on the
non-empty send branch, so a scheduled job swallowed by an in-flight request
(or firing on an already-drained storage) left it set — and every later
setUserProperty skipped scheduling until a background/RC trigger. Reset the
flag on both branches and schedule a follow-up send for properties saved
while a request was in flight (they are not part of the sent snapshot).

attach/detach of an experiment or remote configuration invalidated only the
empty-context-key cache entry, so configs under named context keys stayed
stale until process restart. The SDK addresses attach by entity id and cannot
know which context key it serves — drop every cached config.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y4V5cx2SMU4VrfPntwfKJ9
SpertsyanKM and others added 2 commits July 28, 2026 12:33
…n-flight RC loads

Review follow-ups:

- UserPropertiesStorage.clear now removes entries only when the value still
  matches the sent snapshot (ConcurrentHashMap.remove(key, value)). A key
  overwritten while its previous value was in flight survives the post-send
  cleanup and is delivered by the follow-up send — previously the new value
  was silently lost.

- QRemoteConfigManager gains an invalidation generation: attach/detach and
  user change bump it, loads capture it at start and skip the cache write if
  it moved. An in-flight response evaluated before the invalidating event can
  no longer be re-cached as fresh (single-key and list paths).

- Documented the tolerated isSendingScheduled false-with-pending-job state
  so the flag reset is not "fixed" back into the stuck-flag bug.

Tests: value-conditional clear, no-double-schedule guard on the follow-up
send, all four attach/detach entry points with callback-survival assertions,
stale in-flight re-cache prevention. testDebugUnitTest and detektAll green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y4V5cx2SMU4VrfPntwfKJ9
Delivery assertion on the in-flight invalidation test (the generation guard
must skip only the cache write — the response still reaches the waiting
caller and isInProgress resets), a list-path counterpart (the guard is the
only barrier there, since attach does not replace the map), and named
per-entry-point assertion messages in the four-way invalidation loop.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y4V5cx2SMU4VrfPntwfKJ9
@SpertsyanKM
SpertsyanKM merged commit d369165 into main Jul 28, 2026
1 check passed
@SpertsyanKM
SpertsyanKM deleted the kamo/dev-1232-android-sdk-zalipanie-issendingscheduled-posle-force-flasha branch July 28, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant