MOBILE-311: Heal poisoned in-app WebView cache#746
Open
sergeysozinov wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Implements a self-healing path for WebView in-apps when a cacheable HTTP error response (e.g., a transient 404 on a bootstrap script) gets persisted in Chromium’s HTTP cache, by allowing a single reload with cache bypass and enriching timeout telemetry.
Changes:
- Added
WebViewNoCacheRetryPolicy(pure JVM-testable logic) to decide when to trigger a one-shot no-cache reload based on subresource HTTP errors. - Wired the policy into
WebViewInappViewHolderto perform a cache-bypassed reload before runtime init, prevent duplicateonShown, and include last script HTTP error context in timeout failure telemetry. - Updated WebView prewarm to restart the settle-release budget when a no-cache retry is initiated, with corresponding test updates/additions.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| sdk/src/main/java/cloud/mindbox/mobile_sdk/inapp/presentation/view/WebViewNoCacheRetryPolicy.kt | Adds the retry decision policy for recoverable script HTTP errors and cache-gated one-shot reload. |
| sdk/src/main/java/cloud/mindbox/mobile_sdk/inapp/presentation/view/WebViewInappViewHolder.kt | Integrates no-cache retry behavior into the in-app WebView flow and augments init-timeout telemetry. |
| sdk/src/main/java/cloud/mindbox/mobile_sdk/inapp/presentation/InAppWebViewPrewarmManager.kt | Restarts the prewarm settle-release timer budget when a no-cache retry begins. |
| sdk/src/test/java/cloud/mindbox/mobile_sdk/inapp/presentation/view/WebViewNoCacheRetryPolicyTest.kt | Adds unit tests covering retry eligibility, one-shot behavior, cache gate, and telemetry details. |
| sdk/src/test/java/cloud/mindbox/mobile_sdk/inapp/presentation/InAppWebViewPrewarmManagerImplTest.kt | Updates expected domain and adds a test validating settle budget restart on no-cache retry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+496
to
+500
| mindboxLogI("[WebView] Retrying In-App content load with cache bypassed (${noCacheRetryPolicy.lastHttpErrorDetail})") | ||
| stopTimer() | ||
| readyChecker?.cancel() | ||
| controller.setCacheBypass(true) | ||
| onContentPageLoaded(content) |
enotniy
approved these changes
Jul 24, 2026
| if (isRecoverableScriptHttpError(url, statusCode)) { | ||
| mindboxLogW("[WebView] HTTP error $statusCode for $url (mainFrame=$isForMainFrame)") | ||
| } else { | ||
| mindboxLogD("[WebView] HTTP error $statusCode for $url (mainFrame=$isForMainFrame)") |
Collaborator
There was a problem hiding this comment.
mindboxLogD не используем. Надо бы боту сказать и пометить анотацией метод
| webViewController?.let { controller -> | ||
| hasInitialized = false | ||
| pendingReadyCheckFailure = null | ||
| lastLoadedContent = content |
Collaborator
There was a problem hiding this comment.
дополнительный уровень кэша?
| fun `grants only one retry per page load`() { | ||
| val policy = policy() | ||
|
|
||
| assertTrue(policy.onHttpError(trackerUrl, 404, hasInitialized = false)) |
Collaborator
There was a problem hiding this comment.
ошибки 500 так же будут работаь?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://tracker.yandex.ru/MOBILE-311