acdream/tests/AcDream.Core.Tests/Physics
Erik 856aa78ec1 test(phys): A6.P3 #98 Step 3 — deterministic replay harness
Step 3 of the apparatus plan. Adds Issue98CellarUpReplayTests, a 7-test
harness that loads the three real-geometry cell fixtures captured in
commit 3f56915 and drives the failing-frame sphere through the same
nearest-walkable algorithm the live client uses in
Transition.LogNearestWalkableCandidate.

The tests reproduce the live failure deterministically in under 1ms
each — the issue #98 cellar-up bug is now visible to a unit-test run,
no client launch required.

Tests:
- Fixtures_AllThreeCellsLoadAndShareOrigin — sanity check the cells
  loaded with the expected (130.5, 11.5, 94.0) origin.
- Cellar_HasMostPolygons_CottageNeighborBIsSparse — confirms the
  surprising finding: 0xA9B40146 is too sparse to be a "cottage main
  floor" cell (slice 5 handoff inference was wrong; 0xA9B40143 with 14
  polys is the better candidate).
- FailingFrame_CellarPrimary_HasCellarRampAsNearestWalkable — the
  ramp polygon IS reachable when the player is on top of it
  (sanity: this should always be true).
- FailingFrame_CottageNeighborA_NearestWalkableIsOutsideSphereAndEdges
  — at the failing-frame sphere position, the nearest walkable in
  0xA9B40143 (poly 0x0004, the cottage floor triangle at world Z=94)
  reports BOTH insideEdges=false AND overlapsSphere=false. The sphere
  XY is beyond the triangle edge, and the sphere is too far below the
  plane. THIS IS THE BUG'S SHAPE.
- FailingFrame_CottageNeighborB_HasNoWalkableCandidate — 0xA9B40146
  has NO walkable polygon close enough to the failing-frame sphere.
- FailingFrame_NoCottageNeighbourYieldsAcceptedWalkable — composite:
  across both cottage cells, no walkable passes both edge + sphere
  tests → step-up has nothing to step onto → player stuck.
- FailingFrame_CottageNeighborA_Poly0x0004_HasExpectedShape — pins the
  exact polygon shape so a future fixture re-capture failure is loud.

What this gives us:
1. The bug is now ALWAYS reproducible in test, no live client iteration.
2. Any fix to BSPQuery.FindCrossedEdge / polygon containment / the
   cell transform will instantly show whether it changes the failing-
   frame outcome.
3. Step 4 (retail cdb capture) will tell us what retail finds at the
   same sphere position; Step 5 (comparison doc) will name the
   divergence; the eventual fix is then evidence-driven, not a guess.

The tests document the CURRENT (failing) behavior. They WILL pass
after the fix — at which point they need to flip to assert the
retail-correct behavior. This intentional brittleness is the point:
the test is the bug's gravestone, and a fix that doesn't match retail
should not satisfy the test.

Verification:
- dotnet build: green, 0 errors.
- dotnet test: 1167 passed + 8 pre-existing failed (was 1160+8 before
  this commit; +7 from the replay tests). Same pre-existing failures,
  no new regressions.
- Each Issue98 test runs in under 1ms; loads JSON, calls one internal
  predicate per polygon, asserts.

Next: tools/cdb/issue98-cellar-up-find-walkable.cdb (Step 4).
2026-05-23 15:25:40 +02:00
..
AnimationCommandRouterTests.cs fix(anim): Phase L.1b route motion commands 2026-04-28 10:46:22 +02:00
AnimationHookRouterTests.cs feat(anim): Phase E.1 hook router + GameWindow wiring 2026-04-18 16:30:23 +02:00
AnimationSequencerTests.cs fix(animation): close #61 + smooth stop from backward/sidestep-left/turn-left 2026-05-18 15:16:20 +02:00
BSPQueryTests.cs test(physics): BSPQuery.FindCollisions writes world-space plane with translated origin 2026-05-20 07:58:37 +02:00
BSPStepUpFixtures.cs feat(physics): Phase L.2.1+L.2.2 — BSP step-up and rooftop landing 2026-04-29 16:16:39 +02:00
BSPStepUpTests.cs fix(physics): L.4 — steep airborne hits slide-tangent (interim, deviates from retail) 2026-04-30 13:22:07 +02:00
CellDumpRoundTripTests.cs feat(phys): A6.P3 #98 Step 2 — cell-dump probe + roundtrip test 2026-05-23 15:16:56 +02:00
CellPhysicsPortalWiringTests.cs feat(physics): Phase 2 — wire CellBSP + Portals into CellPhysics 2026-05-19 16:52:20 +02:00
CellSurfaceTests.cs feat(core): Phase B.3 — CellSurface (indoor floor polygon projection) 2026-04-12 09:51:22 +02:00
CellTransitAddAllOutsideCellsTests.cs feat(physics): Phase 2 — port CellTransit + wire into ResolveCellId 2026-05-19 17:14:04 +02:00
CellTransitCheckBuildingTransitTests.cs refactor(physics): Phase 2 — code-review polish on BuildingPhysics commit 2026-05-19 18:01:44 +02:00
CellTransitFindCellListTests.cs feat(physics): Phase 2 — BuildingPhysics + CheckBuildingTransit 2026-05-19 17:34:38 +02:00
CellTransitFindCellSetTests.cs chore(phys): A6.P3 #98 triage — revert neg-poly + bldg-check experiments 2026-05-23 15:11:49 +02:00
CellTransitFindTransitCellsSphereTests.cs chore(phys): A6.P3 #98 triage — revert neg-poly + bldg-check experiments 2026-05-23 15:11:49 +02:00
CollisionExemptionTests.cs fix(phys L.2g slice 1b): widen CollisionExemption to ETHEREAL alone 2026-05-13 18:27:06 +02:00
CollisionPrimitivesTests.cs feat(physics): port 9 collision primitives from acclient.exe (chunk_00530000.c) 2026-04-12 23:53:47 +02:00
EntityCollisionFlagsTests.cs feat(physics): live-entity collision plumbing (Commit A) 2026-04-29 13:12:56 +02:00
FindEnvCollisionsMultiCellTests.cs Reapply "feat(physics): A4 — wire CheckOtherCells into FindEnvCollisions" 2026-05-20 20:06:14 +02:00
IndoorContactPlaneRetentionTests.cs docs(test): A6.P3 slice 1 T5 — update stale call-chain reference in test doc 2026-05-22 09:37:52 +02:00
IndoorWalkablePlaneTests.cs Revert "fix(physics): remove per-frame indoor walkable-plane synthesis" 2026-05-20 09:17:24 +02:00
InterpolationManagerTests.cs feat(motion): L.3 M1 — fresh InterpolationManager port + retail spec 2026-05-05 14:56:42 +02:00
Issue98CellarUpReplayTests.cs test(phys): A6.P3 #98 Step 3 — deterministic replay harness 2026-05-23 15:25:40 +02:00
MotionCommandResolverTests.cs fix(anim): Phase L.1b route motion commands 2026-04-28 10:46:22 +02:00
MotionInterpreterTests.cs test(physics): MyRunRate fallback test for GetMaxSpeed (L.3.1 Task 2 polish) 2026-05-02 19:20:39 +02:00
PhysicsBodyTests.cs feat(core): port decompiled AC client physics — CollisionPrimitives + PhysicsBody 2026-04-12 23:54:51 +02:00
PhysicsDiagnosticsTests.cs chore(phys): A6.P3 #98 triage — revert neg-poly + bldg-check experiments 2026-05-23 15:11:49 +02:00
PhysicsEngineTests.cs fix(physics): Cluster A #84 + #85 — indoor cell tracking 2026-05-19 15:20:36 +02:00
PlayerWeenieTests.cs feat(physics): PlayerWeenie with retail Run/Jump formulas 2026-04-13 23:15:25 +02:00
PortalInfoTests.cs feat(physics): Phase 2 — wire CellBSP + Portals into CellPhysics 2026-05-19 16:52:20 +02:00
PortalPlaneTests.cs feat(core): Phase B.3 — PortalPlane (plane math + crossing detection) 2026-04-12 18:17:48 +02:00
PositionManagerTests.cs fix(motion): project anim root motion onto terrain plane (slope staircase) 2026-05-05 21:37:42 +02:00
RemoteMoveToDriverTests.cs fix(retail): rotation rate, useability gate, retail toast strings 2026-05-16 12:17:54 +02:00
ResolveCellIdTests.cs feat(physics): Phase 2 — BuildingPhysics + CheckBuildingTransit 2026-05-19 17:34:38 +02:00
ServerControlledLocomotionTests.cs fix(anim): Phase L.1c match MoveTo run speed 2026-04-28 20:58:22 +02:00
ShadowObjectRegistryTests.cs feat(phys L.2g slice 1): ShadowObjectRegistry.UpdatePhysicsState 2026-05-12 22:22:32 +02:00
SphereIntersectsCellBspTests.cs fix(physics): #90 — sphere-overlap cell stickiness at doorway threshold 2026-05-20 20:30:36 +02:00
TerrainSurfaceTests.cs fix(scenery): #49 9×9 loop, per-spawn building check, triangle slope 2026-05-07 21:15:11 +02:00
TransitionCheckOtherCellsTests.cs chore(phys): A6.P3 #98 triage — revert neg-poly + bldg-check experiments 2026-05-23 15:11:49 +02:00
TransitionTests.cs feat(physics): Transition.FindTransitionalPosition core algorithm 2026-04-13 23:52:45 +02:00
TransitionTypesTests.cs Revert "fix(physics): remove per-frame indoor walkable-plane synthesis" 2026-05-20 09:17:24 +02:00
WalkMissDiagnosticTests.cs feat(physics): WalkMissDiagnostic aggregator for ISSUES #83 probe spike 2026-05-20 10:31:39 +02:00