Skip to content

Fix duplicate completion registration in generated progress promises - #206

Open
leileizhang (lei9444) wants to merge 3 commits into
mainfrom
lei9444-fix-generated-progress-promise
Open

leileizhang (lei9444) wants to merge 3 commits into
mainfrom
lei9444-fix-generated-progress-promise

Conversation

@lei9444

@lei9444 leileizhang (lei9444) commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Generated JavaScript async-with-progress values already start and project a native Promise. Calling their public .toPromise() registered completion again, so a stock InMemoryRandomAccessStream.writeAsync(buffer).toPromise() rejected with 0x80000018 (E_ILLEGAL_DELEGATE_ASSIGNMENT) instead of returning the awaited result.

Fix

Return the existing projected Promise from .toPromise(), including the existing rejection for pre-aborted signals. The shared emitter covers operations, actions, and overloads. Clarify this identity guarantee without changing signatures, raw DynWinRtValue.toPromise(), Python, native ABI, or runtime dispatch.

Hosted Rust 1.99 exposed pre-existing formatting drift in two test-hook stub macro calls. Accept optional trailing commas and format those calls so the normal CI lane can run; emitted native signatures and behavior are unchanged.

Verification

  • Fresh exact-main (de91e9b3) output fails the new 4 MiB stock stream regression with 0x80000018 on ARM64 and x64. Fresh repaired output passes on both using locally built, matching production runtimes (no preview binaries/test hooks).
  • The ABI-free execution double measures one completion registration/result projection, action undefined results, overload dispatch, repeated/detached .toPromise(), await/.then()/Promise.all, projected progress, cancellation, rejection identity, listener cleanup, and pre-aborted signals with zero native calls. Strict TypeScript consumer regression passes.
  • Stock stream write/read and owned-localhost HTTP progress/cancel/abort/error regressions run in isolated, 30-second-bounded children through the normal E2E specs/schema/runner and CI. HTTP overload/content/buffer consumers also check projected object identity and bigint progress, adding 196 covered lines to the unchanged fixture set; coverage thresholds/exclusions are untouched.
  • Local checks: new regression tests (2), related snapshots/declaration tests (10), codegen unit suite (650 passed, 1 ignored), standard generated JavaScript E2E (39/39 plus 4 implementation scenarios), existing raw async/progress tests (5), and Rust formatting with both 1.97 and CI-matched 1.99. Native test-hook compilation passes on ARM64/x64; E2E preparation contract tests pass.

Independent PR based directly on main; no unmerged #198/#205 or audit-branch changes.

leileizhang (lei9444) and others added 2 commits October 1, 2026 20:55
Return the existing projected Promise instead of registering native completion again. Cover generated operations, actions, overloads, cancellation, and stock Windows stream/localhost HTTP consumers.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Accept optional trailing commas and format the two existing macro calls required by hosted Rust 1.99. Generated native signatures and behavior are unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Mixed-language test coverage

Workflow status: ✅ Passed

Layer Lines Functions Branches/regions
Rust, including native .pyd/.node 86.97% 82.49% 86.7% regions
Python aggregate 72.34% n/a 39.42% branches
Python runtime 98.17% n/a 94.57% branches
Generated Python WinRT projections 71.07% n/a 33.5% branches
Generated Python WinRT implementations 71.97% n/a 46.3% branches
JavaScript aggregate 18.18% 24.41% 56.01% branches
JavaScript runtime 44.27% 45.76% 78.99% branches
Generated WinRT projections 16.59% 18.52% 52.17% branches
Generated WinRT implementations 45.99% 59.19% 60.97% branches
Generated Classic COM projections 11.88% 23.97% 53.4% branches

View workflow run and download full HTML/LCOV/XML reports

Cover the stock HttpClient overload, bigint-progress content read, and buffer result through repeated projected Promise consumers. This executes 196 additional lines of the existing generated fixture set without lowering or excluding the coverage gate.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant