Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0a5b842
Add contract-driven Win32 scalar and Registry projections
lei9444 Sep 11, 2026
b36adfd
Merge main before restoring full Win32 capability parity
lei9444 Sep 11, 2026
0945417
Restore full PR 102 Win32 capability parity with typed contracts
lei9444 Sep 11, 2026
8b45ef4
Merge unified COM contract registries from main
lei9444 Sep 11, 2026
55de54f
Document Win32 sample APIs and expected behavior
lei9444 Sep 11, 2026
b2d6c89
Expand Win32 behavior tests and retire migration snapshots
lei9444 Sep 11, 2026
9c46cb6
Fix MAPI utility imports and bound native lifecycle tests
lei9444 Sep 12, 2026
64cb960
Separate MAPI provider integration from required lifecycle tests
lei9444 Sep 12, 2026
c1dc70f
Refine Win32 native output and resource state contracts
lei9444 Sep 12, 2026
0389c5d
Unify Win32 contracts and extract native IOCP engine
lei9444 Sep 12, 2026
62d65a4
Capture Win32 aggregate results and isolate I/O notifications
lei9444 Sep 13, 2026
aa3d0ce
Require unsafe legacy Win32 aggregate ownership adoption
lei9444 Sep 14, 2026
2262927
Preserve Win32 aggregate cleanup through result failures
lei9444 Sep 14, 2026
ce10d5e
Commit Win32 native side effects before result processing
lei9444 Sep 14, 2026
8f887b1
Coordinate Win32 aggregate retirement with input resource locks
lei9444 Sep 14, 2026
7fd9f73
Load optional Win32 subsystem DLLs on demand
lei9444 Sep 14, 2026
3f3cba4
Reuse a command-scoped index for flat Win32 routing
lei9444 Sep 14, 2026
4590ed1
Clarify experimental status and refresh Win32 documentation
lei9444 Sep 15, 2026
0993622
Merge main into leilzh/win32-contracts
lei9444 Sep 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/agents/e2e-test.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: e2e-test
description: Run end-to-end tests for dynwinrt code generation and WinRT/Classic COM API invocation
description: Run end-to-end tests for dynwinrt code generation and WinRT, Classic COM, and flat Win32 API invocation
tools:
- powershell
- view
Expand All @@ -24,13 +24,18 @@ You run and manage the dynwinrt end-to-end test suite.
# Classic COM only (requires Windows.Win32.winmd)
.\tests\e2e\e2e_test.ps1 -SkipBuild -Lang com

# Flat Win32 only (requires Windows.Win32.winmd)
.\tests\e2e\e2e_test.ps1 -SkipBuild -Lang win32

# Full build + test
.\tests\e2e\e2e_test.ps1
```

## Adding test cases

Add entries to `tests/e2e/e2e_specs.json`. See `tests/e2e/e2e_specs.schema.json` for the field definitions.
Add WinRT entries to `tests/e2e/e2e_specs.json`. See `tests/e2e/e2e_specs.schema.json` for the field definitions.
Classic COM and flat Win32 scenarios use the runners under `tests/e2e/runners/com/`
and `tests/e2e/runners/win32/`, wired through `tests/e2e/e2e_test.ps1`.

Safe WinRT APIs to test (no extra dependencies):
- `Windows.Foundation`: Uri, PropertyValue, WwwFormUrlDecoder, MemoryBuffer
Expand All @@ -43,5 +48,5 @@ Avoid APIs that need WinAppSDK, network, or user interaction.
## Diagnosing failures

1. Check `tests/e2e/e2e_generated/results_py.json` or `results_ts.json` for structured failure details
2. Inspect generated code in `tests/e2e/e2e_generated/python_bindings/`, `ts/`, or `com/`
2. Inspect generated code in `tests/e2e/e2e_generated/python_bindings/`, `ts/`, `com/`, or `win32/`
3. Common issues: circular imports in codegen, naming mismatch (Python snake_case vs TS camelCase)
8 changes: 6 additions & 2 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ This file provides instructions for the GitHub Copilot coding agent when working
- **Python binding** (`bindings/py/`) — PyO3 binding for Python
- **Code generator** (`tools/dynwinrt-codegen/`) — Source for dynwinrt-codegen, which generates typed JavaScript (`.js`) + TypeScript declarations (`.d.ts`), or Python (`.py` + optional `.pyi`) wrappers from .winmd metadata

Classic COM and flat Win32 have separate JavaScript/TypeScript projections and
runtime subpaths. Flat Win32 uses its own native ABI, resource, and contract
model; see [the Win32 architecture](../docs/architecture/flat-win32-contracts.md).

## Build & Test Commands

```bash
Expand Down Expand Up @@ -53,9 +57,9 @@ The E2E test framework validates the full pipeline: reading .winmd metadata →
- `instantiate`: how to create an instance (`activate`, `static_factory`, or `none`)
- `checks`: array of assertions (`property_equals`, `property_exists`, `method_equals`, `method_result_contains`, `static_equals`, `static_not_null`)

2. **Runners** (`tests/e2e/runners/py_runner.py`, `tests/e2e/runners/ts_runner.ts`, and `tests/e2e/runners/com/*.mjs`) execute generated WinRT and Classic COM bindings.
2. **Runners** (`tests/e2e/runners/py_runner.py`, `tests/e2e/runners/ts_runner.ts`, `tests/e2e/runners/com/*.mjs`, and `tests/e2e/runners/win32/*.mjs`) execute generated WinRT, Classic COM, and flat Win32 bindings.

3. **Orchestrator** (`tests/e2e/e2e_test.ps1`) handles build, temporary code generation, and runner invocation. Use `-Lang com` for the Classic COM suite; it requires `DYNWINRT_WIN32_WINMD` or an installed `Microsoft.Windows.SDK.Win32Metadata` package.
3. **Orchestrator** (`tests/e2e/e2e_test.ps1`) handles build, temporary code generation, and runner invocation. Use `-Lang com` for Classic COM or `-Lang win32` for flat Win32; both require `DYNWINRT_WIN32_WINMD` or an installed `Microsoft.Windows.SDK.Win32Metadata` package.

4. **Adding new test cases**: Add entries to `tests/e2e/e2e_specs.json`:
```json
Expand Down
43 changes: 28 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,26 @@ jobs:
"DYNWINRT_WIN32_WINMD=$($winmd.FullName)" >> $env:GITHUB_ENV
"DYNWINRT_REQUIRE_WIN32_METADATA=1" >> $env:GITHUB_ENV
- name: Test core library
run: cargo test -p dynwinrt-com-contracts -p dynwinrt
- name: Test borrowed-copy contracts on i686
run: cargo test -p dynwinrt-com-contracts --target i686-pc-windows-msvc
run: cargo test -p dynwinrt-com-contracts -p dynwinrt-win32-contracts -p dynwinrt
- name: Test native-independent contracts on i686
run: cargo test -p dynwinrt-com-contracts -p dynwinrt-win32-contracts --target i686-pc-windows-msvc
- name: Test borrowed-copy ABI on live i686
run: cargo test -p dynwinrt --target i686-pc-windows-msvc --lib borrowed_copy
- name: Test dynwinrt-codegen
run: cargo test -p dynwinrt-codegen
- name: Test Win32 binding boundaries and lifetimes
run: cargo test -p jswinrt_rs --lib win32
- name: Enforce flat Win32 coverage baseline
shell: pwsh
run: |
$json = cargo run -p dynwinrt-codegen --quiet -- win32-census `
--winmd $env:DYNWINRT_WIN32_WINMD --json
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$result = $json | ConvertFrom-Json
if ($result.eligible_functions -ne 18321 -or $result.complete_functions -lt 8936) {
throw "Flat Win32 coverage regressed: $($result.complete_functions)/$($result.eligible_functions)"
}
Write-Host "Flat Win32 coverage: $($result.complete_functions)/$($result.eligible_functions)"
- name: Test raw union MSVC C oracle (x64)
run: cargo test -p jswinrt_rs --features test-hooks com_raw::tests::msvc_c_union_oracle_executes_through_libffi -- --exact
- name: Test raw union MSVC C oracle (live i686)
Expand Down Expand Up @@ -274,6 +287,9 @@ jobs:
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
npm run build:entrypoints --silent
npm install --no-save tsx
- name: Test JS binding
working-directory: bindings/js
run: npm test
- name: Build Python binding
run: |
cd bindings/py
Expand Down Expand Up @@ -402,15 +418,12 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: dynwinrt
path: |
bindings/js/dist/dynwinrt.win32-x64-msvc.node
bindings/js/dist/dynwinrt.win32-arm64-msvc.node
bindings/js/dist/index.js
bindings/js/dist/index.d.ts
bindings/js/dist/winrt.js
bindings/js/dist/winrt.d.ts
bindings/js/dist/com.js
bindings/js/dist/com.d.ts
bindings/js/dist/com-projection.js
bindings/js/dist/com-unsafe.js
bindings/js/dist/com-unsafe.d.ts
path: bindings/js/dist/
if-no-files-found: error
- uses: actions/download-artifact@v4
with:
name: dynwinrt
path: ${{ runner.temp }}\dynwinrt-artifact
- name: Verify downloaded JS runtime artifact
shell: pwsh
run: node .\bindings\js\scripts\verify-runtime-artifact.mjs "$env:RUNNER_TEMP\dynwinrt-artifact"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ mono_crash.*
x64/
x86/
[Ww][Ii][Nn]32/
!tools/dynwinrt-codegen/contracts/win32/
!tools/dynwinrt-codegen/src/codegen/win32/
!tests/e2e/runners/win32/
!samples/js/win32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
[Aa][Rr][Mm]64[Ee][Cc]/
Expand Down
6 changes: 6 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

`dynwinrt` is a Rust-based runtime library that enables dynamic invocation of Windows Runtime (WinRT) APIs. Unlike static projections (PyWinRT, C++/WinRT), this library uses runtime metadata (.winmd files) and FFI (libffi) to call arbitrary WinRT methods without native code generation. It provides JavaScript (napi-rs) and Python (PyO3) bindings, plus a code generation tool (`dynwinrt-codegen`) that produces typed wrappers from .winmd files.

Classic COM and flat Win32 have separate JavaScript/TypeScript projections and
runtime subpaths. Flat Win32 DLL exports use an independent native ABI and
contract model; see [the Win32 architecture](docs/architecture/flat-win32-contracts.md).
Run `.\tests\e2e\e2e_test.ps1 -SkipBuild -Lang win32` for its E2E suite with
`DYNWINRT_WIN32_WINMD` pointing to the pinned Win32 metadata.

## Repository Structure

```
Expand Down
110 changes: 98 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading