using AcDream.Runtime.Session; namespace AcDream.App.Streaming; /// /// C4 route 4b-1: the graphical host's /// — headless already had /// one (HeadlessCollisionNeighborhood.IsWithinServiceWindow, /// HeadlessSessionWorldProjection.cs:27/:245-257); the /// graphical host had none. /// /// /// /// Predicate choice — , not /// . The contract asks /// whether near-tier residency is exactly co-extensive with collision /// publication and, if not, to propose the correct predicate rather than /// ship the assumption. It is not — for the "pending" half specifically: /// IsNearTierOrPending is true for a landblock that has only been /// PARKED as a pending near-tier entity bucket /// (GpuWorldState.CommitEntitiesToExistingLandblockSpatialCore's /// parkIfMissing branch, :1919-1952) — i.e. queued, not yet /// collision-published. Using it here would let this guard say "go" for a /// destination whose collision generation has not committed, reopening /// exactly the DeferredCell park this route exists to prevent. /// alone is the correct predicate: /// /// /// Promotion direction (verified by reading, not assumed): the only /// two writers of _tierByLandblock[...] = LandblockStreamTier.Near are /// GpuWorldState.CommitLandblockSpatialCore (:969) and /// CommitEntitiesToExistingLandblockSpatialCore (:1972), both called /// from LandblockPresentationPipeline.Advance's /// SpatialPresentationCommitted stage — which runs strictly AFTER the /// preceding PresentationCommitted stage, the one that drives /// LandblockPhysicsPublisher's staged collision/EnvCell advance to /// completion (LandblockPresentationPipeline.cs ~826-935). A /// landblock's tier cannot read Near before its collision has committed. /// /// /// Retirement direction (verified by reading, not assumed): /// GpuWorldState.DetachNearLayer (:1755-1834) flips the tier to Far as /// the FIRST, synchronous step of a "detach-first" landblock retirement — /// LandblockRetirementCoordinator.AdoptDetachedFull's own doc comment /// states spatial detachment has already committed by the time its retirement /// ticket is constructed, and that ticket's LandblockRetirementStage.Physics /// step (_physics.AdvanceRemovalRuntimeSetPositionState /// .WithdrawCollision → the collision-side retirement /// ParkCollisionResidents can reach) runs strictly AFTER. A /// landblock's tier cannot still read Near once its collision has begun /// retiring. /// /// /// Residual, not closed: a landblock-prefix collision MUTATION that is /// not a full retirement (a live in-place quiescence/refresh while the tier /// stays Near) is not ruled out by this reading and is not exercised by any /// gate this route adds. RuntimeSetPositionState's private /// TryGetBlockingQuiescence (:3820-3863) is Core's own check for /// exactly this case — an active CollisionPrefixQuiescence entry for /// the destination's landblock prefix, independent of tier/residency — and /// it is what a placement can still hit even after this guard passes, /// producing the narrow DeferredCell residual /// 's /// class doc describes. /// /// internal sealed class GraphicalRemotePlacementServiceWindow : IRuntimeRemotePlacementServiceWindow { private readonly GpuWorldState _state; internal GraphicalRemotePlacementServiceWindow(GpuWorldState state) { _state = state ?? throw new ArgumentNullException(nameof(state)); } /// /// is a full ACE cell id (landblock high /// word + cell low word — CreateObject.ServerPosition.LandblockId /// carries the full id despite its name; see /// RuntimeAcceptedPositionDriveControllerTests's own /// SourceCell = SourceLandblock | 0x0001u fixture shape). /// Canonicalized to 0xAAAAFFFF the same way every /// tier writer/reader does /// (DetachNearLayer, CommitLandblockSpatialCore) before the /// dictionary lookup — itself does /// not canonicalize its argument. /// public bool IsWithinServiceWindow(uint landblockId) => _state.IsNearTier((landblockId & 0xFFFF0000u) | 0xFFFFu); }