Compose Actions with a reusable Lua window frame and generic native window capabilities
Approved next stacked slice above origin/feature/client-lua-actions at6045f8f02 (draftPR2797). Worktree /home/mathias/Projects/worktrees/engines-client-lua-windows; branch feature/client-lua-window-components. Original and prior worktrees untouched. User wants implementation of the discussed shared XML/Lua Window component, preserving appearance and behavior and eliminating Actions-specific native menu -> SetViewMode -> Lua actions_mode -> native sizing/persistence round trip. User explicitly requested opening the PR. Committed as7fe097568 (feature: Compose Actions with reusable Lua window components), pushed origin/feature/client-lua-window-components and opened draft stackedPR2802 at https://git.project-rk.com/prk/engines/pulls/2802 targeting feature/client-lua-actions. Worktree clean; do not mark ready/merge automatically. Lua/XML owns frame composition, title/buttons/menus, presentation/mode, sizing policy and remembered presentation state. Native owns rendering/layout, pointer capture and drag/resize mechanics, focus/stacking/session availability, validated geometry/ownership/resource limits and scoped persistence storage. Input still uses protected generic native->Lua callbacks. Shared components execute in the consuming package VM, not a VM per widget. Introduce bounded shared-module loading without exposing standard filesystem/package/native loaders. Generic registration accepts explicit relevant handles rather than searching for hardcoded close-button names. Do not move drawing loops/pointer-move loops into Lua or retain a parallel native Actions presentation/frame path. After user squash-merged PR2797 and retargeted PR2802 to develop, user explicitly approved restacking and force-with-lease. Rebased only7fe097568 onto origin/develop57e8d0a92, producing974da3e7b. git range-diff confirms the feature patch is identical. Pushed with explicit lease requiring remote7fe097568; PR2802 was subsequently merged into develop by the user; verified hasMerged=true, mergedAt2026-10-21T21:18:06Z. Future work must branch from current develop, not either old feature branch. Full client suite rerun on rebased head3997 passed/180 skipped/0 failed; native/AOT prior results not newly rerun or misrepresented. PR body updated to current base/validation. Worktree clean. Local safety branch chore/backup-lua-windows-before-restack-7fe097568 retains old commit. Do not push obsolete histories from old worktrees. Do not push obsolete old Lua worktree history. Original checkout/prior worktrees untouched. Architecture: LuaUiComponent now owns protected runtime/widget lifetime, bounded Core/package script loading, diagnostic/cleanup and generic calls. ScriptedActionsWindow is a thin canonical-data/command adapter; no IUiListView, SetViewMode/Restore/Capacity relay, mode/sort native entries or state-observer callbacks remain. CharacterInterface.BuildActions supplies scoped native services and explicit close/pin handles; it no longer builds the frame, attaches a list-mode menu, configures grid/list sizing or persists presentation state. ApplyActions only forwards canonical snapshots. Native window registration/escape/unregister/pin persistence use explicit control handles while legacy windows retain their old default paths. Shared Core package contains modules.lua (64 bounded per-VM definitions, cached factories, cycle/unknown-module refusal, no filesystem/native loader), window.lua/window.xml (replaceable package-local template option, title/content/buttons/menu, native input hooks), icon_grid.lua (reusable geometry policy). Actions/main.lua owns mode, snapping/free sizing, entry capacity, sorting and persistence. ui.require('core.window') composes a reusable window without a VM per widget. Renderer remains native using existing retained Window primitive; legacy native windows still use old layout/factory as an incremental migration boundary, not a second Actions implementation. Generic capabilities in LuaWidgetHost.Windows.cs/Menus.cs: owned shared layouts, bounded size/maximum/selection/window bounds/resize callbacks/placement/close, bounded menus/checkmarks/separators and scoped scalar preference access. Native callbacks use reusable geometry argument buffers; native popup callbacks grant no game-action activation. Close/popup/storage operations defer until Lua returns through the bounded notification queue; deferred exceptions become package failures. Menu ownership is per-anchor, stale callbacks refuse invocation, disposal cannot close another package's menu, and unavailable/session-hidden owners dismiss popups. Native root visibility remains authoritative; ui.visible cannot override a managed root. Runtime faults preserve native visibility and a safe diagnostic/close path rather than reviving hidden windows. UiLayoutStore.Scripting.cs implements bounded local scalar paths in the host-assigned window identity, preserving nested archive siblings and original bool/int/text kinds. Lua chooses the field names; Actions reads/writes existing listview_config fields, preserving old mode/sort without migration or native mode policy. Root geometry/open/pin state still uses native persistence. API generator adds bounded UTF-8 string result emission for preference reads; no runtime reflection or bridge ABI change. Generated35 exports,1 projected Action record,2 public callbacks and1 private native snapshot entry;8 Markdown pages incl ui-window/ui-menu/ui-preference. Core module/component API guide in Core/README.md; author/package docs updated. Validation: initial shared-component regression observed red (ui.require absent). First integration caught the old content-only test's implicit initial-capacity assumption; changed it to drive the actual window resize before testing padding, preserving behavior assertions. Final whole-client run3994 passed/180 skipped/0 failed with compiler warnings-as-errors. Native8/8 Release+8/8 ASan/UBSan, generator self-tests and BOTH published Linux x64 NativeAOT executables pass. Actual AOT UI proof now clicks Lua title-menu entries and headers through native input, transitions modes, verifies identities/commands/cleanup and zero allocations over1000 unchanged snapshots; removed direct native mode/sort setters. New component tests cover independent windows and preferences, popup ownership across disposal/logout, close/reopen/Escape, native pointer dragging/free resizing, restored native pin state, cached/cyclic/unbundled modules, reusable frame composition and fault diagnostics that cannot reopen a hidden window. Existing Actions/special/perk/input/window/persistence tests remain green. Synthetic list PNG visually inspected; no game-art/live client visual parity or Windows/macOS execution newly claimed. No new whole-client AOT publish claimed. Evidence: .dev-data/lua-windows/{initial-red,first-integration,integration-second,full-client-final,native-aot-final}.log; PNG under .dev-data/test-results/client/Deploy_ 20261021T202218_185/In/lua-actions-list.png (synthetic resources). Both AOT artifacts in .dev-data/native-lua/container/. Published Core files and8 API pages verified; all local doc links valid, no generator/Roslyn payload; XML/project syntax and git diff whitespace checks pass. Platform/live testing and review/remote CI remain explicit next gates. User-authorized commit/push/draft-PR creation completed; prior validation was not rerun for this publication-only operation. No merge or ready-state change performed. Other native windows migrate incrementally. Avoid broad visual redesign, addon manager, renderer rewrite, speculative future APIs or changing game/wire behavior. Maintain attribute-driven generated API/docs and domain-grouped contracts.
Checklist
3 of 3 complete- Implement shared Lua/XML window composition and bounded per-package modules with generic owned window, menu, geometry and scoped preference capabilities.
- Verify independent windows, real menu/button/resize input, persistence, lifecycle/failure safety, generated docs and Native AOT/client regressions.
- Migrate Actions to the shared frame and Lua-owned mode/sizing/persistence; remove native Actions-specific relay and preserve window/input behavior.
- Area
- Project Rubi-Ka
- Project
- engines
- Kind
- Feature
- Task ID
tsk_mqjsqg4brg- Updated