refactor: batch paykit contact cleanup - #1099
Conversation
Greptile SummaryThis PR batches private Paykit contact publication and cleanup work. The main changes are:
Confidence Score: 4/5The batched cleanup path can skip remote cleanup or block unrelated contacts, so these cases should be fixed before merging.
app/src/main/java/to/bitkit/repositories/PrivatePaykitRepo.kt
|
| Filename | Overview |
|---|---|
| app/src/main/java/to/bitkit/repositories/PrivatePaykitRepo.kt | Adds shared linked-peer snapshots, batched cleanup and draining, and per-contact cache reconciliation. |
| app/src/test/java/to/bitkit/repositories/PrivatePaykitRepoTest.kt | Adds valid tests for one linked-peer read, one shared drain, and partial cleanup failure. |
Reviews (1): Last reviewed commit: "refactor: batch paykit contact cleanup" | Re-trigger Greptile
6959e91 to
9bae4d5
Compare
e56f9dc to
9cf060e
Compare
eda7df2 to
4457134
Compare
9cf060e to
85d80c8
Compare
4457134 to
ece10d4
Compare
85d80c8 to
0b91ae2
Compare
jvsena42
left a comment
There was a problem hiding this comment.
Reviewed the batching refactor against the parallel iOS findings on synonymdev/bitkit-ios#638.
The structure is a clear improvement over the base, and the per-contact failure isolation contract does hold — I traced clear-failure, drain-still-pending, and link-inspection-failure, and each ends with the contact in failedPublicKeys, cache retained, retry marker intact. Test coverage is also meaningfully ahead of the iOS PR, which ships none. ./gradlew testDevDebugUnitTest --tests to.bitkit.repositories.PrivatePaykitRepoTest passes locally.
iOS parity summary
| iOS #638 finding | Android status |
|---|---|
| greptile P1 — shared lookup failure drops cleanup + retries | ✅ already fixed in 0b91ae2 (ahead of the iOS fix) |
N+1 linkedPeers() on snapshot failure |
|
| duplicated snapshot-or-fallback block | |
| clears now attempted after link-inspection failure | |
| drain-check failure blast radius = whole batch | |
| widened reentrancy window on the deferred state wipe | |
| eager vs deferred failure markers | n/a — Android markers are caller-driven |
Requesting changes on one item: the invalid-key handling added in 0b91ae2 turns a previously self-healing no-op into a permanently non-converging failure that blocks profile-delete, disable-sharing, and wipe cleanup for all contacts. Details inline. Everything else is either an iOS-parity item worth resolving consistently across platforms, or a cleanup.
Description nits: "no user-facing behavior changes are intended" isn't quite accurate — the error path now issues clearPrivatePaymentList calls it previously skipped, and transient-failure granularity is coarser. Both worth a bullet.
Changelog: correctly omitted for a refactor: with no user-facing change.
0b91ae2 to
b668941
Compare
cf14578 to
44d58d2
Compare
b668941 to
cd4cd1e
Compare
|
Restacked onto the current #1098 head after the base rewrite. The cleanup review-fix commit previously referenced as The current |
44d58d2 to
796bc2b
Compare
cd4cd1e to
39a1ae2
Compare
39a1ae2 to
670e9e7
Compare
…/batch-paykit-contact-cleanup
ovitrif
left a comment
There was a problem hiding this comment.
Approved. The batched cleanup keeps per-contact clear isolation, drops malformed pending keys without failing the pass, and preserves cache state that changes while remote cleanup is suspended.
830d135
into
codex/paykit-incoming-payment-requests-rc39
Description
This PR builds on #1098 to batch and harden private Paykit contact cleanup:
Error-path behavior is intentionally conservative:
Preview
N/A — repository-only refactor.
QA Notes
Manual Tests
N/A
Automated Checks
PrivatePaykitRepoTest.kt: all 43 focused tests passed, including malformed-state recovery, shared snapshot retry, batched deleted-contact retry, drain-inspection failure, partial cleanup failure, and a concurrent cache update during remote cleanup../gradlew compileDevDebugKotlinpassed as part of the focused and full test runs../gradlew testDevDebugUnitTestpassed../gradlew detektpassed with only pre-existing findings outside this change.git diff --checkpassed.