chore: replace manual dispose and similar things with using - #42685
Devin Rousso (dcrousso) wants to merge 15 commits into
Conversation
disposable registrations can own cleanup without being read allow unused disposable declarations without dummy references
temporary handles can survive failed operations use `using` and `await using` to dispose owned handles when their scope ends
archive cleanup is duplicated or skipped when extraction fails add `Symbol.dispose` to `ZipFile` and tie owned archives to their scope
command helpers explicitly close their owned sockets in `finally` add disposal methods to the wrappers and retain cleanup on success and failure
waiters already dispose themselves when operations fail make disposal idempotent and tie owned waiters to their scope without duplicating completion events
conditional ownership currently requires manual handle cleanup scope adopted and cross-world handles without disposing borrowed handles
report writers only close after successful serialization close each writer at scope exit while awaiting pending output
database commands duplicate connection cleanup in `finally` add `Symbol.dispose` to `TestResultsDb` and scope command-owned connections
unexpected task or shutdown errors can skip watcher cleanup disarm scoped watchers while preserving their cleanup order and status reporting
test execution manually releases its abort registration in `finally` add disposal support to `signalToPromise` and preserve listener cleanup before teardown
keypress registrations can clean up through both promise completion and their owner make cleanup idempotent and end each registration before the next command or run
operation timeouts are manually cleared on each exit path add a disposable timer adapter that preserves cancellation and works on older Node.js versions
temporary event subscriptions rely on manual cleanup add synchronous disposal to registrations while preserving their asynchronous disposal API
installation lock cleanup is managed separately from acquisition scope the release callback while retaining lock error diagnostics
stdio capture currently relies on paired claim and release calls return an idempotent restoration token and retain the existing release API
Test results for "tests 1"4 flaky51692 passed, 1247 skipped Merge workflow run. |
Test results for "MCP"1 failed 8508 passed, 1436 skipped Merge workflow run. |
🟢 The one failure is a known pre-existing flake — this PR looks clearHi, I'm the Playwright bot and I triaged the red CI here.
DetailsOverall: 51692 + 8508 passed, one failed test, four flaky. The failure reproduces on Pre-existing flake / infra
Triaged by the Playwright bot - agent run |
in many places this avoids having repeated
foo?.dispose()in each earlyreturnbranch and/or allows us to drop antry { ... } finally { ... }entirely