From 914638819d419307167ab19683ce59bb6785eaa5 Mon Sep 17 00:00:00 2001 From: Erik Date: Tue, 19 May 2026 12:36:37 +0200 Subject: [PATCH] feat(wb): extend NULL_RESULT probe with reader-divergence diagnostic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 2 Task 1's continuation logged [indoor-upload] NULL_RESULT when WB's PrepareMeshDataAsync returned null. Extend the line to include two cross-checks: ourCellDb.TryGet= — acdream's DatCollection.Cell.TryGet wbResolveId.Count= — WB's DefaultDatReaderWriter.ResolveId().Count This narrows the cause among WB's null-return paths (ResolveId empty vs TryGet failure vs wrong type). Best-effort: both calls wrapped in try/catch so diagnostic failures don't propagate. Capture: 55 NULL_RESULTs across multiple landblocks ALL show ourCellDb.TryGet=True + wbResolveId.Count=1. Both readers find the cells in their indices, but WB's downstream PrepareMeshData logic still returns null. Divergence is downstream of ResolveId. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/AcDream.App/Rendering/Wb/WbMeshAdapter.cs | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/AcDream.App/Rendering/Wb/WbMeshAdapter.cs b/src/AcDream.App/Rendering/Wb/WbMeshAdapter.cs index 0d8dee8..9893e31 100644 --- a/src/AcDream.App/Rendering/Wb/WbMeshAdapter.cs +++ b/src/AcDream.App/Rendering/Wb/WbMeshAdapter.cs @@ -175,7 +175,30 @@ public sealed class WbMeshAdapter : IDisposable, IWbMeshAdapter } else if (t.IsCompletedSuccessfully && t.Result is null) { - Console.WriteLine($"[indoor-upload] NULL_RESULT cellId=0x{cellId:X8}"); + // Phase 2 cause-narrowing: WB's PrepareMeshData can return + // null for several reasons (ResolveId empty / TryGet + // failed / type Unknown). Cross-check against acdream's own + // DatCollection — if WE find the cell but WB doesn't, the + // divergence is between dat readers, not a missing record. + bool ourCellFound = false; + try + { + ourCellFound = _dats?.Cell.TryGet( + (uint)cellId, out _) ?? false; + } + catch { /* swallow — this is best-effort diagnostic */ } + + int wbResolveCount = -1; + try + { + wbResolveCount = _wbDats?.ResolveId((uint)cellId).Count() ?? -1; + } + catch { /* swallow — best-effort */ } + + Console.WriteLine( + $"[indoor-upload] NULL_RESULT cellId=0x{cellId:X8} " + + $"ourCellDb.TryGet={ourCellFound} " + + $"wbResolveId.Count={wbResolveCount}"); } }, TaskScheduler.Default); }