Skip to content

feat: add terminal Core and SignClient lifetime disposal - #7391

Draft
sidhujag wants to merge 2 commits into
WalletConnect:v2.0from
sidhujag:codex/terminal-disposal
Draft

sidhujag wants to merge 2 commits into
WalletConnect:v2.0from
sidhujag:codex/terminal-disposal

Conversation

@sidhujag

@sidhujag sidhujag commented Nov 8, 2026

Copy link
Copy Markdown

Summary

Adds explicit terminal disposal for Core and SignClient so a wallet can close an authenticated native session and await its owned work before retiring storage.

  • Core owns transport shutdown, timers, network listeners and admitted persistence work.
  • SignClient owns its engine listeners, pending protocol awaits and admitted mutations. Disposing one client keeps a separately owned shared Core usable.
  • Request-owner cancellation propagates through relay requests, pairing operations and protocol waits.
  • Late initialization, queued callbacks, retries and protocol completions cannot reactivate a disposed owner.
  • Browser log callbacks are removed by identity. In-flight log exports recheck ownership and drain before disposal completes.
  • Concurrent initialization remains joined, while a transient failed initialization can be retried.
  • Existing reversible transport close/open behavior and persisted session recovery remain available.

Companion dependency

This draft requires the terminal provider/WebSocket capabilities in WalletConnect/walletconnect-utils#283. The checked-in package pins still refer to released dependencies. They need to adopt the companion release before this PR can pass normal package-based integration and ship.

Validation

  • 46 focused lifecycle, request-owner, timeout and network-cleanup tests pass against the combined Core and transport source.
  • The combined TypeScript graph passes.
  • 13 companion provider/WebSocket tests pass, including a real Node ws handshake cancellation.
  • Changed production source passes ESLint and formatting. Existing require-await warnings remain.
  • Two independent static review passes found transient-initialization retry and log-export cancellation gaps; both are fixed with focused regressions and re-reviewed.

The local combined test configuration explicitly aliases the companion provider, WebSocket and types source. This evidence does not establish native iOS/Android close completion or live-relay qualification. Those remain release gates. No package has been published from this branch.

Lifetime contract

Callers retain storage until disposal completes. Protocol messages already handed to the transport may have been delivered. A client and its exclusively owned Core can be disposed concurrently. Shared Core lifetime remains controlled by its owner.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution! We ask that you please read and sign our CTA Document before we can accept your contribution. You can sign the CTA simply by posting a Pull Request Comment with the following text:


I have read the CTA Document and I hereby sign the CTA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

This branch has not been deployed

No deployments
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.

1 participant