refactor(runtime): close canonical gameplay ownership
Unify the toolbar shortcut manager with Runtime inventory state, route retail-ordered shortcut and spellbook command effects through the canonical owners, and make retained controllers borrow those exact instances. Remove the item-interaction transaction fallback and add graphical/no-window parity plus failure-safe terminal ownership-ledger coverage. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
parent
ce6fae7b38
commit
89e6b207f8
36 changed files with 1433 additions and 251 deletions
|
|
@ -41,13 +41,32 @@ public sealed class RuntimeInventoryOwnershipTests
|
|||
"InteractionRetainedUiComposition.cs");
|
||||
string session = ReadSource("Net", "LiveSessionRuntimeFactory.cs");
|
||||
string shutdown = ReadSource("Rendering", "GameWindowLifetime.cs");
|
||||
string itemInteraction = ReadSource(
|
||||
"UI",
|
||||
"ItemInteractionController.cs");
|
||||
|
||||
Assert.Contains(
|
||||
"transactions: d.Inventory.Transactions",
|
||||
"d.Inventory.Transactions",
|
||||
ui,
|
||||
StringComparison.Ordinal);
|
||||
Assert.DoesNotContain(
|
||||
"new InventoryTransactionState(d.Inventory.Objects)",
|
||||
ui,
|
||||
StringComparison.Ordinal);
|
||||
Assert.DoesNotContain(
|
||||
"new InventoryTransactionState",
|
||||
itemInteraction,
|
||||
StringComparison.Ordinal);
|
||||
Assert.DoesNotContain(
|
||||
"_ownsTransactions",
|
||||
itemInteraction,
|
||||
StringComparison.Ordinal);
|
||||
Assert.Contains(
|
||||
"OnShortcuts: _domain.Inventory.Shortcuts.Replace",
|
||||
"InventoryTransactionState transactions,",
|
||||
itemInteraction,
|
||||
StringComparison.Ordinal);
|
||||
Assert.Contains(
|
||||
"OnShortcuts: _domain.Inventory.Shortcuts.Load",
|
||||
session,
|
||||
StringComparison.Ordinal);
|
||||
Assert.Contains(
|
||||
|
|
@ -64,6 +83,73 @@ public sealed class RuntimeInventoryOwnershipTests
|
|||
"\"runtime entity/object lifetime\"");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToolbarBorrowsRuntimeShortcutManagerWithoutAProviderOrMirror()
|
||||
{
|
||||
string toolbar = ReadSource(
|
||||
"UI",
|
||||
"Layout",
|
||||
"ToolbarController.cs");
|
||||
string ui = ReadSource(
|
||||
"Composition",
|
||||
"InteractionRetainedUiComposition.cs");
|
||||
|
||||
Assert.Contains(
|
||||
"private readonly ShortcutStore _store;",
|
||||
toolbar,
|
||||
StringComparison.Ordinal);
|
||||
Assert.Contains(
|
||||
"_store = shortcuts ?? throw",
|
||||
toolbar,
|
||||
StringComparison.Ordinal);
|
||||
Assert.DoesNotContain(
|
||||
"new ShortcutStore()",
|
||||
toolbar,
|
||||
StringComparison.Ordinal);
|
||||
Assert.DoesNotContain(
|
||||
"Func<IReadOnlyList<ShortcutEntry>>",
|
||||
toolbar,
|
||||
StringComparison.Ordinal);
|
||||
Assert.DoesNotContain(
|
||||
"_storeLoaded",
|
||||
toolbar,
|
||||
StringComparison.Ordinal);
|
||||
Assert.Contains(
|
||||
"d.Inventory.Shortcuts,",
|
||||
ui,
|
||||
StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SpellUiDoesNotApplyASecondLocalCommandMutation()
|
||||
{
|
||||
string spellbook = ReadSource(
|
||||
"UI",
|
||||
"Layout",
|
||||
"SpellbookWindowController.cs");
|
||||
string spellcasting = ReadSource(
|
||||
"UI",
|
||||
"Layout",
|
||||
"SpellcastingUiController.cs");
|
||||
|
||||
Assert.DoesNotContain(
|
||||
"_spellbook.SetSpellbookFilters(filters);",
|
||||
spellbook,
|
||||
StringComparison.Ordinal);
|
||||
Assert.DoesNotContain(
|
||||
"_spellbook.SetDesiredComponent(componentId, parsed);",
|
||||
spellbook,
|
||||
StringComparison.Ordinal);
|
||||
Assert.DoesNotContain(
|
||||
"_spellbook.SetFavorite(",
|
||||
spellcasting,
|
||||
StringComparison.Ordinal);
|
||||
Assert.DoesNotContain(
|
||||
"_spellbook.RemoveFavorite(",
|
||||
spellcasting,
|
||||
StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
private static string ReadSource(params string[] relative)
|
||||
{
|
||||
string root = FindRepositoryRoot();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue