Skip to content

Fix explicit WinRT delegate selection for JavaScript and Python - #207

Merged
leileizhang (lei9444) merged 4 commits into
mainfrom
lei9444-explicit-delegate-selection
Oct 8, 2026
Merged

leileizhang (lei9444) merged 4 commits into
mainfrom
lei9444-explicit-delegate-selection

Conversation

@lei9444

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

Copy link
Copy Markdown
Contributor

Problem

Explicitly selecting ThreadPool,WorkItemHandler treats the delegate as a runtime class and replaces its working dependency module with a placeholder. JavaScript then fails with Failed to recover WinGUID; Python rejects a normal callback as a non-DynWinRTValue input. Selecting only ThreadPool works.

Fix

Recognize public, non-generic WinRT delegates from their metadata before the runtime-class fallback, then reuse the existing delegate parsing and dependency pipeline for JavaScript and Python. Explicit, dependency-only and namespace selection now produce consistent delegate contracts. Malformed, non-WinRT and open-generic roots fail explicitly; standalone-interface and Classic COM routing are unchanged.

Verification

  • Real awaited ThreadPool callbacks pass in JS CJS/ESM and Python on ARM64 and x64; fresh-main output reproduces the original failures.
  • Regressions cover delegate-only, combined/reversed, namespace and incremental selection, a second timer delegate family, and strict TypeScript/mypy/Pyright positive and negative consumers. Clean-checkout tests cover native/CLR Facade metadata and authoritative-source/installed-wheel stubs without relying on build residue.
  • Final-head Build, coverage and Python artifact checks passed. Automatic-dependency output remains byte-identical for the tested delegate families.

No native runtime, ABI, lifetime or release behavior changes. A separate, formatting-only CI prerequisite updates existing test-hook macro syntax for current rustfmt.

leileizhang (lei9444) and others added 2 commits October 1, 2026 21:59
Classify validated non-generic WinRT delegates before runtime-class fallback and reuse the shared dependency interface parser for JavaScript and Python. Include namespace roots, selection-order/incremental regressions, strict callable consumers, and bounded real ThreadPool callback fixtures.

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.93% 82.46% 86.64% 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 21.91% 25.18% 57.61% branches
JavaScript runtime 44.27% 45.76% 78.99% branches
Generated WinRT projections 22.8% 18.7% 54.84% 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

leileizhang (lei9444) and others added 2 commits October 7, 2026 21:33
Retain the SDK Facade override while supplementing its same-version native contracts and sharing expanded paths between direct metadata checks and generation. Add native/Facade/raw-CLI parity controls without weakening declaring-kind, IID, Invoke, or unsupported-root assertions.

Use tracked dynwinrt.pyi for static strict consumers, retain unrelated stub roots, and check installed wheel stubs independently. A tracked-only incomplete source fixture reproduces the old shadowing failure, while source and installed lanes enforce zero positive errors and one negative argument-type diagnostic in both Python output modes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Retain every metadata override, preserve a versioned Facade's matching native contract when available, and use the CLI's Windows-namespace probe and versioned SDK discovery for unversioned Facades before shared sibling expansion. Exercise the exact hosted unversioned path as well as native and versioned Facade controls with all declaring-kind, IID, Invoke and generated-output parity assertions enforced.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@lei9444
leileizhang (lei9444) merged commit 2000521 into main Oct 8, 2026
33 checks passed
@lei9444
leileizhang (lei9444) deleted the lei9444-explicit-delegate-selection branch October 8, 2026 08:55
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.

2 participants