feat(viewer): per-model load report with actionable geometry warnings
Closes #3927
What
A compact per-model Load Report panel: source/schema, resolved load path (wasm/cache/server/point-cloud), tessellation tier and fast-mode setting, and the load's existing GeometryDiagnostics (CSG failures, silent no-op cuts, dropped representation items, oversized content-hash reference drops) rendered as actionable text. JSON export mirrors the IDS export pattern.
apps/viewer/src/lib/loadReport.ts— pure aggregation (buildLoadReport/buildLoadReports), JSON export (buildLoadReportJSON/downloadLoadReportJSON), andModelLoadReportFields(the new fields mixed intoFederatedModel) plusbuildModelLoadReportPatch, a small helper shared byuseIfcLoader.ts's twofinalizeModelwrite sites so they can't drift.apps/viewer/src/components/viewer/LoadReportPanel.tsx— the panel UI.apps/viewer/src/store/types.ts—FederatedModel extends ModelLoadReportFields(diagnostics,loadFormat,loadPath,tessellationTier,skipSmallCuts).apps/viewer/src/hooks/useIfcLoader.ts— threadsloadDiagnostics/format/tier/skip-cuts onto the model record at everyfinalizeModelcall site (point-cloud, IFCX, GLB, cache-hit, server, wasm-streaming ×2), respecting the existing TDZ hazard aroundloadTessellationTier/skipSmallCutsAtLoad(same reasoninginstancedShardsdocuments there — some call sites run before those consts are declared, so the affected fields are only ever supplied where the setting genuinely applies).- Workspace-panel registry wiring:
lib/panels/registry.ts(newloadReportpanel id),lib/panels/renderPanelBody.tsx,toolbar/useWorkspacePanelControls.ts,CommandPalette.tsx(newpanel:loadReportcommand),ribbon/tabs/AnalyzeTab.tsx(new ribbon button).
Assumptions
- Affected entities: only
GeometryDiagnostics.worstHostsentries become affected-entity rows, because those are the only diagnostic category carrying an identity (productId+ifcType).unsupportedItemsByTypeandfailuresByReasoncarry only a reason string and a count — no identity — so they surface as aggregate actionable text instead of a fabricated entity row. This follows directly from the contract's own shape. - "Renderable": a worst-host entry is treated as selectable/frameable only when it carries a captured
bbox(the one signal in the contract that a mesh is actually present). Without abbox, the row shows its source identity (#productId IfcType) as plain, unclickable text rather than inventing a selection target.
Why no MainToolbar dropdown entry
I initially added one, but MainToolbar.tsx is already at its module-size budget (1165 lines) and the entry pushed it to 1166 — one line over. Rather than raise the allowlisted budget, I removed the toolbar entry entirely: the Analyze ribbon button and the command palette entry (panel:loadReport) already give full discoverability, matching how e.g. the sources panel isn't in the ribbon either. Not an oversight — a deliberate trade against the module-size gate.
Also flag-free: the new loadReport panel id has no dedicated *PanelVisible boolean, following the zones panel's precedent (#1869) — openWorkspacePanel's existing non-SIDEBAR_PANEL_FLAGS branch adopts it directly.
Tests
apps/viewer/src/lib/loadReport.test.ts(new, 15 tests,node:test): covers the unavailable/clean/issues-found distinction, every diagnostic category's actionable text, approximation-setting notes,globalIdresolution (productId + idOffset), the renderable-vs-identity-only gate, and refusing to invent an affected entity fromunsupportedItemsByType.- Mutation-tested the core logic: (1) swapped the dropped-items guard to check
totalCsgFailuresinstead oftotalUnsupportedItems→ 2 tests failed; (2) deleted thesilentNoOpsaction branch entirely → 2 tests failed; (3) forcedrenderable: trueunconditionally → 1 test failed. All three caught, then reverted. - UI wiring (the panel component, registry, ribbon button, command palette entry) is not unit-tested — no existing test harness in this codebase covers that layer for sibling panels either.
What I ran (not the full suite)
Given apps/viewer's ~666-file suite is slow and is CI's job, I ran only the targeted tests: loadReport.test.ts (new, 15/15) plus every existing sibling test file for the modules I touched — lib/panels/registry.test.ts, store/types.test.ts, and all 7 useIfcLoader.*.test.tsx files (cache-hit telemetry, primary/GLB federation offset, federated id offset, cache staleness, IFCX stale guard, SAB streaming, instanced-shards TDZ, federated align stale guard) — 53/53 passing. renderPanelBody.tsx, useWorkspacePanelControls.ts, CommandPalette.tsx, and AnalyzeTab.tsx have no sibling test files.
Update: the full pnpm test --filter @ifc-lite/viewer run I'd started in the background (and moved on from without waiting) has since finished: 6937 tests, 6931 pass, 0 fail, 6 skipped (pre-existing skips, unrelated to this change), exit code 0.
Also ran: pnpm typecheck (full monorepo via turbo, 89/89 tasks), node scripts/check-module-size.mjs (0 new over budget), node scripts/check-test-wiring.mjs, node scripts/check-source-text-assertions.mjs — all green.
Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com
Summary by CodeRabbit
-
New Features
- Added a per-model Load Report panel accessible from the Analyze tab and command palette.
- View source details, loading settings, diagnostics, geometry warnings, and affected entities.
- Select and frame renderable affected entities in the viewer.
- Export load reports as JSON.
- Clearly distinguishes unavailable diagnostics, clean loads, and loads with issues.
-
Bug Fixes
- Improved visibility of loading diagnostics and geometry-related problems across supported model loading paths.