diff --git a/src/AcDream.Core/Physics/PhysicsDiagnostics.cs b/src/AcDream.Core/Physics/PhysicsDiagnostics.cs index 5930c2d..6f365f7 100644 --- a/src/AcDream.Core/Physics/PhysicsDiagnostics.cs +++ b/src/AcDream.Core/Physics/PhysicsDiagnostics.cs @@ -276,6 +276,34 @@ public static class PhysicsDiagnostics public static bool ProbeWalkMissEnabled { get; set; } = Environment.GetEnvironmentVariable("ACDREAM_PROBE_WALK_MISS") == "1"; + /// + /// Phase A6.P1 cdb probe spike (2026-05-21). When true, every BSP + /// collision response site emits a structured [push-back] line: + /// input/output sphere center, plane geometry, push-back delta, walk + /// interp, and the dispatcher's selected path. Direct comparison to + /// retail's cdb breakpoint set documented at + /// tools/cdb/a6-probe.cdb. + /// + /// + /// Three emission sites: + /// (the suspected over-correction site), + /// (the 6-path dispatcher), and + /// (multi-cell BSP iteration outcomes). All three are zero-cost when + /// off — checked via early-out at each site. + /// + /// + /// + /// Initial state from ACDREAM_PROBE_PUSH_BACK=1. + /// Runtime-toggleable via DebugVM mirror. + /// + /// + /// + /// Spec: docs/superpowers/specs/2026-05-21-phase-a6-indoor-physics-fidelity-design.md. + /// + /// + public static bool ProbePushBackEnabled { get; set; } = + Environment.GetEnvironmentVariable("ACDREAM_PROBE_PUSH_BACK") == "1"; + public static void LogCpBoolWrite(string field, bool oldValue, bool newValue) { var caller = GetCpCallerName(); diff --git a/tests/AcDream.Core.Tests/Physics/PhysicsDiagnosticsTests.cs b/tests/AcDream.Core.Tests/Physics/PhysicsDiagnosticsTests.cs index 5103de1..ea09735 100644 --- a/tests/AcDream.Core.Tests/Physics/PhysicsDiagnosticsTests.cs +++ b/tests/AcDream.Core.Tests/Physics/PhysicsDiagnosticsTests.cs @@ -95,4 +95,27 @@ public class PhysicsDiagnosticsTests PhysicsDiagnostics.LastBspHitPoly = initial; } } + + // ----------------------------------------------------------------------- + // ProbePushBackEnabled — flag gates the [push-back] emission path. + // A6.P1 (2026-05-21). + // ----------------------------------------------------------------------- + + [Fact] + public void ProbePushBack_StaticApi_Roundtrip() + { + bool initial = PhysicsDiagnostics.ProbePushBackEnabled; + try + { + PhysicsDiagnostics.ProbePushBackEnabled = true; + Assert.True(PhysicsDiagnostics.ProbePushBackEnabled); + + PhysicsDiagnostics.ProbePushBackEnabled = false; + Assert.False(PhysicsDiagnostics.ProbePushBackEnabled); + } + finally + { + PhysicsDiagnostics.ProbePushBackEnabled = initial; + } + } }