feat(runtime): first-entry conductor sequences local-player world entry
Cutover slice C3a: the resumable transaction that dissolves the C3 flip's circularity finding. RuntimeLocalPlayerFirstEntryState drives the local player's complete entry in retail's own order — authored-mover preparation (the makeObject/set_description shape analog, via a pure no-submit extraction TryPrepareAuthoredMover), the publication chain's off-canonical Prepare + atomic body Commit against the residence's exact placement token, the Evaluate/CommitActivation enter-world analog, the Place-receipt acknowledgement as that act's virtualized completion, and only then the executor's FIFO drain (retail: enter_world at 93824 strictly precedes ProcessObjectNetBlobs at 93831). Five stages, eight typed statuses, exactly-once per stage under retry, no second token copies, and an acknowledge-stage discriminator that separates not-yet-FIFO-head (retryable) from authority-moved (typed abandonment) — a mid-flight delete can no longer strand a retry-forever entry. The residence retirement notification becomes an ordered multicast (snapshot-iterated per the event-stream precedent), the lifetime constructs the conductor with a late-bind Publication seam (transactional unbound failure — no mutation before the throw), deletion/reset converge the conductor automatically through the same choke points as the executor, and its active count is in the ownership snapshot and IsConverged. Dormant: no production Advance caller; GameRuntime binding is C3c's first act. Reviewed: retail-conformance PASS (the stage order verified step-for-step against retail's entry sequence; the live-controller-on- abandonment invariant proven structurally enforced and retail-correct — retail has no entry-flow rollback) + architecture/adversarial PASS after one fix round (acknowledge-stage authority discrimination; the wiring fold; two prescribed pre-C3c hardenings). Runtime 948/948; complete Release solution green across all nine projects. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
874d94bf34
commit
960373df2e
6 changed files with 1816 additions and 29 deletions
|
|
@ -489,7 +489,7 @@ internal sealed class RuntimeInitialCreateResidenceState
|
|||
private readonly Dictionary<RuntimeEntityKey, Entry> _entries = [];
|
||||
private readonly Dictionary<RuntimeEntityKey, CompletedEntry> _completed = [];
|
||||
private Func<RuntimeGenerationToken>? _generation;
|
||||
private Action<RuntimeEntityKey>? _retirementNotification;
|
||||
private readonly List<Action<RuntimeEntityKey>> _retirementNotifications = [];
|
||||
private ulong _nextLeaseId;
|
||||
|
||||
internal RuntimeInitialCreateResidenceState(
|
||||
|
|
@ -524,17 +524,36 @@ internal sealed class RuntimeInitialCreateResidenceState
|
|||
/// leave the executor's progress AND its separately-tracked pending
|
||||
/// continuation placement token orphaned - this class owns no reference
|
||||
/// to the executor type, so the lifetime binds a plain delegate here
|
||||
/// instead.
|
||||
/// instead. Multicast (ordered invocation list, registration order) so a
|
||||
/// second independent per-key owner (e.g. the local-player first-entry
|
||||
/// conductor) can subscribe to the SAME retirements the executor already
|
||||
/// does, without either overwriting the other's binding.
|
||||
/// </summary>
|
||||
internal void BindRetirementNotification(Action<RuntimeEntityKey> notify)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(notify);
|
||||
if (_retirementNotification is not null)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"The initial Create residence retirement notification is already bound.");
|
||||
}
|
||||
_retirementNotification = notify;
|
||||
_retirementNotifications.Add(notify);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// H1: snapshots the subscriber list before invoking anything, mirroring
|
||||
/// <see cref="RuntimeEntityObjectEventStream"/>'s own copy-on-write
|
||||
/// dispatch precedent. A subscriber binding a NEW notification from
|
||||
/// inside a retirement callback it is itself receiving (e.g. a future
|
||||
/// third, runtime-bound subscriber added at C3c) must not corrupt or be
|
||||
/// skipped by THIS iteration - <c>_retirementNotifications</c> is a
|
||||
/// plain <see cref="List{T}"/>, so iterating it directly while
|
||||
/// <see cref="BindRetirementNotification"/> appends to it mid-loop would
|
||||
/// throw <see cref="InvalidOperationException"/> ("Collection was
|
||||
/// modified"). <c>ToArray()</c> is the right granularity here (unlike
|
||||
/// the event stream's <see cref="Volatile"/>-guarded array swap) because
|
||||
/// binding only ever happens a handful of times at construction, never
|
||||
/// on a hot per-frame path.
|
||||
/// </summary>
|
||||
private void NotifyRetirement(RuntimeEntityKey key)
|
||||
{
|
||||
foreach (Action<RuntimeEntityKey> notify in _retirementNotifications.ToArray())
|
||||
notify(key);
|
||||
}
|
||||
|
||||
internal bool CanAcceptCreate(WorldSession.EntitySpawn incoming)
|
||||
|
|
@ -1003,7 +1022,7 @@ internal sealed class RuntimeInitialCreateResidenceState
|
|||
lease = entry.Lease;
|
||||
cancellation = _setPosition.ForgetExactPlacement(
|
||||
lease.Placement);
|
||||
_retirementNotification?.Invoke(key);
|
||||
NotifyRetirement(key);
|
||||
return true;
|
||||
}
|
||||
if (record.Key is { } completedKey
|
||||
|
|
@ -1016,7 +1035,7 @@ internal sealed class RuntimeInitialCreateResidenceState
|
|||
lease = completed.Lease;
|
||||
cancellation = _setPosition.ForgetExactPlacement(
|
||||
lease.Placement);
|
||||
_retirementNotification?.Invoke(completedKey);
|
||||
NotifyRetirement(completedKey);
|
||||
return true;
|
||||
}
|
||||
lease = default;
|
||||
|
|
@ -1052,13 +1071,10 @@ internal sealed class RuntimeInitialCreateResidenceState
|
|||
{
|
||||
_setPosition.PublishCancellation(cancellations[index]);
|
||||
}
|
||||
if (_retirementNotification is { } notify)
|
||||
{
|
||||
foreach (Entry entry in active)
|
||||
notify(entry.Lease.Token.Entity);
|
||||
foreach (CompletedEntry entry in completed)
|
||||
notify(entry.Receipt.Token.Entity);
|
||||
}
|
||||
foreach (Entry entry in active)
|
||||
NotifyRetirement(entry.Lease.Token.Entity);
|
||||
foreach (CompletedEntry entry in completed)
|
||||
NotifyRetirement(entry.Receipt.Token.Entity);
|
||||
}
|
||||
|
||||
internal RuntimeInitialCreateResidenceOwnershipSnapshot CaptureOwnership() =>
|
||||
|
|
@ -1245,7 +1261,7 @@ internal sealed class RuntimeInitialCreateResidenceState
|
|||
RuntimePlacementCancellationReceipt cancellation =
|
||||
_setPosition.ForgetExactPlacement(entry.Lease.Placement);
|
||||
_setPosition.PublishCancellation(cancellation);
|
||||
_retirementNotification?.Invoke(key);
|
||||
NotifyRetirement(key);
|
||||
}
|
||||
|
||||
private void Retire(CompletedEntry entry)
|
||||
|
|
@ -1255,6 +1271,6 @@ internal sealed class RuntimeInitialCreateResidenceState
|
|||
RuntimePlacementCancellationReceipt cancellation =
|
||||
_setPosition.ForgetExactPlacement(entry.Lease.Placement);
|
||||
_setPosition.PublishCancellation(cancellation);
|
||||
_retirementNotification?.Invoke(key);
|
||||
NotifyRetirement(key);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue