Skip to content

Fix stale refresh results and empty price history - #312

Open
agammann wants to merge 3 commits into
Blockstream:masterfrom
agammann:fix/wallet-refresh-and-ci
Open

agammann wants to merge 3 commits into
Blockstream:masterfrom
agammann:fix/wallet-refresh-and-ci

Conversation

@agammann

Copy link
Copy Markdown

Two refresh paths can expose stale or unusable data. After a completed refresh, firstSettled() can still return the previous value from the shared observer. Successful price history responses with no usable daily prices or incomplete rows can throw before the caller publishes a data state.

Read the authoritative state flow after invoking the use case. For chart history, safely access timestamps and return null when no usable daily price remains, allowing the existing caller to publish DataState.Empty. Regression tests cover delayed shared replay, success/error/empty states, skipped work, malformed chart rows and valid price ordering.

The existing Meld tests prevented full validation because they called the production service and relied on a missing test logger registration. Replace those calls with HTTP contract tests through the real Meld client, repository and JSON serialization using Ktor MockEngine. Assert quote and widget request bodies, limits query parameters and response values, plus HTTP 403 and malformed response handling. Add optional engine injection while retaining the default production client configuration. These tests validate app behavior; they do not establish live Meld service availability.

Validation: fork CI passed before opening this PR. The workflow checks out and verifies the exact proposed commit, 85d057705a8dcedcf9823507e1c6bccee6ca5a9c. All 263 executed tests passed with zero failures, errors or skips: 62 data, 60 domain, 6 utils, and 45 Android tests for each of development, production FDroid and production Google. The repository test task and :androidApp:assembleProductionGoogleDebug succeeded. The new refresh/chart regressions were also verified to fail against the original implementation before the fixes.

The successful debug APK and XML reports are available with the run. The validation workflow lives on a separate fork branch and is not part of this PR. This is fork CI evidence; Blockstream's private GitLab pipeline was not run.

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.

1 participant