Migrate Inventory and all InventoryPresenter container windows to shared Lua UI
USER-AUTHORIZED CLEANUP: Inventory worktree was clean at pushed2e6ded8bf with0 ahead/behind upstream. Archived112 selected validation/evidence/source files and branch/HEAD manifests under /home/mathias/Projects/worktrees/lua-window-worker-archives/inventory-grid-20261022T161756Z/inventory/. Closed Herdr workspace w1B (Inventory agent and testing shell) and removed engines-client-lua-inventory without force. Local branch refs, remote branch/PR2808 and global Pi transcript retained; PR was not merged/closed/edited by cleanup. Other Lua shared-grid session/worktree also retired. No remaining Lua task worktrees; original checkout/unrelated projects untouched. Historical worktree paths below no longer exist; use the archive and pushed commits for continuation. CURRENT USER-APPROVED REFACTOR (after published follow-up d79e0abd5): simplify the actual boundary before merging PR2808. Current ScriptedItemContainerWindow combines Lua/window lifetime, projected slot/token caches, native item lookup, reverse widget lookup/hover scans, selection/split feedback and validation. IItemSlotSurface.GetItem returns ItemSlotBinding containing GuiView; transaction item resolution therefore depends on a rendered widget. This is a migration seam, not a requirement of Lua. Public WoW Container APIs/ItemLocation were researched as an architectural comparison only: logical container+slot addressing independent of frames, item operations below Lua, event-driven presentation; its native implementation is not public and no LoC/security equivalence claim was made. Do not copy WoW code or its combat/taint system. Goal: native logical container/session/location data and transaction validation independent of GuiView/Lua layout; one generic widget-to-logical-location binding/input seam; thin scripted presenter consuming canonical snapshots and generic interaction-state changes. Keep batched snapshots/allocation gating rather than blindly copying per-slot pull calls. Resolving an item/location must work without a rendered frame; hover/input resolve actual hit views once through generic bindings, without ViewWithBinding reverse scans/per-window table_scroll name checks. Preserve separate native container epochs versus GUI gesture lifetime: sorting/recreating widgets must not change logical location identity, while stale captures/close/reopen/character/bank arrangement changes still invalidate unsafe actions. Canonical item reads must not return GuiView. Cursor/drag/split/pending/game rules stay native. Selection/split presentation should consume native facts without another per-window authoritative state machine. Empty exact slots and container-level first-free drop intent should be expressible without UI-name knowledge in C# game/data adapters. Do not merely move the same code into more files or weaken/remove identity/revision/current-item/activation checks to hit a LoC target. Refactor the widget-oriented ItemInteractionController contract enough to make the split real, preserving all server semantics and published regressions. Legacy Wear/trade view adapters may use generic UI mapping but native transaction/model resolution must not require reverse UI lookup. Reuse shared Core Window/Table/Grid and existing resource/lifetime guards. Current branch feature/client-lua-inventory is clean at published d79e0abd5; work in this same PR/branch, do not amend/rebase/force-push published history. Implement/validate locally and hand off before new follow-up commits/push; no merge or extra agents authorized. Acceptance additions: prove logical lookup/current-item/empty destinations independently of GUI/package existence; real input still maps to correct canonical slots after sort/reconciliation/recreation; hidden-window hotbar activation continues according to existing native rules; pointer/session eligibility and captured item/provenance checks remain at the correct native boundary. Preserve main/bag/bank/loot/cell-layout/selection/pending/split/merge/combine/use/equip/offer/tooltip/hotbar/close/range/error behavior, full existing suites, negative controls and zero-allocation unchanged/lookup paths. Provide a before/after responsibility map and candid production/test LoC explanation, not a promise of arbitrary line reduction. New CI/live/platform/AOT limits remain explicit. Historical implementation below is the starting point, not the desired final architecture. Boundary implementation now local: Inventory/ItemContainer.cs owns GUI-free current facts, canonical ItemLocation/CapturedItem, logical epoch/owner/version/membership validation and close policy. ItemInputBindings/ItemInputSurface is the single UI edge for owned hit mapping, explicit first-free targets, native legacy bindings, arrangement revisions, gesture leases and immutable interaction feedback. ItemInteractionController reads ItemFacts/canonical locations directly; only pointer paths require UI leases. Bank models now contain real bank slots, not cells: native arrangement maps cells at the input seam and does not change logical location identity. Main/equipment models are updated independently before presenters; bag/loot/bank controllers own model lifetimes. Thin scripted presenter projects batches/resources and consumes feedback; no GetItem/hover/reverse lookup/slot cache/table_scroll knowledge. IItemSlotSurface and ViewWithBinding removed. Wear uses a generic native view adapter; trade's existing UI-only tooltip/purchase handling remains native. Boundary validation/handoff complete locally: existing 25 main and 18 container regressions preserved with implementation-specific fixtures changed to canonical models and actual UI binding. Added five GUI/package-free logical tests, two real-input recreation/cross-package cases, and actual hotbar activation after Inventory presentation disposal. Canonical bank reads remain real bank-slot addresses across native cell moves; input mappings immediately reject stale arrangement views. Headless lookup/empty destinations and warmed lookup/unchanged projection paths allocate nothing (an enumerator allocation found by the new first-free test was fixed using indexed canonical reads). Mutation controls fail on removed logical epochs, removed arrangement input eligibility, or canonical-only press matching across packages; all restored before full validation. Final commands/results on the local boundary patch: ./run-client-tests.sh -p:TreatWarningsAsErrors=true -p:WarningsNotAsErrors=NU1903: 4075 passed, 180 skipped, 4255 total. GraphicsEngine.Tests through existing client-test Docker image and the same warning flags: 713 passed, 1 skipped. ./run-client-lua-tests.sh: native release 8/8, sanitizer 8/8, generator self-test, scripting Native AOT and shared UI Native AOT all passed. git diff HEAD --check passed; no old IItemSlotSurface/ViewWithBinding/table_scroll dependency remains in model/backend/scripted adapter. Docs updated in Core/Inventory READMEs and UI_XML.md. Before/after raw source LoC (tracked plus new source, excluding obj/bin): scripted presenter 328 -> 176; selected core boundary group 1528/6 files -> 1698/7 files (+170); total UI plus new Inventory C# 37992 -> 38182 (+190); package Lua 1195 -> 1201 (+6); client test C# 92561 -> 92929 (+368, three shared helper/new behavior files). No arbitrary line-reduction claim: the adapter loses data/validation/reverse-view responsibilities while explicit native model and one generic input seam add reusable code. Measurement details in ignored .dev-data/boundary-{baseline,final}-loc.json. Coordinator performed a bounded manual review of the complete ItemContainer model, ItemInputBindings/surface, thin scripted presenter, headless boundary tests, native interaction capture/read/drop paths and main/bag/bank/loot integration. Confirmed canonical item/location reads are GUI-independent, bank addresses are real server slots, old IItemSlotSurface/ViewWithBinding/table_scroll adapter coupling is removed, and input retains separate UI leases plus captured logical item validation. No obvious correctness blocker identified in those reviewed paths; this is NOT a complete independent/security review or new live/platform acceptance. Remaining layering caveat: ItemFacts still carries InventoryItemPresentation/borrowed resource metadata from the UI namespace, so GUI-view independence is achieved but a fully presentation-neutral domain is not claimed. Coordinator reran full client suite successfully:4075 passed/180 skipped/0 failed with warnings-as-errors; evidence .dev-data/boundary-review/coordinator-full-client.log; whitespace checks pass. Current source counts independently checked:model147,input binding264,presenter176 lines. No source changes during this review. User explicitly requested pushing the reviewed boundary refactor. Committed as2e6ded8bf (refactor: Separate logical item locations from UI bindings) and fast-forward-pushed existing feature/client-lua-inventory after verifying remote remainedd79e0abd5. PR2808 https://git.project-rk.com/prk/engines/pulls/2808 updated to the logical-model/input-seam architecture and4075/180,713/1,native8+8/sharedAOT results; restored ready/non-draft after implementation/review. Worktree clean. origin/develop advanced toe66a89ace, but no published history rewritten or base merged; testing remains on the branch based on7d66cd1b6, accurately stated in PR. No merge or extra agents/worktrees; remote CI/live/full-client AOT not claimed. Earlier HEAD/local-only notes are historical handoffs. Patch and tests are local in the assigned tree. Logs: .dev-data/boundary-*.log. Native audio package is still absent, so combined full-client publish was not attempted; shared AOT does not prove the complete adapter/client. Installed-art/live sessions, Windows/macOS, GPU/platform skips and new CI remain explicitly unverified. User requests Inventory next after merged shared-grid PR2806. Dedicated worktree /home/mathias/Projects/worktrees/engines-client-lua-inventory; branch feature/client-lua-inventory; base current develop7d66cd1b6. Original checkout is now on unrelated fix/preserve-report-type and clean; do not touch it. Single-session implementation; no extra delegated agents. User explicitly requested a PR, authorizing staging/commit/push/PR creation. Committed as d97d9668f (feature: Migrate Inventory to shared Lua UI components), pushed with upstream origin/feature/client-lua-inventory and opened ready PR2808 https://git.project-rk.com/prk/engines/pulls/2808 against develop. Worktree clean; base7d66cd1b6 remained current at publication, no rebase/force-push or merge. Existing worker validation logs were checked during publication; no newly executed suites/remote CI/full-client AOT/live/platform proof claimed. USER EXPANDED SCOPE after opening PR2808: migrate ALL remaining production InventoryPresenter consumers (BagWindows, BankWindow, LootWindow) in the SAME feature/client-lua-inventory branch/PR so InventoryPresenter can be removed, rather than maintaining duplicated native and Lua item-container presentation. Main migration is already published at d97d9668f and worktree clean. Reuse/generalize the existing scripted item-container presentation and Core Window/Table/Grid, not one copied presenter/Lua engine per container. C# retains canonical identity/placement/items/revisions, native bag/bank/loot open-close/range/layout models, resources/information, pointer/transaction mechanics and validated commands. Preserve existing distinct native policies, preference identities and all client/server semantics. No new game capabilities, arbitrary fallback or parallel replacement engines. Trace InventoryPresenter, ItemSlotCollection/ItemTable, ItemInteractionController end-to-end and CharacterInterface BuildInventory/BuildItemInteraction/update/inspection/tooltip/shortcut integration before changing design. Native controller now takes IItemSlotSurface, including AddBag/AddLootContainer/AddBank and their registration lifetimes. Concrete slot/table code remains only for genuinely native non-container consumers. Separate semantic slot/input surface and canonical facts from UI presentation with minimal reusable interfaces/helpers as necessary; do not feed Lua-owned views through a legacy native presenter that continues mutating their text/icon/layout. Retain native dragging cursor overlay and interaction transaction state, while Lua renders content/selection/availability through existing host capabilities. Fix design cause rather than layer-specific hacks. Current consumer audit: BagWindows uses variable bag placements and pooled bag_window mode/sort prefs, native bag identities and close requests; LootWindow follows latest corpse/chest, is take-only and has distinct corpse-drop/chest-close/range behavior; BankWindow uses native BankArrangement cells mapped to bank slots, scoped layout/preferences and opening/range semantics. Those native policies stay in their existing controllers, while shared scripted presentation takes canonical configurable container data. Adapt ItemInteractionController.AddBag/AddLootContainer/AddBank registration/surface types generically to IItemSlotSurface as needed. Real empty targets, stale revisions/container reopen/replacement and selection/split/drop semantics must stay valid. Wear, trade and other non-InventoryPresenter consumers are NOT being migrated; keep ItemSlotCollection/ItemTable if still genuinely used. Remove InventoryPresenter, InventoryWindowSizing and Layouts/Inventory.xml ONLY after every production/test caller is migrated and no legitimate references remain. No ghost compatibility class solely for old tests. Contracts stay domain-grouped; no container-specific duplicate list/grid engine. Critical inventory-specific distinction: an EMPTY INVENTORY SLOT is still a real indexed drop target, unlike an absent padding cell. Shared grid currently equates entry~=nil with HasContent; use a coherent generic occupied/content contract if necessary so empty real slots retain valid native placement semantics without inventing items or authorizing commands. No game/domain switch in Core. Bound references/registrations must be package/generation/current-character/current-revision-safe; stale, retired, hidden, wrong-session or replaced views cannot move/use another item. Preserve press/release/right-button/modifier provenance, captured item identity, selection, split counts, pending moves/reconciliation, cancellation on close/logout/mode switch and actual existing refusal reasons. This is one end-to-end session: authorized scope includes minimal generic shared component/slot-surface/input/tooltip extensions required by a concrete Inventory consumer, with regression coverage for existing consumers. Do not stop at the first missing API or build a separate Inventory grid/list engine. Inspect/reuse first, describe architectural risks before larger shifts; only ask for genuinely ambiguous product/game behavior. No extra agents unless user/coordinator requests them. Keep bridge ABI/callback/error/budget/AOT protections and borrowed native resources unchanged unless a necessity is proved; no reflection or native widget mutation bypasses. Acceptance: shared Lua frame/grid/table and scoped prefs drive real inventory, no remaining native item-container presenter or legacy Inventory layout/sizing path; native interaction backend still handles actual use/equip and movement semantics. Meaningful real-input regressions cover occupied/empty targets, list/grid sorting and selection, tooltips/inspection/hotbar identities, inventory/equipment/bag/bank/loot/trade routes, split/merge/combine/use-on-item, stale snapshots/session/placement changes, pending moves, failure/disposal and unchanged snapshot allocations. Preserve native inventory state and game-info tests and other container UIs. Run targeted then full client/graphics/generator and appropriate native/shared AOT validation; separate per-window AOT project is not a hard gate, combined full-client AOT publish only if local prerequisites available. Native installed-art/live Windows/macOS coverage and new CI must remain explicit if unverified. Leave local implementation plus precise testing/handoff; no automatic publication. Expanded implementation complete locally: one ScriptedItemContainerWindow and the existing Inventory Lua package now serve main, bags, bank and loot, with native configurable placements/title/alignment, scoped preferences and ItemContainerVersion (revision/opening/arrangement). ItemContainerServices shares only UI plumbing; native controllers retain identity/open/close/range and bank mappings. AddBag/AddLootContainer/AddBank and registrations use IItemSlotSurface. All old production/test presenter callers have been converted and InventoryPresenter, InventoryWindowSizing and Layouts/Inventory.xml removed locally. Wear/trade and genuinely used ItemSlotCollection/ItemTable stay native. Close-policy audit correction: UiWindowManager.CloseFrontmostOnEscape calls the close button handler. Thus bag/loot close buttons AND Escape request native closure while title-menu Close Window hides locally. Bank still uses ServerDrivenWindow, including session hiding and native close/range callbacks. The shared Window close_action option plus a typed activation-validated current-container request preserves this distinction; package failure has an explicit native close fallback. Real-input tests exposed usable loot falling through to native use; native activation now always takes loot first, matching the existing take-only policy. Canonical lifecycle: native bag/loot opening stamps invalidate unseen close/reopen/handle reuse; bank snapshots carry native message owner and a monotonic generation separate from the existing opening count. Native arrangement revisions gate bank cell mappings immediately. Current owner/revision/package checks and mode/visibility generations remain; unchanged updates/semantic lookups retain allocation gating. Final expanded validation passed. Added 18 real-controller input/lifecycle cases and converted all legacy presenter and native-container-list test callers to the shared presentation. Removed the now-unused ItemSlotCollection list path and ItemTable inventory-only helpers; retained Wear's fixed slots and trade's shop table. Shared grid_columns configures the native column bound from real capacity without increasing quotas. Native list-only SetMode/wiring tests were replaced by real menu/input behavior; mode switching follows the already-published shared main Inventory cancellation/retirement policy. Expanded final results: ./run-client-tests.sh -p:TreatWarningsAsErrors=true -p:WarningsNotAsErrors=NU1903: 4068 passed, 180 skipped (4248 total). GraphicsEngine.Tests in the existing client-test Docker image with the same flags: 713 passed, 1 skipped. ./run-client-lua-tests.sh: native release 8/8, sanitizer 8/8, generator self-test, scripting Native AOT and shared UI Native AOT passed. Full client rerun includes all 25 published main Inventory cases, converted resize/list/tooltip/Alt-input tests, other interaction/state/game-info coverage and new multiple-bag, packed/empty, pool/preferences, bank mapping/102-cell/list/split/merge/refusal/range/pending-reopen, corpse/chest/latest-page/rename/take-only, owner, failure/init/retry/disposal and unchanged-update allocation cases. Mutation controls fail when removing opening invalidation, pending bank-cell cleanup, take-only loot activation, close activation authorization or capacity-driven grid columns; every control restored before final full runs. git diff HEAD --check and whole-repository production/test legacy-reference searches pass. Docs updated in Core/Inventory READMEs and UI_XML.md. Published follow-up with explicit user request to ensure it is pushed: committed d79e0abd5 (feature: Share scripted item containers across bags, bank and loot) and fast-forward-pushed the existing feature/client-lua-inventory branch after confirming remote was still d97d9668f. No amend/rebase/force-push or extra branch/PR. PR2808 https://git.project-rk.com/prk/engines/pulls/2808 now titled feature: Migrate inventory containers to shared Lua UI, restored ready/non-draft, with expanded scope and4068/180,713/1,native8+8/sharedAOT validation accurately documented. Worktree clean. Existing final validation logs were checked for this publication-only operation, not claimed freshly rerun; remote CI/live/full-client AOT remain unverified. No merge performed. Expanded logs: ignored .dev-data/containers-*.log. Combined full-client publish remains unattempted because .dev-data/native-audio/linux-x64/package is absent; shared AOT is not full-adapter/client proof. Installed-art/live sessions, Windows/macOS, platform/GPU skips and new CI remain explicitly unverified. Verified local implementation and handoff: baseline 156 targeted tests passed; final targeted interaction/state/Grid/Inventory run 162 passed. Added 25 main Inventory actual-layout/input cases covering empty grid/list targets, sorting/selection, right use/equip and modifier offers, held dragging, split/merge/combine/use-on-item, bag/bank/loot routes and trade refusals, native inspection/tooltips/real hotbar drops and activation while Inventory is closed, pending moves, stale revisions/character owners/unnamed replacements, mode/close/Escape/pin/session hiding/failure/disposal, borrowed icons and allocation-free unchanged snapshots plus semantic lookups. Existing other-container and native game-info/state tests pass. Reverting the content predicate, revision guard or snapshot-owner guard makes the corresponding regression fail; all controls were restored. Final commands/results: ./run-client-tests.sh -p:TreatWarningsAsErrors=true -p:WarningsNotAsErrors=NU1903: 4051 passed, 180 skipped. GraphicsEngine.Tests via the existing client-test Docker image with the same warning flags: 713 passed, 1 skipped. ./run-client-lua-tests.sh: native release 8/8, sanitizer 8/8, generator self-test, scripting AOT and shared UI AOT passed. git diff --check passed; component documentation updated. Logs are in ignored .dev-data/inventory-*.log. Manual patch review only, no agents, commits, pushes or PRs. Limits: skipped installed-resource/platform/GPU checks are not claimed verified. Installed-art/live-session Windows/macOS acceptance and new CI remain external gates. Combined full-client AOT publish was not attempted because this worktree has no required native-audio library/license/source package. The shared UI AOT run covers shared capabilities/contracts, not the full Inventory adapter/client. No fake packages, suppressions or raised budgets were added. Update concise module docs and task/checklist at milestones; private task metadata never goes into repository/team artifacts.
Checklist
6 of 6 complete- Trace main inventory presentation, canonical slots and native interaction/lifecycle callers; identify minimal reusable boundary changes and verify baseline.
- Preserve real native item gestures, selection/availability, validated movement/use/equip and stale/session/pending-move cleanup across integration.
- Migrate main Inventory frame/grid/list/preferences to shared Lua components with valid empty-slot drop targets, preserving other container views.
- Verify actual input, other container/shortcut/tooltip behavior, full appropriate suites and unchanged-update/resource guarantees; document actual limits and handoff.
- Migrate bags, bank and corpse/chest loot to one shared scripted item-container presentation, preserve native policies, and remove all InventoryPresenter callers and dead presenter/layout/sizing code.
- Replace widget-oriented item resolution with GUI-independent logical container/location data and one generic hit-view binding seam; demonstrate lookup without rendered frames.
- Area
- Project Rubi-Ka
- Project
- engines
- Kind
- Feature
- Task ID
tsk_5m7pmtfpyt- Updated