refactor(streaming): own presentation retirement in pipeline

Move full and near-tier presentation retirement out of GameWindow and into a concrete pipeline-owned stage mapper. Harden the retry ledger against reentrancy and committed visibility observer failures, enforce a single state/resource ownership graph, and split concrete versus legacy controller construction so callbacks cannot be silently ignored.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-21 22:07:36 +02:00
parent dc39772bf9
commit ea7ffbc186
10 changed files with 860 additions and 140 deletions

View file

@ -12,6 +12,63 @@ namespace AcDream.App.Tests.Streaming;
public sealed class LandblockPresentationPipelineTests
{
[Fact]
public void ControllerRejectsPresentationPipelineFromForeignWorldState()
{
var controllerState = new GpuWorldState();
var foreignState = new GpuWorldState();
var foreignPipeline = new LandblockPresentationPipeline(
static (_, _) => { },
foreignState);
Assert.Throws<ArgumentException>(() => new StreamingController(
enqueueLoad: static (_, _, _) => { },
enqueueUnload: static (_, _) => { },
drainCompletions: static _ => Array.Empty<LandblockStreamResult>(),
controllerState,
nearRadius: 0,
farRadius: 0,
presentationPipeline: foreignPipeline));
}
[Fact]
public void LegacyPipelineRejectsRetirementCoordinatorFromForeignWorldState()
{
var pipelineState = new GpuWorldState();
var foreignCoordinator = new LandblockRetirementCoordinator(
new GpuWorldState(),
static _ => { });
Assert.Throws<ArgumentException>(() =>
new LandblockPresentationPipeline(
static (_, _) => { },
pipelineState,
retirementCoordinator: foreignCoordinator));
}
[Fact]
public void ControllerConcreteConstructorHasNoLegacyPresentationParameters()
{
string[] legacyNames =
[
"applyTerrain",
"removeTerrain",
"demoteNearLayer",
"onLandblockLoaded",
"ensureEnvCellMeshes",
"retirementCoordinator",
];
System.Reflection.ConstructorInfo concrete = Assert.Single(
typeof(StreamingController).GetConstructors(),
constructor => constructor.GetParameters().Any(
parameter => parameter.Name == "presentationPipeline"));
string[] names = concrete.GetParameters()
.Select(parameter => parameter.Name!)
.ToArray();
Assert.DoesNotContain(names, legacyNames.Contains);
}
[Fact]
public void Loaded_PreservesPresentationSpatialPinReplayAndLiveRecoveryOrder()
{