windows-reactor uniform typed constraints - #4971
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The metadata inference, generated APIs, attachment typing, samples, and coverage are internally consistent.
Review effort: Balanced
Findings: None
What changed in this PR
Adds metadata-derived compile-time constraints for narrow WinUI collections while preserving control types through attachments.
Changes:
- Generates typed
Keyed<T>collection APIs. - Adds
AttachedView<T>for typed attachments. - Updates generated surfaces, tests, samples, docs, and API snapshots.
| File | Description |
|---|---|
docs/crates/windows-reactor.md |
Documents typed collections. |
crates/tools/reactor/src/winui.toml |
Removes manual command allowlists. |
crates/tools/reactor/src/schema.rs |
Infers accepted controls. |
crates/tools/reactor/src/metadata.rs |
Resolves type assignability. |
crates/tools/reactor/src/generate.rs |
Generates typed wrappers and methods. |
crates/tools/reactor/src/generate_surface.rs |
Generates typed surface coverage. |
crates/tests/libs/reactor_surface/src/generated_surface.rs |
Updates generated surface cases. |
crates/samples/reactor/gallery/src/pages/menus/selector_bar.rs |
Uses typed keys. |
crates/samples/reactor/gallery/src/pages/menus/menu_bar.rs |
Uses typed menu items. |
crates/samples/reactor/app-bar-icon/src/main.rs |
Demonstrates heterogeneous commands. |
crates/libs/reactor/src/generated.rs |
Adds generated typed collection APIs. |
crates/libs/reactor/src/element.rs |
Adds generic keys and typed attachments. |
crates/libs/reactor/src/core/pump/tests/tooltips.rs |
Adapts tooltip tests. |
crates/libs/reactor/src/core/pump/tests/slots.rs |
Adapts typed slot tests. |
crates/libs/reactor/src/core/pump/tests/menus.rs |
Adapts menu attachment tests. |
crates/libs/reactor/src/core/pump/tests/flyouts.rs |
Adapts flyout tests. |
crates/libs/reactor/src/core/pump/tests/content_dialogs.rs |
Adapts overlay test. |
crates/libs/reactor/public-api.txt |
Records the new public surface. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Rafael Rivera (riverar)
approved these changes
Sep 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This builds on #4970's compile-time validation for icon views by applying the same idea to WinUI collections with narrow item contracts. Reactor now derives accepted controls from metadata and generates typed keyed collection APIs for SelectorBar, MenuBar, and CommandBar, so incompatible views fail to compile instead of reaching native insertion and aborting with E_NOINTERFACE; typed attachments preserve the control type through menus, tooltips, and flyouts without adding runtime checks or manual allowlists.