Skip to content

fix(classic): reach members an interface inherits from its required interfaces - #31

Merged
triniwiz merged 1 commit into
mainfrom
fix/classic-inherited-interface-members
Oct 22, 2026
Merged

triniwiz merged 1 commit into
mainfrom
fix/classic-inherited-interface-members

Conversation

@triniwiz

Copy link
Copy Markdown
Member

On the classic engine, an interface wrapper only had the members its own interface declares. An IAsyncOperation<T> therefore read Status, ErrorCode and Cancel() (all declared on IAsyncInfo, which it requires) as undefined. The napi engines already resolve members across the interface tree. NSWinRT.toPromise kept working because it falls back to the Completed handler when Status is unreadable.

Changes

runtime/src/lib.rs:

  • install_interface_prototype_members now also installs the members of every required interface, recursively, each called through that interface's own IID and type arguments. The interface's own members take priority over inherited ones with the same name.
  • The parent members installed before them used to skip only the interface's own names. They now skip every name in the interface tree, so no name gets a second prototype slot (V8 aborts on a repeated descriptor).

Tests

  • New test-app/app/tests/winrt-async.js: NSWinRT.toPromise on IAsyncOperation<T> and IAsyncAction (result, undefined, rejection). Operations are not thenable, so await Promise.resolve(op) is the operation itself. Status and Cancel are readable, and Status is 1 once the operation completes.
  • windows-napi/test/async-test.js: the same checks on the napi path.

Results:

  • pwsh test-app/run.ps1 (classic): 89 passed, 0 failed. Before the fix, the Status spec failed with Expected "undefined" to be "number".
  • windows-napi npm test: 427 passed, 0 failed across 21 suites.
  • Not run: the test app on a napi engine DLL.

…nterfaces

An IAsyncOperation<T> wrapper on the classic engine only had the members
IAsyncOperation declares, so IAsyncInfo's Status, Cancel() and ErrorCode read
as undefined. The napi engines already walk the interface tree.

Interface wrappers now install the members of required interfaces on the
prototype too, each called through its own IID, with the interface's own
members taking priority. The parent members installed before them skip every
name in the tree, so no prototype slot is added twice.

Adds a winrt-async spec to the test app and NSWinRT.toPromise checks to the
napi async test: results, rejection, operations staying non-thenable (a promise
keeps the operation itself), and the inherited IAsyncInfo members.
@coderabbitai

coderabbitai Bot commented Oct 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a6924fb4-25e7-49c4-beed-e373b9c9a62d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@triniwiz
triniwiz merged commit 4ad1bf2 into main Oct 22, 2026
4 checks passed
@triniwiz
triniwiz deleted the fix/classic-inherited-interface-members branch October 22, 2026 07:34
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.

1 participant