fix: complete retail parity stability pass
All checks were successful
CI / linux-portable (push) Successful in 3m41s
CI / windows-gate (push) Successful in 6m49s
CI / release (push) Successful in 3m22s

This commit is contained in:
Erik 2026-08-28 20:01:39 +02:00
parent d3df4cb20a
commit f7aa8e0eb7
131 changed files with 7765 additions and 1190 deletions

View file

@ -330,23 +330,18 @@ public sealed partial class RuntimeCollisionPrefixQuiescenceTests
/// root holds an operation. (Additionally, a parked record has
/// <c>FullCellId == 0</c>, so it is not an affected resident at all.)
///
/// <para><b>The real hazard is not a throw, it is an unbounded streaming
/// stall — and this test PINS it as a stall, not as a pass.</b> A retained
/// preparation retry keeps its landblock prefix in placement debt, so the
/// retirement is refused on EVERY poll and the landblock never retires.
/// There is no bound: the retirement coordinator simply retries, and
/// <c>TickLostCellDeadlines</c> — the only expiry that could break the
/// cycle — has NO production caller, so its deadline never fires. The only
/// thing that clears it is an inbound packet for that same entity, which
/// is exactly what a <c>RetrySetupUnavailable</c> on an asset that never
/// loads does not produce.</para>
/// <para>#310: collision retirement now supersedes an authored mover that
/// is still waiting for its first preparation. The exact unprepared
/// operation is cancelled before ordinary placement-debt evaluation, so
/// the resident enters the normal retirement park and the prefix can
/// converge without an inbound packet or asset-readiness edge.</para>
///
/// <para>This is a pre-existing hazard independent of route 4b-1, filed as
/// its own issue. 4b-1 does NOT bound it; it only avoids widening it, by
/// declining to retain operations for destinations it cannot service.</para>
/// </summary>
[Fact]
public void RetainedPreparationRetryStallsPrefixRetirementIndefinitely()
public void RetainedPreparationRetryIsCancelledByPrefixRetirement()
{
using var fixture = new Fixture();
RuntimeEntityRecord record = fixture.Add(
@ -358,7 +353,7 @@ public sealed partial class RuntimeCollisionPrefixQuiescenceTests
// A retained preparation retry: begun, never prepared — the shape a
// RetrySetupUnavailable on an asset that never resolves leaves behind.
RuntimeEntityPlacementToken retained = fixture.Lifetime.Physics
.SetPosition.BeginAcceptedPlacement(
.SetPosition.BeginAuthoredPlacement(
record,
record.PositionAuthorityVersion,
RuntimeSetPositionOperationKind.RemoteAuthoritative);
@ -366,29 +361,14 @@ public sealed partial class RuntimeCollisionPrefixQuiescenceTests
RuntimeCollisionPrefixQuiescenceToken token = fixture.Begin(2UL);
// The production retirement path, polled hard. Permission is refused
// every single time; nothing in the system advances it.
for (int poll = 0; poll < 1_000; poll++)
{
Assert.False(
fixture.TryAcquire(token, out _),
$"retirement unexpectedly acquired permission on poll {poll}; "
+ "if this now succeeds the stall has been bounded and "
+ "this test's pinned decision must be revisited");
}
// The first production poll cancels the unprepared operation and
// enters the ordinary two-phase resident-withdrawal handshake.
Assert.False(fixture.TryAcquire(token, out _));
Assert.False(fixture.Lifetime.Physics.SetPosition
.IsPlacementCurrent(retained));
Assert.Equal(1, fixture.Lifetime.Physics.CaptureOwnership()
.SetPositionOperationCount); // the replacement retirement park
// ParkCollisionResidents was never entered, so its overlap throw could
// not fire — the contract's item 6, proven structurally.
Assert.True(fixture.Lifetime.Physics.IsSpatialRoot(record));
Assert.False(fixture.Lifetime.Physics.SetPosition.TryPeekProjection(
out _));
// And the discriminator: retiring the retained operation is what
// releases the prefix. Once the debt is gone the ordinary two-phase
// handshake proceeds — ParkCollisionResidents withdraws the residents
// and permission follows the withdrawal acknowledgements — so drain
// those exactly as the production host does.
_ = fixture.Lifetime.Physics.SetPosition.ForgetExactPlacement(retained);
bool acquired = false;
for (int poll = 0; poll < 32 && !acquired; poll++)
{
@ -404,8 +384,8 @@ public sealed partial class RuntimeCollisionPrefixQuiescenceTests
}
Assert.True(
acquired,
"clearing the retained preparation retry must let the prefix "
+ "retire; if it does not, the stall has a second cause");
"prefix retirement must converge after it supersedes an "
+ "unprepared mover operation");
}
[Fact]