fix(physics): AD-66 relands — the push-out uses retail's bare radius; plant-then-lift complete (#341 closed)
Some checks are pending
Headless portability / portable-headless (ubuntu-latest) (push) Waiting to run
Headless portability / portable-headless (windows-latest) (push) Waiting to run
Headless portability / linux-graphical (push) Waiting to run
Headless portability / linux-vulkan (push) Waiting to run

Third attempt, landed on evidence where the first two correctly refused:
the ten-run stability gate passed 10/10 bit-identical (0x42667451, two
clean-room cycles among the runs), the recalibrated golden's every value
measured with derivations rather than guessed, and the historical
measurement flip stands recorded as unexplained-but-unreproducible
after 37 hunt runs plus these 10 found no divergence anywhere.

The mechanism, completing the S4b byte-pin: validate_walkable plants
the sphere at perpendicular r*N.z (byte-faithful, untouched); this push
fires once per settle and lifts to tangent equilibrium dist=r, where
the trigger goes quiet — retail's slope hover, arriving via the push
exactly as the original substitution's own comment predicted retail
had. Sabotage: restoring radius*N.z reddens the discriminating
exact-value test verbatim. AD-65 conformance, the uphill no-flap
guard, and the #331 absorb pin all green untouched.

AD-66 retired (the campaign's last withheld row); AD-69's seam-frame
correction deliberately unbundled, stays active as its own follow-up.
Clean-room suite 11,267 / 4 / 0 — the suite's two AD-66 skips are gone.

User's "port the retail pair" decision is now fully executed; the
hover-look slope gate is the remaining acceptance.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-07 12:01:15 +02:00
parent e91f16e90c
commit 10efb5b1f9
5 changed files with 134 additions and 51 deletions

View file

@ -123,7 +123,13 @@ public class S4AdjustOffsetConformanceTests
/// zDist formula, not the radius*N.z one.</item>
/// </list>
/// </summary>
[Fact(Skip = "AD-66 WITHHELD 2026-08-07: retail's bare radius is byte-confirmed but the landing was pulled after the same clean-room binaries measured contradictory absorbed-tick behaviour flipping with test-assert shape alone. Unskip with the AD-66 relanding. See the S4 outcome note in the contract doc.")]
// AD-66 RELANDED 2026-08-08 (issue #341): the #341 boundary hunt ran 37
// measurements of the historical assert-shape flip across three JIT
// tiering configurations and found it unreproducible (37/37
// bit-identical). The reland's own ten-run gate on
// RuntimeRemoteUphillProgressTests.AnExactlyUpSlopeOffsetIsAbsorbedByThePersistedSlidingNormal
// also came back bit-identical across ten runs. Un-skipped.
[Fact]
public void AdjustOffset_SafetyPush_UsesBareRadiusForTriggerAndNumerator()
{
const float radius = 0.5f;
@ -172,7 +178,9 @@ public class S4AdjustOffsetConformanceTests
$"{(naturalRestingDistOld - dist) / normal.Z:F7} AND would not have fired at all.");
}
[Fact(Skip = "AD-66 WITHHELD 2026-08-07: retail's bare radius is byte-confirmed but the landing was pulled after the same clean-room binaries measured contradictory absorbed-tick behaviour flipping with test-assert shape alone. Unskip with the AD-66 relanding. See the S4 outcome note in the contract doc.")]
// AD-66 RELANDED 2026-08-08 (issue #341): see the sibling test's comment
// above for the boundary-hunt evidence. Un-skipped.
[Fact]
public void AdjustOffset_SafetyPush_DoesNotFire_WhenAboveBareRadiusThreshold()
{
const float radius = 0.5f;
@ -194,10 +202,11 @@ public class S4AdjustOffsetConformanceTests
// =========================================================================
// Uphill no-flap guard. Written as the S4 contract's AD-66 STOP-condition
// scenario; AD-66 was then WITHHELD (issue #341), so this currently runs
// against the RETAINED radius*N.z substitution and its green is evidence
// about THAT code. It must stay green across the AD-66 relanding too —
// it is the scenario the substitution was originally written to protect.
// scenario. AD-66 relanded 2026-08-08 (issue #341's boundary hunt); this
// now runs against the bare-radius push and stays green under the
// plant-then-lift mechanism (the lift settles to tangent equilibrium on
// first contact and then goes quiet, so it does not re-fire every tick
// and does not flap OnWalkable running uphill).
// =========================================================================
/// <summary>
@ -292,8 +301,9 @@ public class S4AdjustOffsetConformanceTests
$"tick {tick}: contact must not be lost running uphill (the AD-66 flap symptom)");
Assert.True(result.OnWalkable,
$"tick {tick}: OnWalkable must not flap to false running uphill on a walkable " +
"slope. Written as the S4/AD-66 STOP condition; with AD-66 withheld (#341) it " +
"guards the RETAINED substitution and must survive the relanding.");
"slope. Written as the S4/AD-66 STOP condition; AD-66 relanded 2026-08-08 " +
"(#341's boundary hunt) and this guards the bare-radius push under the " +
"plant-then-lift mechanism.");
position = result.Position;
}

View file

@ -171,6 +171,26 @@ public sealed class RuntimeRemoteUphillProgressTests
/// writeback cleared <c>SLIDING</c>, so there is no persisted normal left
/// to absorb against. The absorb needs a live latch, not a particular
/// heading.</para>
///
/// <para><b>AD-66 recalibration, issue #341 (2026-08-08 reland).</b> With
/// the bare-radius safety push live, the planted-but-not-yet-lifted spawn
/// position (<c>latched</c> — <c>ValidateWalkable</c> plants the sphere
/// at perpendicular distance <c>radius * Normal.Z</c> from the contact
/// plane, byte-faithfully; see the block comment on
/// <c>Transition.AdjustOffset</c>'s safety check) is no longer a fixed
/// point of that check: <c>dist &lt; radius - EPSILON</c> holds there, so
/// the push fires. XY still latches EXACTLY — the absorbed up-slope
/// offset still projects to zero on the pure cross-slope crease, and the
/// push is a pure +Z addition — but Z is lifted ONCE, on the first of the
/// five absorbed ticks, to tangent equilibrium (perpendicular distance ==
/// the bare radius), then the trigger goes quiet for ticks 2-5 (the
/// plant-then-lift mechanism: the PUSH supplies the one-time lift, not
/// the plant, exactly as the original AD-66 comment argued). The lift is
/// <c>r * (1/N.z - 1)</c> for <c>r = 0.48</c> (this harness's sphere
/// radius) and <c>N.z = 1/sqrt(1 + 0.6^2) = 0.857493</c> (this ramp's
/// normal, per the class doc comment); the #341 boundary hunt measured
/// the resulting Z bit-identically 37/37 times (bits <c>0x42667451</c> =
/// 57.6135902...), reconfirmed by this reland's own ten-run gate.</para>
/// </summary>
[Fact]
public void AnExactlyUpSlopeOffsetIsAbsorbedByThePersistedSlidingNormal()
@ -192,7 +212,23 @@ public sealed class RuntimeRemoteUphillProgressTests
harness.Tick(5, ExactlyUpSlopeRootMotionPerTick);
Assert.Equal(latched, body.Position);
// AD-66 (#341): X and Y still latch EXACTLY — measured bit-for-bit
// identical to `latched` (SingleToUInt32Bits equal) both during this
// recalibration and across the reland's ten-run gate. Z no longer
// latches: the bare-radius safety push fires once (see the class doc
// comment above for the derivation) lifting the planted spawn
// position to tangent equilibrium. The formula below reproduces the
// measured value to within 4 decimal places — it differs from the
// engine's actual step-by-step float computation by ~3 ULP, since
// the real `dist` the engine measures is not bit-identical to the
// idealized `radius * N.z` algebra — so the comparison uses the same
// decimal-place tolerance as the rest of this class rather than an
// exact bit compare. The exact measured bits, stable 37/37 in the
// #341 boundary hunt and across this gate, are 0x42667451.
Assert.Equal(latched.X, body.Position.X);
Assert.Equal(latched.Y, body.Position.Y);
float expectedLiftedZ = latched.Z + 0.48f * (1f / 0.857493f - 1f);
Assert.Equal(expectedLiftedZ, body.Position.Z, 4);
Assert.True((body.TransientState & TransientStateFlags.Sliding) != 0);
// One ordinary off-gradient tick is itself absorbed — the crease is the
@ -204,11 +240,30 @@ public sealed class RuntimeRemoteUphillProgressTests
Assert.True(
body.Position.X > latched.X,
$"the cross-slope component was absorbed too (pos {body.Position})");
// Post-off-gradient Z (AD-66/#341): this successful step re-plants
// the body via ValidateWalkable at the NEW ground contact point,
// undoing the transient lift — the one-time push does not carry
// forward across a re-plant. The step only moved X (Y is unchanged
// by the same cross-slope-only crease as above), and this ramp's
// height depends on Y alone (RemoteRampHarness.Ramp's heightmap
// varies only with y), so the freshly-planted resting Z at the same
// Y is the SAME planted distance (radius * Normal.Z) as the original
// `latched.Z`. Measured 57.53382 against latched.Z's 57.53383, a
// ~1e-5 difference from the resolve pipeline's own floating-point
// accumulation — comfortably inside the existing 4-decimal-place
// tolerance, unchanged by the relanding.
Assert.Equal(latched.Z, body.Position.Z, 4);
// From the next tick on the body climbs normally.
harness.Tick(1, UphillRootMotionPerTick);
// Final climb baseline (AD-66/#341): measured Z = 57.576443, a
// ~0.0426 m climb over the latched baseline in one ordinary tick —
// comfortably clear of both `latched.Z` and the transient lifted
// value. Unlike the two fixed points above, this keeps moving tick
// over tick and is not itself a stable quantity to pin exactly, so
// the loose lower-bound remains the right assertion shape.
Assert.True(
body.Position.Z > latched.Z,
$"body did not climb once the latch cleared (pos {body.Position})");