feat(physics): A6.P1 — add ProbePushBackEnabled toggle

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) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-05-21 18:24:22 +02:00
parent 0bdd5c7fca
commit ace9e62213
2 changed files with 51 additions and 0 deletions

View file

@ -276,6 +276,34 @@ public static class PhysicsDiagnostics
public static bool ProbeWalkMissEnabled { get; set; } =
Environment.GetEnvironmentVariable("ACDREAM_PROBE_WALK_MISS") == "1";
/// <summary>
/// Phase A6.P1 cdb probe spike (2026-05-21). When true, every BSP
/// collision response site emits a structured <c>[push-back]</c> 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
/// <c>tools/cdb/a6-probe.cdb</c>.
///
/// <para>
/// Three emission sites: <see cref="BSPQuery.AdjustSphereToPlane"/>
/// (the suspected over-correction site), <see cref="BSPQuery.FindCollisions"/>
/// (the 6-path dispatcher), and <see cref="Transition.CheckOtherCells"/>
/// (multi-cell BSP iteration outcomes). All three are zero-cost when
/// off — checked via early-out at each site.
/// </para>
///
/// <para>
/// Initial state from <c>ACDREAM_PROBE_PUSH_BACK=1</c>.
/// Runtime-toggleable via DebugVM mirror.
/// </para>
///
/// <para>
/// Spec: <c>docs/superpowers/specs/2026-05-21-phase-a6-indoor-physics-fidelity-design.md</c>.
/// </para>
/// </summary>
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();

View file

@ -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;
}
}
}