Migrate client chat presentation to Lua with bounded scrollback rendering
Plan and implement Lua-owned chat presentation without history-proportional steady-state UI work. Preserve chat commands, conversations, subscriptions, docking, preferences, rich links/images, selection/copy and logging. Reuse existing Lua packages, generated contracts and native text layout/rendering. Design direction: stable session-scoped message IDs and ordering, incremental feed updates, semantic sender/channel/body data rather than flattened prefixes, Lua formatting into bounded declarative rich-line descriptions, and a native variable-height virtualized log. Cache presentation separately from width-dependent layout; idle/scroll must not call Lua formatters. Selection/copy and scroll anchoring use message IDs, not widget indices. Keep commands, markup trust and link execution native. Existing combat lockdown blocks structural widget mutations; new scrollback must explicitly support native text/layout updates during combat without weakening protected actions. Measure exact-height rebuild cost before choosing synchronous versus paced reflow; ordinary appends must not rescan history. Existing logs run from presenter rebuilds; move ingestion/logging off visibility/rendering. Extend the design with a typed, read-only combat observation stream shared by Lua chat presentation and community meters/parsers, evolving ClientCombatLog rather than introducing a parallel bus. Do not export raw object Message/protocol classes. Specify stable session-scoped IDs/order, explicit unknown attribution and amount semantics, no double counting across wire reports, bounded batch delivery on the UI thread, subscription teardown, and explicit gap/reset notifications for lagging consumers. Consumers aggregate independently of chat retention; never fabricate complete encounter data from locally observed events. Observer callbacks grant no command authority. Implementation authorized. Implemented and verified the combat-observation foundation: shared bounded ring/cursors, typed Lua observation contracts, independent UI-thread delivery (including hidden Actions/item-container packages), and a Lua meter available through /damagemeter. Client tests pass with warnings as errors: 4,141 passed and 185 conditional skips. Native Lua release/sanitizer tests, generator self-tests and Native AOT UI acceptance pass, including the actual Lua meter. Regression mutations confirmed failures for reconciliation double counting, reflect attribution, repeated death reports and cross-package failure propagation. Controlled Release polling probe against the original HEAD source: warm idle reads with 500 retained events allocate 0 bytes versus 144 bytes per original poll; this is not a full client/frame-time benchmark. The user subsequently confirmed visual and behavioral verification on all platforms. Native CombatEvent.Message is decoded into semantic presentation facts by native projection; Lua never receives packet objects. Implemented the first actual chat migration slice on feature/lua-chat-presentation: live Chat Lua content layout, semantic sender/channel/body composition with native validated rich parts, bounded batch-scoped line handles, cached presentation and explicit ui.chat.invalidate; native input, commands, docking and preferences remain authoritative. Sources now use stable IDs, immutable retained histories and incremental changes; clear/logging/selection no longer match timestamps or text, and hidden panes ingest subscribed logs. Native cached link hit boxes translate on position-only movement and clear on rich-to-plain changes. Oversized native input flattens/shortens safely and retained-text exhaustion uses an omission row without disabling input. Regression tests cover mutable subscriptions, same-time notice/feed ordering, width-only bottom following, shifted/removed links, and oversize input. Verified this slice: 4,153 client tests passed (185 conditional skips), 711 graphics tests passed (1 conditional skip), native Lua release/sanitizer tests, API generator self-tests and Native AOT acceptance including chat composition. Independent final patch review found no actionable issues; review itself was static. Controlled Release probe with 500 retained lines, identical current source storage/graphics for both presenters, tiering disabled: rich append+layout allocated about 283 KB versus 14.2 KB per event; idle candidate presentation allocated zero. This is not a whole-game/frame-time benchmark. The first-slice width-reflow probe measured roughly 4–6 ms per 500-line pane. The completion work now uses an indexed virtual text document: only visible/overscan rows are attached to the GUI tree; selection/copy use logical message identities; scroll anchors survive eviction and reflow; visible rows are measured first with at most 24 background rows processed per layout pass. Lua now owns window chrome, docking tabs, configuration, context menus, output indicators and combat wording/template selection. Chat and floating text share a bounded per-event Lua wording cache. Legacy chat-configuration XML and native combat presentation branches are removed. Completion is implemented and verified locally. Final validation: 4,156 client tests passed (185 conditional skips), 711 graphics tests passed (1 conditional skip), native Lua release/sanitizer tests, generator self-tests and Native AOT acceptance passed, including physical Lua configuration input, window/menu integration, virtualized offscreen copy and Lua combat wording. Regression mutations demonstrated failures when logical selection, identity-based anchoring, Lua tabs or Lua combat formatting were bypassed. Controlled warm-process Release comparison against the committed first-slice presenter, with identical source storage/Lua composer/graphics and tiering disabled: 500 logical rows materialized about 13 GUI rows; resize steps fell from roughly 7.8–8.8 ms to 0.19–0.20 ms; cold population/layout fell from roughly 12–18 ms to 5 ms; append+layout CPU fell from roughly 58–65 us to 32–37 us. Idle remained allocation-free; row-model overhead adds a small per-message allocation cost while resize/viewport work is bounded. This is a synthetic probe, not whole-game FPS or Windows validation. Documentation is synchronized. No reviewer was run for the completion work, as requested. The user confirmed that the completed migration was tested on all platforms and looks and behaves correctly. This cross-platform verification is user-reported, in addition to the automated validation above. Session work is committed on feature/lua-chat-presentation: d17ffcefa (combat observations) and 5a167ffb4 (Lua chat presentation). The SSH publication blocker is resolved; the branch is pushed with upstream tracking. The complete two-commit branch comparison received a completed static review with no actionable findings; client validation was rerun successfully on the committed head. Completion is committed as a270dd503 (feature: Complete Lua chat and combat log migration) and pushed on feature/lua-chat-presentation. PR #2863 now contains the complete migration and is marked ready, with the updated implementation and validation summary. Acceptance: built-in chat UI is Lua-owned; line appearance and composition are customizable without per-frame Lua formatting; retained history is bounded; ordinary append/scroll work does not rebuild all history; offscreen text remains selectable/copyable; existing player-facing behavior and saved layout survive. Compare controlled baseline and candidate workloads before claiming performance improvements. PR #2863: https://git.project-rk.com/prk/engines/pulls/2863 — feature/lua-chat-presentation → develop. Implementation and publication are complete. The user accepted the review step as complete for this session and will handle any review separately; no reviewer was run for the completion work.
Checklist
6 of 6 complete- Capture controlled baseline and prototype costs for append, scroll, cold-open and variable-height resize; choose reflow policy from measurements.
- Deliver and verify the shared combat-observation foundation: independent native/Lua cursors, semantic filtered batches, UI-thread delivery while hidden, gap/reset reporting, observer isolation, and Lua meter independent of chat retention.
- Implement semantic stable-ID chat stream and incremental pane projections; preserve ordering, subscriptions, clear and visibility-independent logging.
- Implement bounded Lua line descriptions and native cached virtual scrollback with stable selection, links, scroll anchoring and combat-safe updates.
- Migrate chat windows/configuration and presentation to Lua, preserving docking, conversations, input, preferences and document/log readers; remove replaced presentation code.
- Verify player-facing regressions and compare baseline/candidate performance on identical workloads; run client, graphics and Lua validation.
- Area
- Project Rubi-Ka
- Project
- engines
- Kind
- Feature
- Task ID
tsk_gjvcu3qypc- Updated