Migrate the Stats window to the shared XML/Lua window component
Parallel window migration, based on merged develop adde9d039997805fcd0090e4c75f63a8d8589449. Isolated worktree /home/mathias/Projects/worktrees/engines-client-lua-stats; branch feature/client-lua-stats. Siblings own player NCU and Nano Programs. This session owns Stats only. Shared prerequisite integration is now verified: user authorized this branch's fast-forward to merged bc39fd9b94499626b1b49941ea4bb6e3448c04d8 (PR2803). Private binary diff plus copies of nonignored untracked source were saved in ignored .dev-data/stats-before-bc39fd9b9; SHA-256 checks prove all four preparation files survived unchanged. Preserved-preparation baseline after integration: 62 passed, 3 original-asset skips with warnings as errors, including shared capabilities/window tests. User authorized local-only dependency integration of b54c7291008f41190247d48c841719cf3b727612. Saved private binary diff, eight nonignored untracked source files and a file-state manifest in ignored .dev-data/stats-before-b54c729. Own-branch fast-forward succeeded; all twelve file states, including deletions, survived unchanged. Added resizable=false to Stats Window.create while retaining flexible-height layout. Integration validation passes97 tests/3 original-asset skips, including the retained restored-height failure and shared content-sized cases. Stats is implementation-ready under the user/coordinator's clarified batch acceptance: functional regressions, mutation controls and generated contracts pass. Separate per-window Native AOT smoke projects are not a gate. No remote access, migration commit, push or PR permission. Outcome: Stats uses shared Core Lua Window and Lua-owned content/options, with a thin canonical native data adapter rather than a native presentation fallback. Preserve current name/unknown-value behavior, level/attack/AC readings, health/nano/XP/SK/alien/PvP bars, optional-bar toggles, expansion availability, tooltips, options-panel lifecycle, sizing, identity/preferences and native session visibility. Reuse LocalPlayerStatSnapshot, StatusReading and existing progression/domain computations; do not invent or translate stock-client code. Inspect UI/Windows/StatsPresenter.cs, UI/Layouts/Stats.xml, CharacterInterface.BuildStats and Stats-specific update/lifecycle paths, StatsPresenterTests.cs and existing status/tooltip tests. New domain contracts should be grouped in UI/Scripting/Contracts/Game/Stats.cs, private entries under Contracts/Components/Stats.cs if needed. Own only the relevant Stats integration hunks in CharacterInterface; do not reformat that shared file. Shared Core/runtime/widget-host/API attributes/generator/graphics/input/window manager/preference store/CI/AOT harness are coordinated centrally. Reuse their current capabilities without editing them independently. Confirmed shared requests at adde9d0: (1) ui.progress(widget: Widget, fraction: number), setting the owned retained bar Progress with [0,1] clamping and non-finite rejection; (2) ui.window.on_visibility(frame: Widget, callback(visible: boolean)), driven by native effective visibility changes including close/Escape/session hiding, without game-action activation, with callback replacement/disposal cleanup and no notification loop. Stats needs (2) to hide/deselect its options panel while retaining bar choices. LuaWidgetHost currently exports neither capability; LuaWindowServices has no visibility subscription. Do not relay Stats presentation state from CharacterInterface as a workaround. (3) Preserve initial frame alignment: Stats currently starts centered horizontally with a 10px top inset; Core Window.create unconditionally calls ui.window.place, which forces both alignments to Start. Request ui.window.align(frame: Widget, horizontal: string, vertical: string) with validated start/center/end values and retained offsets/bounds, or equivalent supported Core placement options. Resolved by PR2803: ui.progress, Window.create on_visibility, horizontal/vertical options and ui.window.align are integrated. Call LuaUiComponent.Refresh on every normal Stats update, including hidden/unchanged snapshots; do not add a CharacterInterface presentation relay. Report precise shared API needs and required semantics here/in chat; do not use direct native GuiView mutations or feature-specific bypasses as workarounds. Domain data/contracts and tests may proceed independently; mark blocked if a shared prerequisite prevents safe completion. Current local implementation: UI/Packages/Stats/content.xml retains the original content layout; main.lua composes shared core.window and owns text/unknown formatting, bar fill/visibility, choices, expansion availability, XP/SK tooltips and options-panel lifecycle. ScriptedStatsWindow is the thin adapter; Apply always calls Component.Refresh before hidden/unchanged gates. UI/Windows/StatsDataSource.cs emits generated StatsState/StatsValue/StatsBar records from grouped Contracts/Game/Stats.cs and a private three-argument stats_apply entry in Contracts/Components/Stats.cs. It reuses LocalPlayerStatSnapshot, StatusReading and PvpRankProgression unchanged. Deleted StatsPresenter and old Layouts/Stats.xml; migrated existing tests to ScriptedStatsWindowTests. CharacterInterface changes are Stats-only fields/build/apply hunks, with native window/session authority and scoped preference services, no presentation relay. Shared infrastructure and peer windows were not edited; no commits/pushes. Resolved sizing blocker: shared local commit b54c7291008f41190247d48c841719cf3b727612 supplies Window.create({resizable=false}), skipping native resize ownership while preserving initial Lua layout and native frame/session/persistence behavior. Stats has opted in; its retained RestoredPlacementAndPinDoNotFreezeTheContentDrivenHeight regression passes. No hardcoded heights, native presentation mutations or shared-infrastructure bypasses were introduced. Integration log: .dev-data/stats-sizing-integrated.log. Final local validation on b54c7291008f41190247d48c841719cf3b727612: ./run-client-tests.sh filter includes ScriptedStatsWindowTests, StatusBarPresenterTests, LocalPlayerStatSnapshotTests, LuaWindowComponentTests, LuaSharedCapabilitiesTests, LuaContentSizedWindowTests, ScriptedActionsTests, LuaActionsListTests, WindowEscapeTests, WindowResizeTests, UiWindowFactoryTests and UiLayoutPersistenceTests, with TreatWarningsAsErrors=true and WarningsNotAsErrors=NU1903:99 passed,3 original-asset skips,0 failed. Stats alone:23 passed/2 asset skips. Includes retained restored-height regression, canonical domains/unknowns/unsigned values, late names, unchanged-frame zero managed allocations, native close-button/Escape/session-hide options cleanup on unchanged snapshots, expansion availability, scaled/occluded tooltips, owned popup disposal and stale input handler no-op. Instrumented copy of the real Stats package proves unchanged snapshots do not enter stats_apply and changed hidden snapshots are deferred until reopening. Deliberate cache-gate mutation fails apply-count assertions; removing Refresh fails native-hide lifecycle; removing disposal fails popup cleanup. All mutations restored before final validation. Generator --self-test and git diff --check pass. Shared UI harness managed compatibility probe (dotnet run --project PRK.Client/PRK.Client.UI.AotTests -c Release -p:PublishAot=false -- --shared-capabilities) passes with current contracts/package; dynamic code=True, NOT a Native AOT claim. Native StatsDataSource lives beside ScriptedStatsWindow, avoiding accidental game-domain dependency injection through the shared harness's Scripting/*.cs source-link wildcard. No shared harness edits or full publishes. Coordinator handoff / clarified acceptance: user and coordinator agreed that separate per-window Native AOT smoke projects are NOT a hard gate for this batch. Shared runtime/bindings have prior AOT validation; this session claims only the recorded managed compatibility probe, not Stats-specific AOT execution. Functional acceptance and regression/mutation validation are satisfied, so Stats is implementation-ready with no remaining shared-capability blocker. A combined full-client Native AOT publish after local integration will be coordinated separately; it remains unexecuted here, not a prerequisite for marking this implementation ready. Do not expand/edit the common harness, add suppressions or launch duplicate publishes. Public Stats contracts are already included by recursive contract discovery and the package by the existing package glob; adapter/domain math currently has managed test coverage only. No unchanged test reruns or source changes were made for this scope clarification. PRK_GUIROOT is unset, so original-asset rendering skipped; Windows/macOS/live game rendering unexecuted. Existing shared guide PRK.Client/UI_XML.md still names old Layouts/Stats.xml and StatsPresenterTests at lines177/203; left untouched under narrow ownership, coordinator can update those references. Logs: ignored .dev-data/stats-sizing-integrated.log, stats-acceptance-initial.log, stats-mutation-snapshot-gate.log, stats-mutation-lifecycle-cleanup.log, stats-final-targeted.log and stats-shared-managed-compatibility.log. No remote Git/Gitea access, migration commit, push, PR, peer-worktree edits or additional merge was performed. Acceptance: Stats presentation/frame/options are XML/Lua-owned with no parallel native Stats presenter; existing domain facts/window behavior preserved; meaningful real-input and snapshot/lifecycle/cleanup regressions pass, unchanged snapshots do not allocate or enter Lua unnecessarily, contract-generated docs/build remain valid. Relevant targeted client tests required; coordinate common AOT coverage rather than modifying the shared runner or creating duplicate frameworks. Do not call complete if prerequisites or acceptance remain unmet. No commit/push/PR/rebase/merge permission granted; hand off local changes, evidence and limitations. Keep private tracking metadata out of repository/team artifacts.
Checklist
3 of 3 complete- Audit Stats behavior and existing Lua capabilities; identify shared prerequisites without editing common infrastructure.
- Migrate Stats frame/content/options to XML/Lua with canonical native data and no parallel native Stats presentation.
- Verify real-input/status/lifecycle/cleanup regressions, allocation gating and generated contracts; coordinate AOT coverage and record remaining blockers.
- Area
- Project Rubi-Ka
- Project
- engines
- Kind
- Feature
- Task ID
tsk_sur784eg27- Updated