fix(phys): #107 gate-run regression — auto-entry hold opened on a mid-population cache read; wait for the claimed cell itself

Gate-run finding (wedge-107-gate-indoor-login.log + dat scan): ACE saved the
cell one room off (claim 0xA9B40172, position inside 0xA9B40171 — adjacent
rooms). FindVisibleChildCell corrects this fine when hydrated (proven by the
new AdjacentRoomClaim regression test), but the live entry committed the raw
claim: IsSpawnCellReady's "any cell struct in the landblock => claim is bogus,
proceed" disambiguator observed the MID-POPULATION state (interiors hydrate in
id order on the background worker; the render-thread predicate read the cache
mid-loop) and opened the gate before the claim and its stab neighbors were
cached. AdjustPosition then saw a null cell struct and silently passed the
claim through; the first movement demoted the player to outdoor inside the
house — the user-visible "transparent interior, see straight through walls"
(render is downstream of membership: an outdoor-classified viewer only sees
the interior through the doorway flood).

Fix: the hold now waits for THE CLAIMED CELL's struct, full stop
(IsSpawnCellReady simplification; HasAnyCellStructInLandblock removed).
Claims that can never hydrate are filtered by GameWindow against the dat's
LandBlockInfo.NumCells range (memoized IsSpawnClaimUnhydratable), and
PhysicsEngine.Resolve carries a loud lost-cell-equivalent safety net: an
indoor claim with NO cell struct AND NO CellSurface floor data demotes to the
outdoor landcell with a [spawn-adjust] line instead of committing raw
(retail GotoLostCell :283418; documented divergence). Partial hydration
(CellSurface present, struct pending) keeps the legacy floor-snap behavior —
HasCellSurface uses the file's masked-low-word norm so bare-id fixtures and
full-id production both resolve.

Baseline restored: Core 1381 (+4 new #107 conformance tests) + 4 pre-existing
#99-era failures + 1 skip; App 223 / UI 420 / Net 294.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-10 13:10:01 +02:00
parent 34fcbc3806
commit e4f6750e09
4 changed files with 130 additions and 24 deletions

View file

@ -108,6 +108,36 @@ public sealed class Issue107SpawnDiagnosticTests
_out.WriteLine($"0x{PoisonedClaim:X8}.SeenOutside={inn!.SeenOutside}");
}
[Fact]
public void AdjacentRoomClaim_CorrectsToContainingRoom_ViaStabList()
{
// 2026-06-10 gate-run regression: ACE saved the cell one room off
// (claim 0xA9B40172, position inside 0xA9B40171 — adjacent rooms of the
// threshold cottage, connected via the 20 cm threshold cell 0x173).
// With every cell hydrated, retail's find_visible_child_cell stab-list
// search (acclient :311444) must correct the claim. The live failure
// was the auto-entry hold opening before 0x171 hydrated (the
// mid-population "any cell present" disambiguator, since removed) —
// this test pins the hydrated-path correctness.
var datDir = ConformanceDats.ResolveDatDir();
if (datDir is null) { _out.WriteLine("dats unavailable — skipped"); return; }
using var dats = new DatCollection(datDir, DatAccessType.Read);
var cache = new PhysicsDataCache();
for (uint low = 0x0100; low <= 0x01FF; low++)
{
try { ConformanceDats.LoadEnvCell(dats, cache, 0xA9B40000u | low); }
catch { }
}
// The gate-run spawn point (ACE save: cell 0x172, position in 0x171).
var spawnFootCenter = new Vector3(155.390f, 11.020f, 94.0f + FootRadius);
uint corrected = CellTransit.FindVisibleChildCell(
cache, 0xA9B40172u, spawnFootCenter, useStabList: true);
_out.WriteLine($"FindVisibleChildCell(claim 0x172, stab) -> 0x{corrected:X8}");
Assert.Equal(ActualCell, corrected);
}
[Fact]
public void PoisonedClaim_IsADifferentBuilding_55mAway()
{