Skip to content

Fix WinRT collection bulk element strides - #158

Merged
leileizhang (lei9444) merged 2 commits into
mainfrom
lei9444-winrt-collection-layout
Sep 18, 2026
Merged

leileizhang (lei9444) merged 2 commits into
mainfrom
lei9444-winrt-collection-layout

Conversation

@lei9444

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

Copy link
Copy Markdown
Contributor

Summary

  • Use native element widths for IVector, live and snapshot IVectorView, and IIterator GetMany, and for ReplaceAll inputs.
  • Preserve HSTRING and nullable COM-reference lifetimes.
  • Add typed regression coverage for native element sizes, counts, snapshots, cursor progression, and ownership.
  • Harden the production native-import test's diagnostic reports without changing its timeout or DLL-isolation assertions.

Collection validation

The following validation was already performed on the exact collection source change in the parent regression session; no builds or collection tests were repeated solely for publication:

  • cargo test -p dynwinrt --lib vector:: --no-fail-fast: 18 x64 tests passed.
  • cargo test -p dynwinrt --lib map:: --no-fail-fast: 4 tests passed.
  • cargo test -p dynwinrt --lib vector::bulk_tests --target i686-pc-windows-msvc -- --test-threads=1: 4 tests passed.
  • Production JavaScript build and Python wheel build passed.
  • Ordinary JavaScript/Python enum-vector APIs now return GetMany=[1,9], matching GetAt.
  • Previously generated Uri/DataWriter wrappers still pass.
  • Formatting and diff checks passed.

Initial publication checks confirmed a clean cherry-pick of 4201129b54224e1525fd42a11674293eebc2491c, preserved commit trailers, identical source files, and exactly the three intended collection files, with no Python changes. The subsequent CI correction changes only bindings/js/__test__/native-imports.spec.ts and its related README documentation.

Native-import CI correction

Build run 35220988235 passed both production architecture builds and the PE import check, but the root fresh-process probe exceeded its 10-second limit. The COM probe passed. The old failure message masked captured stderr when a spawn error existed and did not identify the stalled phase. The hosted timeout was not reproduced locally, so neither DNS nor cold-addon loading is asserted as its proven cause.

The follow-up enables process.report.excludeNetwork when supported, avoiding irrelevant network-interface enumeration and DNS while preserving sharedObjects collection. Node documents support from 20.13/22; feature detection preserves the full check on older versions. Synchronous, bounded phase messages identify the before-report, require, and after-report stages, and failures retain status, signal, spawn error, stdout, and stderr. Fresh root/COM processes, the 10-second timeout, all isolation/export/addon assertions, and PE checks for every built architecture remain intact. No retries or skips were added.

Focused local validation used Node 24.18.0, not CI's 24.20.0, and a previously built production x64 addon whose runtime/binding source exactly matches this PR; no native rebuild or manual CI rerun was initiated:

  • Original import suite: 3 passed. Corrected npm run test:imports: 4 passed, including a new timeout-diagnostics regression.
  • Fixed 12-process measurement matrix: report stages approximately 49–81 ms each, native import 12–121 ms, total 226–352 ms. This does not justify increasing the timeout.
  • Eight bounded controls exercised the actual changed root probe: supported network exclusion, unavailable-option compatibility, rejection of introduced CoreMessaging, rejection of a missing addon/export, and a forced timeout in each of the three stages. All produced the expected results and phase diagnostics.
  • Targeted strict TypeScript, oxlint, test-file Prettier, and git diff --check passed. README whole-file Prettier differences predate this change; unrelated code-fence formatting was left untouched.
  • Local PE validation covered the available x64 production artifact; the unchanged all-artifact loop will inspect both x64 and ARM64 in CI.

The pushed follow-up requires fresh CI results; the local checks are not a claim that CI has completed successfully.

Known limitation

The broader i686 vector suite has a pre-existing large-struct test crash, reproduced on untouched preview.21. This PR does not claim that the entire i686 suite is green; that issue is outside its scope and is unrelated to the native-import timeout.

This PR is independent of the Python annotation PR, is based directly on main, and can merge in either order.

Use native element sizes for vector, view, and iterator bulk outputs and ReplaceAll inputs. Add typed collection and ownership regression coverage for value, string, and nullable interface elements.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: bdea384f-3022-47e8-8c74-11fd768c2105
@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Mixed-language test coverage

Workflow status: ✅ Passed

Layer Lines Functions Branches/regions
Rust, including native .pyd/.node 85.81% 80.94% 85.34% regions
Python aggregate 71.06% n/a 37.9% branches
Python runtime 99.12% n/a 97.37% branches
Generated Python WinRT projections 70.05% n/a 27.07% branches
Generated Python WinRT implementations 72.29% n/a 47.04% branches
JavaScript aggregate 22.14% 25.21% 57.88% branches
JavaScript runtime 44.27% 45.76% 78.99% branches
Generated WinRT projections 22.97% 18.71% 54.94% branches
Generated WinRT implementations 48.66% 59.76% 61.14% branches
Generated Classic COM projections 11.92% 23.97% 54.2% branches

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

Exclude irrelevant network collection from loaded-DLL reports when supported and retain bounded phase timings on failures. Preserve the existing fresh-process checks, DLL isolation assertions, all-artifact PE inspection, and 10-second timeout.

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

Copilot-Session: 1e44905d-3d1b-4504-872b-e51823f26261
@lei9444
leileizhang (lei9444) merged commit 4cd589c into main Sep 18, 2026
24 checks passed
@lei9444
leileizhang (lei9444) deleted the lei9444-winrt-collection-layout branch September 18, 2026 03:31
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