Skip to content

fix: other review fixes - #1509

Merged
HashEngineering merged 9 commits into
masterfrom
fix/other-review-fixes
Jul 21, 2026
Merged

HashEngineering merged 9 commits into
masterfrom
fix/other-review-fixes

Conversation

@HashEngineering

@HashEngineering HashEngineering commented Jul 8, 2026 •

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

Related PR's and Dependencies

Screenshots / Videos

How Has This Been Tested?

  • QA (Mobile Team)

Checklist:

  • I have performed a self-review of my own code and added comments where necessary
  • I have added or updated relevant unit/integration/functional/e2e tests

Summary by CodeRabbit

  • Bug Fixes
    • Improved contact-request syncing when identity cache data cannot be processed.
    • Changing a wallet PIN now properly removes outdated security fallbacks.
    • Preserved gift card redemption details and notes when updating metadata.
    • Corrected the time-skew warning’s displayed duration.
    • Improved merchant logo loading and transaction icon resolution.
    • Coroutine cancellations now propagate correctly instead of being treated as ordinary errors.

@HashEngineering HashEngineering self-assigned this Jul 8, 2026
@coderabbitai

coderabbitai Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The pull request adds tolerant Dash Platform identity retrieval, clears obsolete encryption fallbacks during PIN changes, preserves merged gift-card metadata, and applies targeted UI, service, and test corrections.

Changes

Platform identity cache tolerance

Layer / File(s) Summary
Identity cache failure handling
wallet/src/de/schildbach/wallet/service/platform/IdentityCacheTolerance.kt
Detects the legacy CBOR cache failure and retries identity retrieval without the cache while propagating unrelated errors.
Contact identity API integration
wallet/src/de/schildbach/wallet/service/platform/PlatformService.kt, wallet/src/de/schildbach/wallet/service/platform/PlatformBroadcastService.kt, wallet/src/de/schildbach/wallet/service/platform/PlatformSyncService.kt
Adds getContactIdentity and uses it for contact-request broadcast and reconciliation flows.
Cache tolerance validation
wallet/test/de/schildbach/wallet/service/platform/IdentityCacheToleranceTest.kt
Tests cached success, legacy-failure recovery, and unrelated exception propagation.

Encryption fallback reset

Layer / File(s) Summary
Fallback invalidation and password-change wiring
wallet/src/de/schildbach/wallet/security/DualFallbackEncryptionProvider.kt, wallet/src/de/schildbach/wallet/security/SecurityGuard.java, wallet/src/de/schildbach/wallet/livedata/EncryptWalletLiveData.kt
Adds fallback removal APIs and invokes them before creating fallbacks for a new PIN.

Gift-card metadata preservation

Layer / File(s) Summary
Merged gift-card metadata caching
wallet/src/de/schildbach/wallet/service/WalletTransactionMetadataProvider.kt, wallet/test/de/schildbach/wallet/service/WalletTransactionMetadataProviderGiftCardTest.kt
Merges note and redeemUrlChallenge values and verifies that merged values are cached.

UI and test correctness updates

Layer / File(s) Summary
UI and service behavior corrections
features/exploredash/..., wallet/src/de/schildbach/wallet/service/TxDisplayCacheService.kt, wallet/src/de/schildbach/wallet/ui/main/MainActivityExt.kt
Rethrows cancellation, reuses merchant logo data, prioritizes in-memory icons, and updates time-skew conversion.
Behavior test expectation updates
wallet/test/de/schildbach/wallet/ui/dashpay/work/GetUsernameVotingResultOperationTest.kt, wallet/test/de/schildbach/wallet/ui/more/tools/TransactionExportTest.kt
Adjusts voting-delay expectations and initializes export metadata before CSV generation.
MainViewModel test dependency wiring
wallet/test/de/schildbach/wallet/util/viewModels/MainViewModelTest.kt
Adds CrowdNode, WorkManager, configuration, saved-state, and constructor dependency mocks.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ContactRequest
  participant PlatformService
  participant IdentityCache
  participant DAPI
  ContactRequest->>PlatformService: getContactIdentity(userId)
  PlatformService->>IdentityCache: identities.get(userId)
  IdentityCache-->>PlatformService: cached identity or CBOR failure
  PlatformService->>DAPI: getIdentity(userId, true)
  DAPI-->>PlatformService: identity
  PlatformService-->>ContactRequest: contact identity
Loading

Possibly related PRs

Suggested reviewers: abaranouski

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is vague and doesn't describe the main change in the pull request. Use a specific title that names the primary fix, such as legacy identity cache tolerance or wallet fallback cleanup.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/other-review-fixes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@HashEngineering
HashEngineering changed the base branch from master to fix/crashes-anrs July 8, 2026 20:31
@HashEngineering
HashEngineering changed the base branch from fix/crashes-anrs to build-11.8.2 July 8, 2026 20:31
@HashEngineering
HashEngineering force-pushed the fix/other-review-fixes branch from da9386e to 1e85d1a Compare July 11, 2026 21:55
@HashEngineering
HashEngineering changed the base branch from build-11.8.2 to master July 11, 2026 21:57
HashEngineering and others added 9 commits July 13, 2026 20:28
…out a logo

DashSpend gift card transactions whose merchant has no logo were falling
back to the static gift card icon in the tx_display_cache. Generate a
full-name merchant icon (matching the merchant list) instead, both on the
home tx list (TxDisplayCacheService) and in the transaction details view
(TransactionResultViewBinder). Adds MerchantNameIcon to the shared
MerchantInitialIcon component and caches generated bitmaps by merchant name.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- UserLocationState: rethrow CancellationException so coroutine
  cancellation isn't swallowed by the generic catch
- MerchantsAtmsResultAdapter: capture logoLocation in a local val to
  avoid dereferencing a nullable merchant
- TxDisplayCacheService: try iconBitmapForEntry first on cold start so
  logo-less gift cards still get a generated icon when customIconId is null
- WalletTransactionMetadataProvider: persist merged gift-card values (not
  raw input) and carry redeemUrlChallenge to avoid null overwrites
- MainActivityExt: fix time-skew dialog to report minutes (abs/60)
- SecurityGuard/DualFallbackEncryptionProvider/EncryptWalletLiveData:
  remove stale fallbacks on PIN change before recreating them
- bump versionName to 11.8.2, dashj 22.0.4, dpp 4.0.0

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Check hasDecryptionKey() alongside the transfer and encryption key
checks so identities missing only the DECRYPTION key are flagged for
upgrade and have it added on next sync. The dpp library now includes a
DECRYPTION key in its default key list and reuses the ENCRYPTION key
material when adding it.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…rade"

This reverts commit 77e3df97f55f550e5213d230ce5b2e8f6f1ee388.
…tacts

Port the dpp-4.0.1 CBOR crash fixes from the kotlin migration branch
(51f3ec9, dff670f) instead of bumping the dpp dependency.

Accepting/receiving a contact request from an identity carrying a
contract-bound key (iOS/Rust-SDK identities) crashed inside the legacy
dashj-platform in-memory identity cache: storeIdentity CBOR-encodes the
fetched identity and throws "No converter for SingleContractDocumentType"
after a successful fetch, aborting the whole accept/receive flow.

- Add IdentityCacheTolerance.kt: pure, unit-tested helper that runs the
  cached get and, only on that specific CBOR cache failure, recovers via
  a cache-bypassing refetch. Any other error propagates unchanged.
- Add PlatformService.getContactIdentity(), wired into the send, accept,
  and receive/reconcile call sites (PlatformBroadcastService,
  PlatformSyncService).
- Never string-interpolate a legacy dashj Identity in logs: toString()
  routes through hashCode() -> CBOR toBuffer() and throws the same
  "No converter for ..." on contract-bound identities. Log the id only.

Scoped to the CBOR fix only; the migration branch's accept-vs-send error
wording UX (which depends on refactoring not present on this branch) is
intentionally excluded.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The test had drifted from MainViewModel's constructor and init block:

- Pass the missing crowdNodeApi constructor arg (mock with signUpStatus
  and balance stubbed, needed by the CrowdNode withdrawal-reminder flow)
- Stub BlockchainIdentityConfig.observe() (BaseProfileViewModel init)
- Stub WorkManager.getWorkInfosByTagFlow (allOperationsStatus moved from
  LiveData to Flow)
- Relax TxDisplayCacheService mock (init now calls setFilter)
- Stub Configuration.isRestoringBackup and the crowdnode reminder
  saved-state key

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- GetUsernameVotingResultOperationTest assumed a 2-minute buffer after
  the voting period, but production (DELAY_AFTER_VOTING_PERIOD) has
  always been 1 minute — all 9 assertions were off by exactly 60s.
  Align the expected values and comments with the shipped formula.
- TransactionExportTest never called initMetadataMap() before
  exportString(), crashing on the lateinit metadataMap. Production
  callers (ToolsViewModel) initialize it first; do the same.

Full :wallet:test_testNet3DebugUnitTest suite now passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@HashEngineering
HashEngineering force-pushed the fix/other-review-fixes branch from 1e85d1a to c7a0023 Compare July 14, 2026 03:28

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
wallet/src/de/schildbach/wallet/livedata/EncryptWalletLiveData.kt (1)

105-114: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Do not report success when fallback recreation fails.

removeFallbacks() deletes the old recovery entries before ensurePinFallback() and ensureMnemonicFallbacks() run, but both Boolean results are ignored. If either operation fails, the PIN has changed, all or part of the fallback recovery is missing, and this method still returns Resource.success(wallet). Handle both results and make the replacement path transactional or explicitly surface failure before reporting success.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wallet/src/de/schildbach/wallet/livedata/EncryptWalletLiveData.kt` around
lines 105 - 114, Handle the Boolean results from securityGuard.ensurePinFallback
and securityGuard.ensureMnemonicFallbacks in the isPinCorrect branch, and do not
return Resource.success(wallet) if either fallback recreation fails. Surface the
failure explicitly or make the remove-and-recreate sequence transactional so the
PIN update cannot report success with incomplete recovery data.
🧹 Nitpick comments (2)
wallet/src/de/schildbach/wallet/service/WalletTransactionMetadataProvider.kt (2)

355-365: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Extract duplicated merge logic.

This existing.copy(...) merge logic is duplicated exactly in insertOrUpdateGiftCard (lines 705-715). Consider extracting it into an extension function (e.g., private fun GiftCard.mergeWith(existing: GiftCard): GiftCard) to keep the merge rules consistent and DRY.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wallet/src/de/schildbach/wallet/service/WalletTransactionMetadataProvider.kt`
around lines 355 - 365, Extract the duplicated existing.copy merge logic from
this provider and insertOrUpdateGiftCard into a single private
GiftCard.mergeWith(existing: GiftCard) extension function. Preserve all current
field precedence and fallback rules, then replace both inline merges with calls
to the shared function.

377-385: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use named arguments for clarity and safety.

insertGiftCardData takes several String? parameters consecutively. Using named arguments prevents accidental parameter swaps if the DAO signature ever changes (e.g., ensuring merged.note maps safely to order and merged.redeemUrlChallenge to giftCardChallenge).

♻️ Proposed refactor
-                merged.txId,
-                merged.number,
-                merged.pin,
-                merged.merchantName,
-                merged.price,
-                merged.merchantUrl,
-                merged.note,
-                merged.redeemUrlChallenge,
-                merged.index
+                txId = merged.txId,
+                giftCardNumber = merged.number,
+                giftCardPin = merged.pin,
+                merchantName = merged.merchantName,
+                originalPrice = merged.price,
+                merchantUrl = merged.merchantUrl,
+                order = merged.note,
+                giftCardChallenge = merged.redeemUrlChallenge,
+                index = merged.index
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wallet/src/de/schildbach/wallet/service/WalletTransactionMetadataProvider.kt`
around lines 377 - 385, Update the call to insertGiftCardData to use named
arguments for each consecutive nullable String parameter, especially mapping
merged.note to order and merged.redeemUrlChallenge to giftCardChallenge;
preserve the existing values and argument order for all remaining parameters.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@wallet/src/de/schildbach/wallet/livedata/EncryptWalletLiveData.kt`:
- Around line 105-114: Handle the Boolean results from
securityGuard.ensurePinFallback and securityGuard.ensureMnemonicFallbacks in the
isPinCorrect branch, and do not return Resource.success(wallet) if either
fallback recreation fails. Surface the failure explicitly or make the
remove-and-recreate sequence transactional so the PIN update cannot report
success with incomplete recovery data.

---

Nitpick comments:
In
`@wallet/src/de/schildbach/wallet/service/WalletTransactionMetadataProvider.kt`:
- Around line 355-365: Extract the duplicated existing.copy merge logic from
this provider and insertOrUpdateGiftCard into a single private
GiftCard.mergeWith(existing: GiftCard) extension function. Preserve all current
field precedence and fallback rules, then replace both inline merges with calls
to the shared function.
- Around line 377-385: Update the call to insertGiftCardData to use named
arguments for each consecutive nullable String parameter, especially mapping
merged.note to order and merged.redeemUrlChallenge to giftCardChallenge;
preserve the existing values and argument order for all remaining parameters.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4e17090b-6eda-48b2-a7c2-621a20217c1a

📥 Commits

Reviewing files that changed from the base of the PR and between 85b8b57 and c7a0023.

📒 Files selected for processing (17)
  • features/exploredash/src/main/java/org/dash/wallet/features/exploredash/services/UserLocationState.kt
  • features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/adapters/MerchantsAtmsResultAdapter.kt
  • wallet/src/de/schildbach/wallet/livedata/EncryptWalletLiveData.kt
  • wallet/src/de/schildbach/wallet/security/DualFallbackEncryptionProvider.kt
  • wallet/src/de/schildbach/wallet/security/SecurityGuard.java
  • wallet/src/de/schildbach/wallet/service/TxDisplayCacheService.kt
  • wallet/src/de/schildbach/wallet/service/WalletTransactionMetadataProvider.kt
  • wallet/src/de/schildbach/wallet/service/platform/IdentityCacheTolerance.kt
  • wallet/src/de/schildbach/wallet/service/platform/PlatformBroadcastService.kt
  • wallet/src/de/schildbach/wallet/service/platform/PlatformService.kt
  • wallet/src/de/schildbach/wallet/service/platform/PlatformSyncService.kt
  • wallet/src/de/schildbach/wallet/ui/main/MainActivityExt.kt
  • wallet/test/de/schildbach/wallet/service/WalletTransactionMetadataProviderGiftCardTest.kt
  • wallet/test/de/schildbach/wallet/service/platform/IdentityCacheToleranceTest.kt
  • wallet/test/de/schildbach/wallet/ui/dashpay/work/GetUsernameVotingResultOperationTest.kt
  • wallet/test/de/schildbach/wallet/ui/more/tools/TransactionExportTest.kt
  • wallet/test/de/schildbach/wallet/util/viewModels/MainViewModelTest.kt

@HashEngineering
HashEngineering merged commit 7e75c47 into master Jul 21, 2026
2 checks passed
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