refactor(runtime): own interaction transactions

Move use throttling, appraisal identity, queued interactions, and exact post-arrival pickup state beneath RuntimeActionState. Keep App as the picker, movement, transport, and retained-presentation adapter while preserving retail send and UseDone ordering. Add reset, disposal, GUID-reuse, callback-reentrancy, and transport-failure coverage.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Erik 2026-07-26 11:13:09 +02:00
parent be73bccf5a
commit f5f7b4177f
31 changed files with 1365 additions and 432 deletions

View file

@ -1,4 +1,5 @@
using AcDream.Core.Combat;
using AcDream.Core.Items;
using AcDream.Core.Selection;
using AcDream.Runtime.Gameplay;
@ -9,7 +10,8 @@ public sealed class RuntimeActionStateTests
[Fact]
public void ViewProjectsTheExactCanonicalChildrenAndRevisions()
{
using var actions = new RuntimeActionState();
using var inventory = NewInventoryTransactions();
using var actions = new RuntimeActionState(inventory);
actions.Selection.Select(
0x50000001u,
@ -38,7 +40,8 @@ public sealed class RuntimeActionStateTests
[Fact]
public void ResetSessionConvergesEveryChildAfterObserverFailures()
{
var actions = new RuntimeActionState();
using var inventory = NewInventoryTransactions();
var actions = new RuntimeActionState(inventory);
actions.Selection.Select(
0x50000001u,
SelectionChangeSource.World);
@ -69,7 +72,8 @@ public sealed class RuntimeActionStateTests
[Fact]
public void DisposeIsTerminalAndConvergedAfterObserverFailures()
{
var actions = new RuntimeActionState();
using var inventory = NewInventoryTransactions();
var actions = new RuntimeActionState(inventory);
actions.Selection.Select(
0x50000001u,
SelectionChangeSource.World);
@ -94,8 +98,10 @@ public sealed class RuntimeActionStateTests
[Fact]
public void InstancesAreFullyIsolated()
{
using var first = new RuntimeActionState();
using var second = new RuntimeActionState();
using var firstInventory = NewInventoryTransactions();
using var secondInventory = NewInventoryTransactions();
using var first = new RuntimeActionState(firstInventory);
using var second = new RuntimeActionState(secondInventory);
first.Selection.Select(
0x50000001u,
@ -114,7 +120,21 @@ public sealed class RuntimeActionStateTests
0,
0,
InteractionModeKind.None,
0u),
0u,
new RuntimeInteractionTransactionSnapshot(
IsDisposed: false,
Revision: 0,
LastUseSourceId: 0u,
LastUseTargetId: 0u,
AwaitingAppraisalId: 0u,
CurrentAppraisalId: 0u,
OutboundCount: 0,
HasPendingPickup: false,
PendingPickupToken: 0u,
DispatchFailureCount: 0)),
second.View.Snapshot);
}
private static InventoryTransactionState NewInventoryTransactions() =>
new(new ClientObjectTable());
}