Skip to content

feat(dispose): add Symbol.asyncDispose to ConfigClient and ConfigWatcher#82

Merged
zeevdr merged 2 commits into
mainfrom
feat/async-dispose
May 24, 2026
Merged

feat(dispose): add Symbol.asyncDispose to ConfigClient and ConfigWatcher#82
zeevdr merged 2 commits into
mainfrom
feat/async-dispose

Conversation

@zeevdr
Copy link
Copy Markdown
Member

@zeevdr zeevdr commented May 24, 2026

Summary

  • Symbol.dispose on ConfigWatcher calls stop() via fire-and-forget (void this.stop()), so await using blocks would return before cleanup completed.
  • Added Symbol.asyncDispose to both ConfigClient and ConfigWatcher so the runtime can properly await the teardown path.
  • Added esnext.disposable to tsconfig.json lib so the compiler recognizes the symbol without bumping the compile target.

Test plan

  • ConfigClient[Symbol.asyncDispose]() — closes both stubs and resolves
  • ConfigClient with await using — stubs closed after block exits
  • ConfigWatcher[Symbol.asyncDispose]() — awaits stop() before resolving, stream cancelled
  • ConfigWatcher with await using — stream cancelled after block exits
  • All 173 existing tests still pass

Closes #51

Symbol.dispose fires stop() as fire-and-forget, so callers using
`await using` would not wait for cleanup to complete. Adding
Symbol.asyncDispose lets the runtime await stop() properly.

Also adds esnext.disposable to tsconfig lib so the symbol type is
recognized by the compiler without a target bump.

Closes #51

Co-Authored-By: Claude <noreply@anthropic.com>
@zeevdr zeevdr added this to the Beta Readiness milestone May 24, 2026
@zeevdr zeevdr added size: S Quick win — a few hours or less priority: P1 Current milestone work labels May 24, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@zeevdr zeevdr enabled auto-merge (squash) May 24, 2026 12:17
@zeevdr zeevdr merged commit 480a0f5 into main May 24, 2026
12 checks passed
@zeevdr zeevdr deleted the feat/async-dispose branch May 24, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: P1 Current milestone work size: S Quick win — a few hours or less

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Symbol.asyncDispose support for await using

1 participant