Repository navigation
refactor: use Promise.withResolvers for deferred promises - #5158
Conversation
Replaces captured resolve/reject pairs in production code, shared test fixtures, and the ten test files with the most sites. Adds the ES2024.Promise lib and keeps the previous default libs. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Size Report
Startup median (7 runs, lower is better):
|
Apex Sentinel · ✅ Approve · review of
|
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
|
The PR is ready at 2306c29, and no code problems were found. Not blocking: the reattach mocks in CI passes at this commit: all checks succeed except Not verified here: no tests were run locally or on Node 22.12, and the CI 22.12 step checks the packed package, so it does not necessarily reach every converted call. Not verified here: the smoke logs were not read, so it is not shown that the IME restore fence, detached attempt, simulator log first write or snapshot bridge queue branches were reached; their equivalence rests on reading the diff. Not verified here: in some converted tests an early resolve no longer throws because the resolver now exists before the mock runs; test files were only sampled, and no test that would pass vacuously was identified. Nothing else from this review needs to happen before merge. |
Summary
Hand-built deferred promises become
Promise.withResolvers()(Node >=22.12).tsconfig.jsonnow lists the previous default libs plusES2024.Promise.Converted 138 sites: 23 production, 115 in test support, test-kit and the ten test files with the most sites (excluding files open in #5150/#5151). Three local
deferred()helpers are deleted. Two abort listeners now call() => aborted()for types.Skipped production sites:
runner-io,runtime-common,artifact-tracking,device-mutation-drain,snapshot-helper-retirement,logs/start,native-build/host,toolchain-identity,provider-lease-tablewaiter,tv-cdp/cdp.client-companion-tunnel-worker,limrun-ios-runner.Value
deferred()helpers: 3 → 0Validation
At
2306c29099ad43b491078cce4eb8134324b6136d, passed:pnpm typecheck; oxlint andoxfmt --checkon changed files; layering scan; Vitest on changed tests plus snapshot-source fixture users (232 tests);pnpm test:concurrency-torture. Compiler lib list differs only bylib.es2024.promiseand thees2022.fullaggregator.CI pending. No independent reviewer; I reread the production diff and test additions.
Follow-up: 327 sites in 170 test files (* open in #5150/#5151; .test.ts and packages/…/src omitted)
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.