refactor(runtime): unify generation reset for direct hosts

Move canonical per-session teardown into one retryable Runtime transaction, reduce App reset to projection acknowledgements, and prove the same GameRuntime graph through deterministic no-window lifecycle, gameplay, portal, fault, reconnect, and isolation gates.\n\nCo-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Erik 2026-07-27 00:43:26 +02:00
parent 7818494116
commit a9a822f206
28 changed files with 2707 additions and 345 deletions

View file

@ -1182,27 +1182,44 @@ public sealed class ItemInteractionController : IDisposable
/// same numeric GUID can identify a different object.
/// </summary>
public void ResetSession()
=> ResetSessionCore(resetRuntime: true);
/// <summary>
/// Clears only retained UI transaction presentation. Runtime's canonical
/// transaction, interaction, and busy owners are reset once by the shared
/// generation-reset transaction.
/// </summary>
internal void ResetGenerationPresentation()
=> ResetSessionCore(resetRuntime: false);
private void ResetSessionCore(bool resetRuntime)
{
PendingBackpackPlacement? pendingPlacement = _pendingBackpackPlacement;
_pendingBackpackPlacement = null;
// Runtime owns the transaction reset. This controller preserves the
// pre-J4 single UI notification emitted by InteractionState below.
_transactions.StateChanged -= OnTransactionStateChanged;
try
if (resetRuntime)
{
_runtimeTransactions.ResetSession();
}
finally
{
if (!_disposed)
_transactions.StateChanged += OnTransactionStateChanged;
// Runtime owns the transaction reset. This controller preserves
// the pre-J4 single UI notification emitted by InteractionState.
_transactions.StateChanged -= OnTransactionStateChanged;
try
{
_runtimeTransactions.ResetSession();
}
finally
{
if (!_disposed)
_transactions.StateChanged += OnTransactionStateChanged;
}
}
_consumedPrimaryClickTarget = 0u;
_consumedPrimaryClickMs = long.MinValue / 2;
List<Exception> failures = [];
try { _interactionState.ResetSession(); }
catch (Exception error) { failures.Add(error); }
if (resetRuntime)
{
try { _interactionState.ResetSession(); }
catch (Exception error) { failures.Add(error); }
}
if (pendingPlacement is { } pending)
DispatchAll(PendingBackpackPlacementCancelled, pending, failures);