Skip to content

Fix Windows node ids and text dialog initial focus (beta17 Dev Box findings) - #665

Merged
coneilen merged 1 commit into
mainfrom
coneilen-fix-form-validation-and-focus
Oct 8, 2026
Merged

coneilen merged 1 commit into
mainfrom
coneilen-fix-form-validation-and-focus

Conversation

@coneilen

@coneilen coneilen commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes two Windows form/dialog findings from Dev Box qualification of 0.1.78-windows.beta17 (4ab2fcf4) and documents a third as intended macOS parity: client-chosen node ids were a timestamp behind a constant 00000000-0000-4000-8000- prefix, and the Rename Loop dialog opened with keyboard focus on its frame, so typing did nothing until the Title edit was clicked.

Changes

  • Node ids (finding 2): Forms.generateDraftId now produces random RFC 4122 version-4 UUIDs (std.crypto.random, version/variant bits set) in Swift's uppercase uuidString form. DaemonClient.sendCreateNodeConfigured and the sendCreateNodeDraft fallback use it instead of the request-id timestamp helper, and the now-unused next_draft counter is removed. Request and client correlation ids are unchanged.
  • Rename dialog focus (finding 3): the shared GraphCodeWindowsDialog (WindowsNativeDialogs.zig) selects the first field's text on WM_CREATE, focuses it after presentation, and routes WM_ACTIVATE/WM_SETFOCUS to the remembered control (saved on deactivation). Window creation and presentation moved into createDialogWindow/presentDialog with no behavior change, so the test can drive the production path. This applies to every caller of the shared dialog, not only Rename Loop.
  • Empty-title New Loop (finding 1), no code change because this is intended macOS parity: macOS GraphcodeKit/Sources/Domain/NodeDraft.swift isValid says "No title requirement: makeNode falls back to "NewNode"" and only requires a title for composites (untitledFallback = "NewNode"). graphcode/Sources/Features/Project/ProjectFeature+NodeForm.swift then asks the backend for a title via TitleSuggestionClient, and graphcode/Tests/NodeDraftTests.swift asserts draft.makeNode().title == "NewNode". Windows Forms.validateNode already enforces the same composite-only EmptyTitle rule. The remaining gap is that Windows does not do the follow-up title suggestion yet. That is recorded in the ledger and left out of scope here.
  • investigation/ui-parity-matrix.md: Loop rename and Node creation sheet rows record the findings, the fix, and the evidence limits. No row changes status.

Test plan

All commands below ran from graphcode-windows with the bootstrap-pinned Zig 0.15.2 (.graphcode-tools\zig-0.15.2\zig.exe). The include path is .graphcode-tools\providers\winghostty\include. They ran on pre-rebase commit 48198b5d. The rebase onto main only brought in #662, which touches packaging/uninstall scripts and none of the files changed here.

RED: zig test src\Forms.zig --test-filter "zero-filled prefix" -> 0 passed, 1 failed (generated id is lowercase/zero-prefixed: expect at Forms.zig:881 failed); zig test src\DaemonClient.zig --test-filter "create-node wire" -> 0 passed, 1 failed (wire id starts with 00000000-0000-4000-8000-); zig test src\WindowsNativeDialogs.zig --test-filter "keyboard focus" -> 0 passed, 1 failed (TestExpectedEqual: GetFocus() returned a different HWND than the Title edit after ShowWindow activation)
GREEN: same three filtered commands -> 1/1 passed each (Forms, DaemonClient, WindowsNativeDialogs)
REGRESSION: zig test src\Forms.zig -> 159/159 passed; zig test src\Wire.zig -> 159/159 passed; zig test src\DaemonClient.zig -> 186/186 passed; zig test src\WindowsNativeDialogs.zig -> 15/15 passed; zig test src\NativeForms.zig -> 269/269 passed; zig test src\App.zig (full App link line) -> 891/891 passed; pwsh -NoProfile -File Tools\windows\Tests\WindowsShell.Tests.ps1 -> Windows shell scaffold contract: PASS (55 source files wired; 55 of 55 sections executed)

Evidence limits:

  • The focus test is in-process native-message evidence. It uses the real window class and WM_CREATE, ShowWindow/SetForegroundWindow activation, WM_SETFOCUS, and WM_ACTIVATE inactive/active. It does not send physical keystrokes, query UIA focus, or exercise a second app that steals foreground. The creator's Dev Box rerun of D6 (rename by typing) is still required.
  • The id fix is unit plus unstarted-client-queue evidence. No daemon round-trip or Dev Box create-node run was done after the change.
  • Tools\windows\validate.ps1 -Task windows-shell -SkipTrayLive did not complete locally: Pester 6.2 rejects its -Script parameter, and with Pester 5.7.1 it stopped at the Worktree Git fixture path budget (this worktree path is too long, as AGENTS.md warns), so WindowsShell.Tests.ps1 was run directly. Hosted CI is the authority for the full task.
  • make test / make check are macOS targets and were not run; this change is Windows-shell only.

Checklist

  • I have read the Contributing Guidelines
  • I have signed off my commits (git commit -s) per the DCO
  • Tests pass locally (make test) (macOS target, not run; Windows Zig roots above pass)
  • Code follows the existing style (make check) (macOS target, not run)
  • I added the test/contract before the implementation and observed the intended RED failure

Dev Box qualification of 0.1.78-windows.beta17 found client-chosen node
ids were a 48-bit timestamp behind a constant 00000000-0000-4000-8000-
prefix, and the shared GraphCodeWindowsDialog (Rename Loop) opened with
keyboard focus on its frame instead of the Title edit.

Node ids are now random RFC 4122 v4 UUIDs in Swift's uppercase form for
both draft and send-time generation. The dialog selects its first field
on creation and routes WM_ACTIVATE/WM_SETFOCUS to the remembered control.

The empty-title New Loop finding is intended macOS parity (NodeDraft
isValid has no title requirement except composites; NewNode fallback),
recorded in the parity ledger rather than changed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Colin Neilens <coneilen@microsoft.com>
@coneilen
coneilen merged commit a731589 into main Oct 8, 2026
24 checks passed
coneilen added a commit that referenced this pull request Oct 9, 2026
Record the 0.1.78-windows.beta18 candidate at 880e6a3 (#662-#665), its
local validation, package, custody and Dev Box handoff identities, and the
57/41 parity count. Move beta17 to history.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Colin Neilens <coneilen@microsoft.com>
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