Skip to content

Support struct-valued WinRT progress callbacks - #110

Merged
leileizhang (lei9444) merged 4 commits into
mainfrom
lei9444-struct-progress-callbacks
Sep 1, 2026
Merged

leileizhang (lei9444) merged 4 commits into
mainfrom
lei9444-struct-progress-callbacks

Conversation

@lei9444

@lei9444 leileizhang (lei9444) commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • route by-value WinRT struct delegate parameters through the existing cached, ABI-aware libffi callback engine while retaining scalar/f32/f64 static trampolines
  • copy borrowed ABI structs into exact-type ValueTypeData ownership, recursively duplicating HSTRING, COM/interface, parameterized-interface, and nested-struct fields before asynchronous dispatch
  • prepare callback CIFs through fallible low-level libffi APIs, reject zero-sized callback structs, and make executable closure allocation null-safe before publishing a vtable
  • surface callback backend creation failures through JavaScript and Python exceptions via fallible try_create_* APIs
  • use unaligned-safe 64-bit callback argument/result storage for i686 across both WinRT delegates and shared Classic COM callbacks
  • enable struct progress in JavaScript and Python while keeping GUID, array, open generic, ArrayOfIUnknown, and OutValue shapes fail-closed
  • verify generated JS/TypeScript and Python projections expose and convert HttpProgress as the projected struct type
  • exercise real Windows.Web.Http.HttpProgress callbacks in both binding suites using loopback-only HTTP servers, without expanding the shared generated E2E dependency graph

Validation

  • callback CIF failure, executable allocation failure, and zero-sized struct regressions
  • simulated 4-byte-aligned i64/u64/f64 callback input/output storage tests for WinRT and Classic COM
  • core delegate, callback-cache, struct ownership, scalar progress, and 23 dynamic COM callback regression tests
  • JavaScript and Python language-exception tests for zero-sized struct delegates
  • JavaScript/Python binding Rust tests and loopback struct-progress E2E
  • dynwinrt-codegen HttpProgress converter and declaration/stub regression tests
  • Classic COM live E2E: 17/17
  • i686 and ARM64 Windows compile checks

This branch is based directly on main and does not depend on PR #109.

Route by-value WinRT structs through cached ABI-aware libffi closures, retain nested non-blittable fields for asynchronous dispatch, and enable fail-closed JS/Python progress projection with loopback HttpProgress coverage.

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

github-actions Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Mixed-language test coverage

Workflow status: ✅ Passed

Layer Lines Functions Branches/regions
Rust, including native .pyd/.node 82.61% 78.97% 82.59% regions
Generated Python projections 70.48% n/a 21.71% branches
JavaScript aggregate 21.24% 20.56% 53.98% branches
JavaScript runtime 19.91% 14.28% 7.14% branches
Generated WinRT projections 25.74% 19.25% 54.66% branches
Generated Classic COM projections 14.65% 24.46% 53.75% branches

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

Propagate callback closure creation errors through the JavaScript and Python Result paths, and move live HttpProgress coverage into binding-level loopback tests so the shared generated coverage graph stays at its established baseline.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Prepare callback CIFs through fallible libffi APIs, make executable closure allocation null-safe, reject zero-sized callback structs, and use unaligned-safe 64-bit callback storage across WinRT and Classic COM.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Validate struct callback graphs recursively before libffi preparation and add compile-time Send/Sync coverage for cached callback storage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@lei9444
leileizhang (lei9444) merged commit c48f6d2 into main Sep 1, 2026
26 checks passed
@lei9444
leileizhang (lei9444) deleted the lei9444-struct-progress-callbacks branch September 1, 2026 03:12
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