Skip to content

MOBILE-458: Fetch segmentations and geo before a page asks about its in-apps - #796

Merged
sergeysozinov merged 6 commits into
mission/storiesfrom
feature/MOBILE-458
Oct 8, 2026
Merged

sergeysozinov merged 6 commits into
mission/storiesfrom
feature/MOBILE-458

Conversation

@sergeysozinov

Copy link
Copy Markdown
Collaborator

sozinov added 2 commits October 7, 2026 15:51
…in-apps

The stories page waits 3 s for filterShowableInapps, and the segmentations of its
circles were fetched lazily on that question, so a slow CheckCustomerSegments made
the page give up and the whole ribbon collapse. Like iOS, the place resolve now
fetches the session's segmentations and geo in parallel before handing the content
over (only when the place has candidates), and a web-page overlay does the same
after APP_STARTED is released. The page is answered from the session cache.

- Segmentation and geo repositories cache a failed fetch for the session, so the
  page path no longer re-hits the network for every circle and question.
- The page's question goes through matchesRequestedTargeting, the place check
  without failure reporting.

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Parse failures bypass session caching, and the PR includes an unrelated animation behavior change.

Review effort: Balanced
Findings: 2 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Prefetches geo and segmentation data before web-backed in-app pages request targeting decisions.

Changes:

  • Adds targeting dependency prefetching for overlay and embedded flows.
  • Caches fetch failures per session and centralizes requested-targeting checks.
  • Expands unit coverage for prefetch ordering, failures, and cancellation.
File Description
InAppProcessingManagerTest.kt Tests prefetch and requested targeting behavior.
InAppInteractorImplTest.kt Tests overlay-triggered prefetching.
EmbeddedResolveInteractorTest.kt Tests embedded prefetch ordering.
InAppSegmentationRepositoryTest.kt Tests segmentation failure caching.
InAppGeoRepositoryTest.kt Tests geo failure caching.
InAppProcessingManager.kt Adds prefetch and requested-targeting APIs.
InAppProcessingManagerImpl.kt Implements dependency prefetching and error handling.
InAppInteractorImpl.kt Integrates prefetching into page-hosting flows.
InAppSegmentationRepositoryImpl.kt Caches segmentation network failures.
InAppGeoRepositoryImpl.kt Caches geo network failures.
Extensions.kt Detects variants containing web pages.
EmbeddedBlockRevealAnimation.kt Changes reveal animation easing.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

sozinov added 3 commits October 8, 2026 18:57
…p cancellation out of ShowFailure

- A place pass that fetched its targeting dependencies into one session and
  would have matched candidates against the next one now resolves again, once,
  for the new session instead of answering the block from mixed state.
- Cancellation surfacing inside chooseInAppToShow's network wait (reachable now
  that the gateway is cancellable) is rethrown before the UNKNOWN_ERROR branch,
  so no false Inapp.ShowFailure goes out.
- Tests: success twins for the session-reset cases, two callers on one mutex,
  cancellation inside the lock, Volley request cancelled with the coroutine.
…ions

- Place targeting that matches from the session cache collects nothing.
- Geo caller cancelled while holding the lock leaves the next caller a fetch.
- checkCustomerSegmentations cancels its Volley request with the coroutine.
- The chooseInAppToShow cancellation test is named for what it asserts.
- The page's question saves the available config's in-apps into the session
  before checking, so a page asking right after a reset keeps its segment ids.
- A place pass checks the session identity again once the winner is picked,
  right before its targetings go out, drops the failures the abandoned pass
  collected, and resolves again as a plain place request of the new session
  instead of replaying the old session's operation.
- sendTargetedInApp(inApp, event) rethrows cancellation like chooseInAppToShow.
- The cache-hit test runs on the real repository; the cancellation test makes
  the targeting pass so "no targeting sent" is proved by the cancellation.
@sergeysozinov
sergeysozinov merged commit 978f2f7 into mission/stories Oct 8, 2026
6 checks passed
@sergeysozinov
sergeysozinov deleted the feature/MOBILE-458 branch October 8, 2026 19:42
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