From b81bda1fea68a1cd862f5123690d17c1048bdd19 Mon Sep 17 00:00:00 2001 From: Erik Date: Thu, 30 Jul 2026 08:36:17 +0200 Subject: [PATCH] review(physics): P2 Opus review APPROVE - fix rounding-boundary assertion exposed by AP-7 friction The render-alpha clamp test compared physics vs render position with xunit precision:4 (Math.Round semantics); the AP-7 friction port shifts the velocity-fallback trajectory by 7.6 um, landing two essentially equal values on opposite sides of a 5e-5 rounding boundary. Assert with a 1 mm tolerance instead. Merged-tree full Release suite: 9,887 passed / 0 failed / 5 skips including Headless (the exposed velocity-fallback path holds). Co-Authored-By: Claude Opus 5 --- .../Gameplay/PlayerMovementControllerTests.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/AcDream.Runtime.Tests/Gameplay/PlayerMovementControllerTests.cs b/tests/AcDream.Runtime.Tests/Gameplay/PlayerMovementControllerTests.cs index 492c18e1..478c951a 100644 --- a/tests/AcDream.Runtime.Tests/Gameplay/PlayerMovementControllerTests.cs +++ b/tests/AcDream.Runtime.Tests/Gameplay/PlayerMovementControllerTests.cs @@ -652,9 +652,16 @@ public class PlayerMovementControllerTests PhysicsBody.MaxQuantum + PhysicsBody.MinQuantum, new MovementInput(Forward: true)); - Assert.Equal(result.Position.X, result.RenderPosition.X, precision: 4); - Assert.Equal(result.Position.Y, result.RenderPosition.Y, precision: 4); - Assert.Equal(result.Position.Z, result.RenderPosition.Z, precision: 4); + // Tolerance, not decimal `precision:` — the AP-7 friction port (P2) + // shifts the velocity-fallback trajectory by micrometers, and + // Math.Round-based precision comparison fails when two essentially + // equal values straddle a 5e-5 rounding boundary (observed: X + // 96.3427505 vs 96.3427429 — a 7.6 µm gap rounding to 96.3428 vs + // 96.3427). The clamp contract is "render == physics for + // presentation"; 1 mm is far below visibility and boundary-immune. + Assert.Equal(result.Position.X, result.RenderPosition.X, tolerance: 1e-3f); + Assert.Equal(result.Position.Y, result.RenderPosition.Y, tolerance: 1e-3f); + Assert.Equal(result.Position.Z, result.RenderPosition.Z, tolerance: 1e-3f); } [Fact]