fix(streaming): preserve exact live projection identity

Carry RuntimeEntityKey through spatial residency, visibility transitions, rebucketing, quiescence, landblock retirement, and origin recentering. This prevents stale incarnation edges from mutating a replacement projection while retaining the static DAT-entity path.

Validated by 104 focused ownership/streaming tests, the Release solution build, and 8,444 complete Release tests with five existing skips.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-25 22:09:55 +02:00
parent 420e5eea70
commit e937cc36df
8 changed files with 338 additions and 120 deletions

View file

@ -2168,9 +2168,9 @@ public sealed class LiveEntityRuntimeTests
0x01010001u,
id => Entity(id, guid))!;
bool replaced = false;
spatial.LiveProjectionVisibilityChanged += (localEntityId, visible) =>
spatial.LiveProjectionVisibilityChanged += (key, visible) =>
{
if (replaced || visible || localEntityId != original.Id)
if (replaced || visible || key.LocalEntityId != original.Id)
return;
replaced = true;
Assert.True(runtime.UnregisterLiveEntity(
@ -2325,9 +2325,9 @@ public sealed class LiveEntityRuntimeTests
0x01010001u,
id => Entity(id, guid))!;
bool rebucketed = false;
spatial.LiveProjectionVisibilityChanged += (localEntityId, visible) =>
spatial.LiveProjectionVisibilityChanged += (key, visible) =>
{
if (rebucketed || visible || localEntityId != original.Id)
if (rebucketed || visible || key.LocalEntityId != original.Id)
return;
rebucketed = true;
Assert.True(runtime.RebucketLiveEntity(guid, 0x03030033u));
@ -2383,7 +2383,7 @@ public sealed class LiveEntityRuntimeTests
Assert.Equal((ushort)2, replacement.Generation);
Assert.True(replacement.IsSpatiallyVisible);
Assert.True(spatial.IsLiveEntityVisible(
replacement.WorldEntity!.Id));
replacement.ProjectionKey!.Value));
Assert.Equal(2, resources.RegisterCount);
Assert.Equal(1, resources.UnregisterCount);
}

View file

@ -4,6 +4,7 @@ using AcDream.App.Rendering;
using AcDream.App.Rendering.Scene;
using AcDream.App.Rendering.Vfx;
using AcDream.App.Rendering.Wb;
using AcDream.App.Streaming;
using AcDream.App.World;
using AcDream.Runtime.Entities;
@ -84,6 +85,11 @@ public sealed class RuntimeEntityOwnershipTests
AssertExactKeyFields(
typeof(RemoteMovementObservationTracker),
"_lastMove");
AssertExactKeyFields(
typeof(GpuWorldState),
"_liveProjectionByKey",
"_visibleLiveProjectionCounts",
"_visibilityBeforeMutation");
}
[Fact]