fix: dispose RPC authentication channel and trust deadlines - #386
fix: dispose RPC authentication channel and trust deadlines#386dvcolomban wants to merge 1 commit into
Conversation
◈ PR Lens
Architecture 1 component touched across 5 lanes. Data flow
View
Tip Run 🪧 More tips
Thanks for using PR Lens! It's built by Coldtea, free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved blocking issues were identified.
Pull request overview
Fixes RPC client resource leaks by closing the authentication channel and reliably clearing trust deadlines.
Changes:
- Adds resilient cleanup for authentication, WebMCP, and transport resources.
- Clears trust deadlines in
finally. - Adds regression coverage for cleanup and trust-wait behavior.
File summaries
| File | Summary |
|---|---|
packages/devframe/src/client/rpc.ts |
Adds authentication-channel disposal and resilient cleanup. |
packages/devframe/src/client/rpc.test.ts |
Tests channel closure and cleanup failures. |
packages/devframe/src/client/rpc-live.ts |
Ensures trust timers are cleared. |
packages/devframe/src/client/rpc-live-trust.test.ts |
Tests trust deadline lifecycle behavior. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Closing an RPC client leaves its authentication
BroadcastChannelopen. SuccessfulensureTrusted()calls also retain their timeout because.then(clear)captures the initial no-op beforeclearis replaced. Together these keep a Node consumer alive after it disconnects.Close the authentication channel alongside WebMCP and transport disposal, continuing transport cleanup if another disposer throws. Clear each trust deadline in
finally; preserve authentication, expiry and unlimited-wait behavior.Added regressions for concurrent and already-resolved trust waits, expiry, unlimited waits, channel closure and cleanup failure. Three regressions fail before the fix. Afterward, 24 focused client/authentication tests pass, as do affected lint, package type checking and the package build. A separate Node process connected to a real local RPC server, authenticated, invoked a method and exited naturally after
close(), without forced exit.