Skip to content

Add native HMENU evidence for sketch promotion submenu - #494

Merged
coneilen merged 3 commits into
scgopi:mainfrom
coneilen:coneilen-microsoft-sketch-promotion-native-menu
Sep 27, 2026
Merged

coneilen merged 3 commits into
scgopi:mainfrom
coneilen:coneilen-microsoft-sketch-promotion-native-menu

Conversation

@coneilen

Copy link
Copy Markdown
Collaborator

Adds native HMENU evidence for sketch promotion. Test-only: there is no production change.

Why this was a real gap

Two existing tests bracketed the hole without covering it. The sketch-promotion test at GraphContextMenu.zig:431 is plan-only, calling promotionItems / promotionEnabled / promotionTarget without ever invoking buildMenu, so no menu is created. The native test native node menu variants expose only eligible actions does build a real menu, but only sets composite, can_arm, follows_template and unwired, and never sets sketch, so it never builds the "Promote to..." submenu.

Nothing built a real native menu containing the promotion submenu.

What the test proves

The new test calls the same private buildMenu used by show, attaches the popup to a hidden real HWND, and asserts the full three-state matrix produced by the production gating:

  • not a sketch: the submenu and all three promotion commands are natively absent
  • sketch with no captured context: the submenu is present and Goal, Turn and Timed are all grayed
  • sketch with a captured context: the same three commands are enabled

It also pins the exact three command IDs, ordering, captions, submenu title, and command mapping. The present-but-disabled state is the one a plan-only test cannot demonstrate.

Scope

App.zig, MainWindow.zig, GraphCanvas.zig, Sidebar.zig, the test runner and the providers are all unchanged. The diff is 77 added test lines with zero deletions, plus a single ledger row.

Ledger row 100 stays Partial: only the native HMENU/HWND clause is retired. The test does not show or select a popup and does not exercise keyboard, UIA, app launch, or real-daemon acceptance and persistence, so those clauses remain.

RED: zig test src\GraphContextMenu.zig -target x86_64-windows-msvc -lc -luser32 --test-filter "sketch promotion production popup" (deliberately mutated item-count expectation 4) -> expected 4, found 3; 0 passed; 1 failed.
GREEN: zig test src\GraphContextMenu.zig -target x86_64-windows-msvc -lc -luser32 -> All 176 tests passed.
REGRESSION: zig test src\App.zig -target x86_64-windows-msvc -lc with provider and VT libraries -> All 647 tests passed.

coneilen and others added 3 commits September 27, 2026 13:19
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Colin Neilens <coneilen@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Colin Neilens <coneilen@microsoft.com>
Signed-off-by: Colin Neilens <coneilen@microsoft.com>
@coneilen
coneilen merged commit 5282652 into scgopi:main Sep 27, 2026
10 of 11 checks passed
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