Skip to content

Add explicit WinRT property value unboxing - #131

Merged
leileizhang (lei9444) merged 2 commits into
mainfrom
lei9444-explicit-object-unboxing
Sep 3, 2026
Merged

leileizhang (lei9444) merged 2 commits into
mainfrom
lei9444-explicit-object-unboxing

Conversation

@lei9444

@lei9444 leileizhang (lei9444) commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add shared, WinRT-local IPropertyValue detection and explicit scalar/array unboxing
  • expose opt-in unboxObject and unbox_object helpers while preserving null and exact non-IPropertyValue object identity
  • declare the JavaScript unboxObject input as unknown, allowing generated Object/IInspectable results to pass directly under strict TypeScript while retaining runtime validation and a precise return union
  • map JavaScript 64-bit integers to bigint, Python 64-bit integers to int, GUIDs to native language forms, and byte arrays to Uint8Array/bytes
  • surface unsupported PropertyType, invalid JavaScript input, and native getter errors without changing generated/raw Object behavior
  • document the contract and cover DeviceInformation/Bleak-style object maps, arrays, unsupported values, UTF-16 surrogates, non-destructive identity, strict unknown inputs, and the existing clear N-API validation error

Validation

  • cargo test -p dynwinrt: 260 unit tests + 1 regression test passed; 1 ignored
  • cargo test -p dynwinrt-codegen: 561 passed
  • npm run build --prefix bindings\js: passed
  • npm run test:types --prefix bindings\js: strict TypeScript passed with an unknown Object-valued result passed directly to unboxObject
  • npm test --prefix bindings\js: 42 passed; 2 skipped fixture/feature-dependent tests
  • Python binding suite: 132 passed
  • python -m mypy.stubtest dynwinrt: passed
  • WinRT E2E: TypeScript 38/38, Python 42/42, strict generated-Python mypy passed

Closes #127

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

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Mixed-language test coverage

Workflow status: ✅ Passed

Layer Lines Functions Branches/regions
Rust, including native .pyd/.node 82.81% 79.25% 82.64% regions
Generated Python projections 70.48% n/a 21.71% branches
JavaScript aggregate 21.25% 20.56% 53.98% branches
JavaScript runtime 20.14% 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

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@lei9444
leileizhang (lei9444) merged commit 54a3912 into main Sep 3, 2026
24 checks passed
@lei9444
leileizhang (lei9444) deleted the lei9444-explicit-object-unboxing branch September 3, 2026 06:43
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.

Add explicit helpers for unboxing WinRT IPropertyValue objects

2 participants