Make the API disposable - #64117
Merged
Wesley Wigham (weswigham) merged 2 commits intoSep 2, 2026
Merged
Conversation
Wesley Wigham (weswigham)
requested review from
Andrew Branch (andrewbranch)
and
a balanced review from Copilot
September 1, 2026 05:48
Copilot started reviewing on behalf of
Wesley Wigham (weswigham)
September 1, 2026 05:49
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Adds lexical lifetime management to the TypeScript API and hardens initialization/disposal races.
Changes:
- Adds synchronous and asynchronous disposal symbols.
- Deduplicates initialization and disposal operations.
- Updates sync generation and benchmark cleanup.
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
packages/typescript/src/api/async/api.ts |
Adds async disposal and lifecycle guards. |
packages/typescript/src/api/async/client.ts |
Tracks connection and closed states. |
packages/typescript/src/api/sync/api.ts |
Provides generated synchronous disposal behavior. |
packages/typescript/scripts/generateSync.ts |
Converts await using into using. |
packages/typescript/test/async/api.bench.ts |
Tears down async benchmark resources. |
packages/typescript/test/sync/api.bench.ts |
Tears down sync benchmark resources. |
packages/typescript/test/sync/api-generators.test.ts |
Exempts new private generator helpers. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Wesley Wigham (weswigham)
force-pushed
the
disposable-api
branch
from
September 1, 2026 20:11
2290a96 to
26cee77
Compare
Andrew Branch (andrewbranch)
approved these changes
Sep 1, 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.
Adds a
Symbol.asyncDispose/Symbol.disposeonto the API, so you canawait using/usingit to manage its' lifetime lexically.I also had to include basically all the disposal/initialization race condition fixes I've been picking into my other recent API PRs here, too.