feat(persist_test_utils)!: Add async suite to test AsyncWalletPersister - #518
Merged
ValuedMammal merged 2 commits intoJul 27, 2026
Conversation
…e deps Redesign the API so callers supply a `FnOnce` closure that returns the persister directly. All functions return `Result<(), PersistError>` instead of panicking. Add `PersistError` enum with `Persister` and `ChangeSetMismatch` variants. Factor common logic into internal helpers `init_wallet_persister` and `check_changeset_is_persisted` for reuse by each of the public functions. Remove `persist_single_keychain`. Single-keychain persistence is covered by `persist_keychains`. Remove `anyhow` and `tempfile` from the test-utils feature's optional dependencies.
Add async counterparts to the test suite to exercise implementations of AsyncWalletPersister. All entry points use the `F: AsyncFnOnce() -> Result<P, P::Error>` bound, consistent with the sync API pattern. `persist_wallet_changeset_async` tests a full changeset round-trip followed by a second changeset to verify merge semantics. `persist_keychains_async` runs the two-round descriptor persistence check. `persist_network_async` verifies the network field round-trips correctly. Add private helpers `init_async_wallet_persister` and `check_changeset_is_persisted_async` to mirror the sync suite.
bladed-operative
requested review from
ValuedMammal and
oleonardolima
as code owners
July 27, 2026 14:48
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #518 +/- ##
==========================================
+ Coverage 81.77% 81.84% +0.06%
==========================================
Files 25 25
Lines 6487 6487
Branches 296 296
==========================================
+ Hits 5305 5309 +4
+ Misses 1080 1078 -2
+ Partials 102 100 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ValuedMammal
approved these changes
Jul 27, 2026
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.
Description
Picks up the work started on #343 by extending the
persist_test_utilsmodule with an async test suite forAsyncWalletPersister.The public test functions previously took a
filename: &strand a path-based closure, managedtempfile::tempdir()internally, and panicked on failure. This redesigns the API so callers supply aFnOnceclosure that owns the store directly, and all functions returnResult<(), PersistError>instead of panicking. A newPersistErrorenum exposes failures as structured values withChangeSetMismatchandPersistervariants.persist_single_keychainis removed, and its coverage is absorbed intopersist_keychains, which now runs two rounds: external descriptor only, then external plus change descriptor with merge verification.anyhowandtempfileare removed from thetest-utilsfeature's optional dependencies and kept only asdev-dependencies.Adds async counterparts to every public function in the
WalletPersistertest suite so implementors ofAsyncWalletPersistercan exercise the same scenarios:persist_wallet_changeset_async,persist_keychains_async, andpersist_network_async. Two private helpers,init_async_wallet_persisterandcheck_changest_is_persisted_async, mirror the sync suite API.Changelog notice
Added
persist-test-utils: Add public functionspersist_wallet_changeset_async,persist_keychains_async, andpersist_network_asyncfor testingAsyncWalletPersisterPersistErrorenum withChangeSetMismatchandPersistervariantsChanged
persist_test_utilspublic API. callers own store construction; functions now returnResult<(), PersistError>anyhowandtempfiledependencies from thetest-utilsfeatureRemoved
persist_single_keychain;persist_keychainsnow covers the single-keychain caseBefore submitting