acdream/tests/AcDream.Runtime.Tests/Physics
Erik b1f914d508 fix(physics): restore presentation when a park is cancelled (#312)
Regression from 7f1c1f5a (C4 route 4b-2). A remote player who recalled in,
arrived, and stood still was permanently absent from the world render AND the
radar while remaining fully simulated — 71 healthy physics ticks with contact
and walkable, interpolation enqueues, equipment attached, chat visible.

Route 4b-2 is the first commit that lets an ordinary remote UpdatePosition open
a canonical SetPosition. A park publishes a synchronous Withdraw that tears down
presentation registrations; only TryPublishPlace restores them.
RestoreParkWithdrawal — added in the same slice — restores InWorld, the object
clock, and canonical residency, i.e. the Runtime half only. Eight Opus reviews
verified those three fields and the tests asserted exactly them, so the suite
stayed green while the entity was invisible.

Why it is intermittent: the presentation half IS restored incidentally by the
per-packet prologue rebucket for a MOVING remote. It only sticks when the
entity parks on its FINAL accepted Position and then goes idle, because ACE
stops broadcasting for a stationary entity, so no later packet arrives to
re-publish it and nothing else re-drives.

The fix publishes a RuntimePlacementProjectionKind.WithdrawalRestored receipt on
the one ordered placement stream, acknowledge-only in Runtime (the parked
operation is already retired by CancelCoreDeferred), which the App sink maps to
the exact inverse of its own TryPublishWithdrawal: the projection half (bucket,
IsSpatiallyProjected, IsSpatiallyVisible, spatial indexes, RefreshPresentation)
plus the publish half (_worldState, _worldEvents, _effectPoses,
_localPlayerShadow, visibility sinks). Applied with commitPose: false, because
the withdrawal never moved the sidecar; a test feeds a deliberately wrong
position to pin that.

Two alternatives were refuted on measurement, not preference. Routing the
restore's SetFullCell through CommitCanonicalCell cannot fire on the shipped
remote path at all — the prologue rebucket has already recommitted a non-zero
FullCellId before the merge cancels the park, so no cell edge remains — and it
never touches the publish half regardless. Extending RestoreParkWithdrawal
directly reduces to the same receipt, since Runtime must not reach behind the
host sink.

Gated on the entity ending the rollback canonically whole (FullCellId != 0 &&
InWorld) rather than on residencyRestored, which is false on the shipped remote
path and would have made the fix a no-op. AP-136's quiescing-prefix refusal arm
is preserved: no receipt, entity stays withdrawn.

Corrects my own framing of the defect: _worldState/_worldEvents/_effectPoses are
lost but are NOT what kills render and radar (_worldState is the plugin
IGameState; _effectPoses is the pose registry, not entity.MeshRefs). The
load-bearing casualties are the visibility sinks and the
IsSpatiallyProjected/IsSpatiallyVisible + bucket removal that gates the radar.

Register: AD-63 filed (selection deliberately not restored — user intent),
AP-136 amended (its "restored visible" claim covered only the canonical half;
the gap was a defect, not a divergence). ShadowObjectRegistry.Suspend stays
out of scope per AP-136.

Seven-revert discrimination table including one that proves the test is not
merely re-checking the bucket. Suite 11,023 passed / 4 skipped / 0 failed.

Live gate is user-run and folds into #309: two clients, ACDREAM_PROBE_PARK=1,
recall a remote in and let it stand still; acceptance is
[park-restore] ... presentation=True for that guid plus a visible model and a
radar blip.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 11:21:45 +02:00
..
RuntimeAuthoritativePositionRouteClassifierTests.cs feat(runtime): freeze initial placement inbound admission 2026-08-01 21:00:03 +02:00
RuntimeCollisionMutationTransactionTests.cs feat(runtime): atomically replace collision generations 2026-08-01 17:33:34 +02:00
RuntimeCollisionPrefixQuiescenceTests.CornerLandblock.cs feat(runtime): C3c - production placement cutover: both hosts on the residence conductors (routes 1+8) 2026-08-02 18:10:33 +02:00
RuntimeCollisionPrefixQuiescenceTests.cs fix(physics): restore a cancelled park instead of leaving the entity withdrawn 2026-08-04 04:07:39 +02:00
RuntimeCollisionReportingStateTests.cs fix(runtime): preserve hidden setposition collision ownership 2026-08-01 18:22:45 +02:00
RuntimePhysicsOwnershipBoundaryTests.cs feat(runtime): atomically replace collision generations 2026-08-01 17:33:34 +02:00
RuntimePhysicsStateTests.cs wip(physics): collision O(changed) delta-commit (O1-O3) - ON HOLD, feel-test failed 2026-08-02 20:06:59 +02:00
RuntimePlacementProjectionSubscriptionTests.cs feat(app): observe canonical placement receipts 2026-08-01 15:22:52 +02:00
RuntimeRemoteFarSnapPositionTests.cs feat(physics): C4 route 4b-2 — remote far snap through the canonical placement 2026-08-04 07:55:56 +02:00
RuntimeRemoteSteadyStatePositionTests.cs feat(physics): C4 route 4b-2 — remote far snap through the canonical placement 2026-08-04 07:55:56 +02:00
RuntimeRemoteSteepContactSlideTests.cs fix(physics): remote bodies slide on steep faces instead of freezing (#32) 2026-08-04 10:21:16 +02:00
RuntimeSetPositionMoverPreparationTests.cs fix(physics): #297 — keep the PWD bitfield live so PK status reaches the client 2026-08-03 20:59:01 +02:00
RuntimeSetPositionStateTests.cs fix(physics): restore presentation when a park is cancelled (#312) 2026-08-04 11:21:45 +02:00
RuntimeWorldFrameTests.cs fix(runtime): name why a placement is parked and fail closed when it cannot resolve 2026-08-03 13:55:16 +02:00