feat(wallet): accelerate storage synchronization - #486
Draft
BraydenLangley wants to merge 8 commits into
Draft
Conversation
BraydenLangley
force-pushed
the
agent/wallet-sync-throughput
branch
6 times, most recently
from
August 17, 2026 21:57
568e029 to
3d420ab
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
BraydenLangley
force-pushed
the
agent/wallet-sync-throughput
branch
from
September 1, 2026 00:51
74ee852 to
3443b28
Compare
|
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.



Program and scope
getSyncChunkreads dominated an isolated desktop replication, and an existing provider reproduced HTTP 413 when the requested rough page size fit the request contract but the serialized JSON-RPC response exceeded the service ceiling.WalletStorageManager's global sync lock or allowing normal writes to interleave with offset-based replication. That requires a cursor/keyset or consistent-snapshot protocol so mutations cannot shift offsets. No production service rollout or npm publication is performed here.93161fa395ce59ee95a7f567028cada653ac2fb8a4c615b9b4273b197dcf057f89df94816e313081Atomic per-page data/checkpoint transactions are already present on main through #477. This PR relies on that behavior but does not claim it as a new branch change.
Impact
Affected packages and intended versions (publication occurs only through the release workflow after approval):
@bsv/wallet-toolbox2.11.0@bsv/wallet-toolbox-client2.11.0@bsv/wallet-toolbox-mobile2.11.0Storage services must consume the released toolbox and run its normal Knex migration before relying on the faster indexed source reads.
Implementation
10, 80, 160) instead of 25 fixed ten-row reads.(userId, provenTxId)and(userId, txid)transaction indexes. SQLite and MySQL migration tests verify index presence and planner usability. MySQL rollback restores the automaticuserIdforeign-key support index before removing the composites.syncStateIdinto page requests to disambiguate legacy duplicate checkpoints, and make provider registration unique by user/provider identity rather than display name.getSyncChunkonly, recognize HTTP 413, halve the requested rough response budget, retry at most four times, and remember the successful limit for later pages. The original request object is not mutated, unrelated failures are not retried, and write RPCs are never replayed.Verification
Responseobjects: first response 413, retry 200, optional fields preserved, and a legacy chunk without totals accepted. Legacy requests omit totals without count-query overhead.10, 80, 160.a4c615b9b4273b197dcf057f89df94816e313081.The latency measurements are observational local candidate-provider results, not cross-machine or production SLAs. The earlier existing-provider fetch proved resumability after a real 413 but was intentionally stopped and is not presented as a completed production benchmark.
Security and dependencies
Dependency evidence
bench:storage-syncscript.Governance timing note
reviewBydate in UTC before this workstation crossed midnight. The review window is refreshed through 2026-09-30.air-gap-codecreached its 20-minute cancellation limit, so the aggregate run was cancelled. This PR does not claim a fully green scheduled mutation campaign.Compatibility
includeTotalsandsyncStateId; new providers preserve legacy behavior and do not count totals unless requested.Release and operations
Rollout remains staged: review and merge the packages, publish through the governed release workflow, rebuild storage services against the release, validate a non-production remote-to-local sync, then enable the consumer UI. Do not advertise production local backup until the consumer progress/background/cancel follow-ups are independently validated.
Completion evidence