Skip to content

Refactor JavaScript binding storage and COM value state - #154

Merged
leileizhang (lei9444) merged 5 commits into
mainfrom
lei9444-binding-refactor-pr
Sep 16, 2026
Merged

leileizhang (lei9444) merged 5 commits into
mainfrom
lei9444-binding-refactor-pr

Conversation

@lei9444

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

Copy link
Copy Markdown
Contributor

Current integration and validation

Reviewed head: e7c10ea6050fc0b0cc3b78f55a7e29b28c7dfa41. This merge incorporates main at 32b706eb881f69b4e5f6f3dc074dd779c748c47d, including merged #155, without rewriting the four previously published commits. The win32.rs resolution preserves independent retained storage, explicit COM input leases and Node-only Rc ownership while forwarding Env and preserving conditional prepared native cleanup errors, shared core resource owners, and #155's fallback/static recovery APIs. The seven-module native coverage guard and 45/70/18 percentage gates remain unchanged.

A fresh independent code-review agent reviewed this exact merge, both parents, and the remaining diff against the new main: no significant issues. A separate fresh agent then executed the repository samples, in that order.

Validation against main 32b706 Result
ARM64 production and test-hook builds Fresh independent baseline and candidate builds; strict JavaScript types passed on both.
Public API Production native exports (92), same-configuration test-hook exports (168), static/prototype descriptors, and seven normalized DTS files match the new main, including #155's new recovery APIs.
Generated output 185 package files plus five transaction-lock files are byte-identical across representative WinRT JS/Python/PYI, COM, Win32, and mixed output: 190 files, not APIs.
Selected production JavaScript Baseline: 89 passed. Candidate: 95 passed. Both reproduce the same two inherited ARM64 raw-union gates and two existing skips (test-hook-only recovery fixture and external WinUI fixture).
Targeted native regressions Binding baseline/candidate: 35/41 passed, with one existing ignore each. Exact COM input tests: 12/13 passed. Candidate core result/aggregate/consumption tests: 45 passed.
Test-hook JavaScript and recovery Baseline Win32: 30 passed. Candidate Win32/storage: 36 passed; final owned-return aggregate case also passed. Actual cleanup/alias/GC recovery and all three fallback self-failure probe modes passed on both artifacts.
Additional checks x64/i686 compile checks, Rust formatting, and coverage threshold/source-guard regressions passed. No fresh x64/i686 runtime or Clippy claim.

Samples: unresolved findings retained

The sample matrix covered 25 entries / 34 modes: 19 entries passed, three failed, and three were startup-only. This is not an all-green sample result. Original failures and subsequent controls remain recorded.

  • SMTC hidden --validate: sandbox child-process creation failed with GPU broker code 18 and fatal 0x80000003. Two controlled candidate/main/candidate rounds reproduced the GPU failure on both new-main runs and three candidate runs; the other candidate run failed with async 0x800702F7. A stable candidate-only regression was not established. The original broker Win32 error remains unavailable, and the async HRESULT is not that error. Neither a fix nor native memory corruption is claimed; --no-sandbox is not accepted as a repair.
  • Python WinUI Hello --smoke: access violation after printing success. Relevant source/core/Python/dependency-lock inputs match the new main, but no independent Python runtime baseline was executed, so pre-existing behavior is not proven.
  • Standalone JavaScript OCR: activation fails while the sample exits zero. This unresolved initialization/identity and exit-status issue is not attributed to this refactor without further evidence.

Post-push CI on the reviewed merge

Both workflows completed successfully on exact head e7c10ea6050fc0b0cc3b78f55a7e29b28c7dfa41:

  • Build: all five jobs passed, including E2E and the Win32 failed-cleanup recovery step.
  • Mixed-language coverage: passed; Rust 85.77%, Python aggregate 71.06%, and JavaScript aggregate 22.14%, above the unchanged 45/70/18 gates.

These are new-head results, not the earlier eea1649 green runs. They do not resolve or replace the sample findings above. No PR merge or auto-merge is requested.


Original publication record (historical)

The original sections below are preserved as evidence for the earlier 0130b3f baseline and publication, not as a fresh full matrix or review of the current merge.

Summary

  • Extract private, domain-neutral js_storage for backing-view retention and range, offset, alignment, identity, and detachment checks, preserving both existing retention strategies and domain-owned diagnostics and policies.
  • Replace positional DynWinRTValue state with named WinRT data, independent CallStorage, and COM sidecar groups for payload, provenance/owner, apartment, and deferred inputs. Win32 byte/string retention no longer uses the COM carrier; managed COM inputs remain explicit.
  • Split the native binding's lib.rs into responsibility-based modules, leaving 79 wiring/export lines, and update the architecture documentation.

This is a JavaScript native-binding internals refactor, not a codegen, core, or Python feature change. Native core IOCP/resource coordination and public JavaScript/DTS facades are unchanged by this layer. It preserves merged #152 and #153.

Existing validation

Recorded against the fresh main baseline 0130b3f284edc79e6b90478b230a82245baec49e; no builds or tests were rerun for this publication-only recovery. The latest base-sync validation was ARM64-only, and not all checks are green.

Area Recorded result
Production ARM64 Fresh baseline and candidate builds; public native exports, static/prototype descriptors, and normalized DTS identical; strict JavaScript types passed.
Generated output 231 representative generated WinRT JS/Python/PYI, COM, Win32, mixed code, and auxiliary files byte-identical to the new baseline: 231 files, not 231 APIs.
Candidate production JavaScript 166 passed; 2 inherited ARM64 raw-by-value-union gates also reproduced on the new baseline; 1 existing external WinUI-fixture skip.
Same-configuration ARM64 native test hooks Baseline: 117 passed, 2 gates, 1 ignored. Candidate: 125 passed, the same 2 gates, 1 ignored. All 8 new native tests passed.
DispatcherQueue and final artifact 9 DispatcherQueue checks passed. The coordinator independently ran 8 storage/CoreMessaging lazy-import checks on the final artifact; all passed.
Clippy Baseline: 45 errors. Candidate: 28 inherited errors, with no new diagnostic. Clippy is not green.

Earlier x64/i686 and full E2E runs are not presented as fresh executions on this baseline. No external WinUI/WinAppSDK or Python runtime coverage is claimed here.

Review

Independent read-only review and coordinator review found no significant issues. Replaying onto the new main resolved only a documentation conflict; all bindings/js/src bytes remained identical to the previously reviewed version. The three existing reviewed commits are published unchanged.

Centralize view inspection, extent and identity validation, retained typed views, and call-local bytes without changing domain validation order or IOCP lifetimes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep payloads, pointer provenance, apartment identity and deferred input bindings independent. Retain Win32 byte and string storage directly, separate from managed COM inputs and resource ownership.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Move runtime, metadata wrappers, values, containers, callbacks and utility exports into private modules. Preserve emitted JS class names and keep Win32 adapter retention explicitly Node-local while native resources remain Arc-owned.

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

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Mixed-language test coverage

Workflow status: ✅ Passed

Layer Lines Functions Branches/regions
Rust, including native .pyd/.node 85.77% 80.88% 85.28% 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

Require execution in the extracted WinRT, shared storage, and COM value modules instead of wiring-only lib.rs. Preserve conditional implementation guards and percentage thresholds, with missing-source and zero-hit regressions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve independent retained storage, COM input leases, and Node-only Rc ownership while forwarding Env through the merged call boundary and retaining prepared native cleanup errors. Add real owned-return/out and managed COM input integration regressions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@lei9444
leileizhang (lei9444) merged commit 3817e64 into main Sep 16, 2026
7 checks passed
@lei9444
leileizhang (lei9444) deleted the lei9444-binding-refactor-pr branch September 16, 2026 02:05
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