fix(test): cover the atlas-tier seam the D-1 fix depends on; correct AP-150's citation

Both items come from the D-1 fix review (both lenses PASS, D-1 genuinely
closed). No production behaviour changes.

L1 — THE SEAM HAD NO COVERAGE. The D-1 fix's "empty by construction" claim
rests on LandblockSpawnAdapter's atlas-tier filter (`if (entity.ServerGuid
!= 0) continue;`) skipping the live server projections DetachNearLayer
deliberately RETAINS across a demote. The reviewer removed that filter and
all 4,170 App tests passed — only two Core unit tests caught it, none
through a demote. So the invariant the re-assert depends on could have been
deleted silently, re-opening D-1 by another route: a non-empty re-assert
whose mesh reference is never satisfied leaves IsRenderReady false, which is
the portal hang again.

NearToFarDemote_WithALiveServerEntity_StaysRenderReady now demotes a
landblock that CARRIES a live server-spawned entity through the real
GpuWorldState + LandblockSpawnAdapter + LandblockPresentationPipeline, and
asserts the retained entity never enters the desired set.

Sabotage-verified: with the filter removed, exactly one test fails — this
one — and the other 25 pass, including all four D-1 regression tests. That
is the finding restated as a measurement: the D-1 tests genuinely do not
cover this seam, and now something does.

AP-150 citation corrected: the row cited 0x004D7064 as the
ECM_UI::SendNotice_DisplayStringInfo call site. That address is the
PStringBase construction of the "In Portal Space - Please Wait..." literal
(:219516); the actual call is 0x004D70A1 (-> 0x006925B0). Same class of slip
the #280 commit had just corrected for #326 — worth noting that a row filed
WITH a byte-level disassembly still mis-cited a neighbouring address.

Also refactored the existing pipeline demote test to keep its doc comment
attached to its own method (an earlier insertion had orphaned its [Fact]).

App.Tests 4,170 -> 4,171 passed / 3 skipped, net +1 for the new test. No new
skips; none of #302/#308/#321 surfaced. src/ is byte-unchanged (the sabotage
was reverted and verified).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-06 07:54:03 +02:00
parent 43cfdc4a40
commit bcb66ccdf3
3 changed files with 552 additions and 1 deletions

View file

@ -629,6 +629,83 @@ public sealed class StreamingControllerReadinessTests
/// </summary>
[Fact]
public void NearToFarDemote_LeavesTheLandblockRenderReadyThroughTheRealPipeline()
=> NearToFarDemoteLeavesTheLandblockRenderReadyCore();
/// <summary>
/// L1, filed at the D-1 fix review: the fix's "empty by construction"
/// claim rests on <c>LandblockSpawnAdapter</c>'s atlas-tier filter
/// (<c>if (entity.ServerGuid != 0) continue;</c>) skipping the live
/// server projections that <c>DetachNearLayer</c> deliberately RETAINS.
/// That seam had no composition-level coverage — the review removed the
/// filter and all 4,170 App tests still passed, with only two Core unit
/// tests catching it and none through a demote. So the invariant the
/// re-assert depends on could have been deleted silently.
///
/// <para>
/// Here the demoted landblock CARRIES a live server-spawned entity. If
/// the filter stops skipping it, the re-asserted registration is no
/// longer empty, its mesh reference is never satisfied, and
/// <c>IsRenderReady</c> goes false — which is D-1 again by another
/// route. Sabotage that reddens this: delete the `ServerGuid != 0`
/// continue in <c>LandblockSpawnAdapter.OnLandblockLoaded</c>.
/// </para>
/// </summary>
[Fact]
public void NearToFarDemote_WithALiveServerEntity_StaysRenderReady()
{
const uint landblockId = 0x1237FFFFu;
const ulong staticGfxObjId = 0x01000011ul;
const ulong serverGfxObjId = 0x01000012ul;
var meshes = new ReadinessMeshAdapter();
var state = new GpuWorldState(new LandblockSpawnAdapter(meshes));
var pipeline = new LandblockPresentationPipeline(
publishBeforeSpatialCommit: (_, _) => { },
state);
meshes.ReadyIds.Add(staticGfxObjId);
meshes.ReadyIds.Add(serverGfxObjId);
// An ordinary atlas-tier prop, and a server-spawned entity of the
// kind DetachNearLayer retains across the demote.
var staticEntity = new WorldEntity
{
Id = 1,
ServerGuid = 0,
SourceGfxObjOrSetupId = (uint)staticGfxObjId,
Position = System.Numerics.Vector3.Zero,
Rotation = System.Numerics.Quaternion.Identity,
MeshRefs = [new MeshRef((uint)staticGfxObjId, System.Numerics.Matrix4x4.Identity)],
};
var serverEntity = new WorldEntity
{
Id = 2,
ServerGuid = 0x50000123u,
SourceGfxObjOrSetupId = (uint)serverGfxObjId,
Position = System.Numerics.Vector3.Zero,
Rotation = System.Numerics.Quaternion.Identity,
MeshRefs = [new MeshRef((uint)serverGfxObjId, System.Numerics.Matrix4x4.Identity)],
};
state.AddLandblock(new LoadedLandblock(
landblockId,
new LandBlock(),
new[] { staticEntity, serverEntity }));
// Only the atlas-tier prop ever drove a reference count.
Assert.True(state.IsRenderReady(landblockId));
Assert.Equal(1, meshes.ReferenceCounts[staticGfxObjId]);
Assert.DoesNotContain(serverGfxObjId, meshes.ReferenceCounts.Keys);
pipeline.BeginNearLayerRetirement(landblockId);
Assert.False(state.IsNearTier(landblockId));
Assert.True(state.IsLoaded(landblockId));
// The retained server entity must not have re-entered the desired
// set: the re-assert stays empty and the block stays render-ready.
Assert.DoesNotContain(serverGfxObjId, meshes.ReferenceCounts.Keys);
Assert.DoesNotContain(staticGfxObjId, meshes.ReferenceCounts.Keys);
Assert.True(state.IsRenderReady(landblockId));
}
private static void NearToFarDemoteLeavesTheLandblockRenderReadyCore()
{
const uint landblockId = 0x1236FFFFu;
const ulong gfxObjId = 0x01000010ul;