refactor: batch paykit contact cleanup - #638
Conversation
Greptile SummaryThis PR batches Paykit contact cleanup work to reduce repeated SDK calls. The main changes are:
Confidence Score: 4/5The batch-wide linked-peer failure path can leave stale endpoints without a cleanup retry.
Bitkit/Services/PrivatePaykitService+Contacts.swift
|
| Filename | Overview |
|---|---|
| Bitkit/Services/PrivatePaykitService+Contacts.swift | Batches linked-peer reads and message draining while preserving per-contact cleanup state, but the shared lookup failure path can omit cleanup and retries. |
Reviews (1): Last reviewed commit: "refactor: batch paykit contact cleanup" | Re-trigger Greptile
ee9a95c to
ae345b3
Compare
be606b0 to
1b7bc5e
Compare
ae345b3 to
778f6d0
Compare
1b7bc5e to
4e8c5a4
Compare
778f6d0 to
9dcc431
Compare
4e8c5a4 to
0dd87ec
Compare
jvsena42
left a comment
There was a problem hiding this comment.
Reviewed the batching refactor. The per-contact failure isolation contract does hold — I traced the partial-failure cases (one path of two fails, drain still pending, link inspection fails) and each ends with the contact in failedPublicKeys, state untouched, retry marker set. SwiftFormat lint passes and omitting a changelog fragment is correct for a refactor: with no user-facing change.
Comments inline. The one I'd want addressed (or explicitly accepted) before merge is the widened actor-reentrancy window on the deferred state wipe; the rest are smaller.
Test coverage: no test changes here. PrivatePaykitServiceTests.swift has 12 tests, none of which touch removePublishedEndpoints or linkedPeers, so the new batching, the failedPublicKeys/successfulPublicKeys split, and the snapshot-failure fallback are all untested. The "all 10 focused tests passed" note in the description is a regression run, not coverage of this change. Given the state-clearing logic is the risky part, a test asserting "contact A succeeds, contact B fails → A cleared + marker cleared, B state retained + marker set" would be worth adding.
Merge order: base is codex/paykit-incoming-payment-requests, so this needs to land behind #637.
0dd87ec to
073bb5d
Compare
073bb5d to
907b4ac
Compare
Description
This PR builds on #637 to address the Paykit cleanup performance follow-ups from #620:
On the error path, a failed link snapshot still clears locally recorded published receiver paths while retaining the contact state and retry marker. A batch-level drain-inspection failure conservatively keeps the whole affected batch pending for retry. No user-facing behavior changes are intended.
Linked Issues/Tasks
Screenshot / Video
N/A — service-only refactor.
QA Notes
Manual Tests
N/A
Automated Checks
PrivatePaykitServiceTests.swift: all 13 focused tests passed in the iOS simulator, including mixed cleanup success/failure coverage.git diff --checkpassed.