From ace9e62213acc1d4bf68b11b557168eb0c36f1e1 Mon Sep 17 00:00:00 2001 From: Erik Date: Thu, 21 May 2026 18:24:22 +0200 Subject: [PATCH] =?UTF-8?q?feat(physics):=20A6.P1=20=E2=80=94=20add=20Prob?= =?UTF-8?q?ePushBackEnabled=20toggle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New PhysicsDiagnostics flag gates the [push-back] probe shipping in subsequent tasks. Env-var ACDREAM_PROBE_PUSH_BACK=1 + DebugVM mirror, matching the existing probe-toggle pattern. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../Physics/PhysicsDiagnostics.cs | 28 +++++++++++++++++++ .../Physics/PhysicsDiagnosticsTests.cs | 23 +++++++++++++++ 2 files changed, 51 insertions(+) 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; + } + } }