feat(phys): A6.P3 #98 — GfxObj dump infrastructure (ACDREAM_DUMP_GFXOBJS)

Mirror the existing ACDREAM_DUMP_CELLS pattern for GfxObj-owned geometry:
when ACDREAM_DUMP_GFXOBJS lists a hex GfxObj id, the first
PhysicsDataCache.CacheGfxObj for that id writes the full resolved
polygon table to a JSON fixture under
tests/AcDream.Core.Tests/Fixtures/issue98/0x{id:X8}.gfxobj.json (override
dir via ACDREAM_DUMP_GFXOBJS_DIR).

Motivation: the existing [resolve-bldg] probe captures GfxObj-level
metadata (id, BSP root radius, entity origin) but emits
"hitPoly: n/a (BSP path — side-channel not written)" because the
BSPQuery wire site that would populate LastBspHitPoly never landed.
A polygon-level dump at cache time bypasses that gap — one capture run
yields the FULL polygon table, fixture-loadable by the harness's
RegisterCottageGfxObj helper (next commit).

See docs/research/2026-05-23-a6-p3-issue98-comparison-harness-findings.md
for the cottage GfxObj 0x01000A2B context: landblock-baked static at
entity origin (130.5, 11.5, 94.0), responsible for the head-sphere cap
from below at world Z=94.0 that issue #98 is documenting.

Test baseline: 1183 + 8 pre-existing failures (serial run; +5 new tests
all pass; was 1178 + 8 pre-session).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-05-23 20:24:26 +02:00
parent 4d83ba5620
commit cc3afbcbeb
5 changed files with 484 additions and 1 deletions

View file

@ -429,6 +429,45 @@ public static class PhysicsDiagnostics
public static bool ProbeDumpCellsEnabled => ProbeDumpCellIds.Count > 0;
/// <summary>
/// A6.P3 issue #98 (2026-05-23 evening v2) — GfxObj-equivalent of
/// <see cref="ProbeDumpCellIds"/>. When non-empty, dumps the polygon
/// table + BSP root metadata of any cached GfxObj whose id matches
/// one of the listed values, as a JSON fixture under
/// <see cref="ProbeDumpGfxObjsPath"/>. One-shot per id (a second
/// cache of the same GfxObj is a no-op).
///
/// <para>
/// Configured via <c>ACDREAM_DUMP_GFXOBJS</c> as a comma-separated
/// list of hex GfxObj ids (with or without <c>0x</c> prefix). Output
/// defaults to <c>tests/AcDream.Core.Tests/Fixtures/issue98</c>
/// (relative to the worktree root) with one file per id named
/// <c>0x{id:X8}.gfxobj.json</c> so it doesn't collide with cell
/// dumps in the same directory. Override directory via
/// <c>ACDREAM_DUMP_GFXOBJS_DIR=&lt;dir&gt;</c>.
/// </para>
///
/// <para>
/// The motivation: the existing <c>[resolve-bldg]</c> probe captures
/// the GfxObj-level metadata (id, BSP root radius, entity origin) but
/// emits <c>hitPoly: n/a (BSP path — side-channel not written)</c>
/// because the BSPQuery wire site that would populate
/// <see cref="LastBspHitPoly"/> never landed. A polygon-level dump
/// at cache time bypasses that gap entirely — one capture run yields
/// the FULL polygon table, suitable for fixture-loading in
/// <c>CellarUpTrajectoryReplayTests</c>'s <c>RegisterCottageGfxObj</c>
/// helper.
/// </para>
/// </summary>
public static IReadOnlySet<uint> ProbeDumpGfxObjIds { get; set; } =
ParseHexIdList(Environment.GetEnvironmentVariable("ACDREAM_DUMP_GFXOBJS"));
public static string ProbeDumpGfxObjsPath { get; set; } =
Environment.GetEnvironmentVariable("ACDREAM_DUMP_GFXOBJS_DIR")
?? "tests/AcDream.Core.Tests/Fixtures/issue98";
public static bool ProbeDumpGfxObjsEnabled => ProbeDumpGfxObjIds.Count > 0;
private static IReadOnlySet<uint> ParseHexIdList(string? raw)
{
if (string.IsNullOrWhiteSpace(raw))