Skip to content

fix(eval): degrade gracefully when a static asset import is missing - #3805

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixeval-dont-fail-the-whole-render-on-a-c7d164
Draft

fix(eval): degrade gracefully when a static asset import is missing#3805
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixeval-dont-fail-the-whole-render-on-a-c7d164

Conversation

@posthog

@posthog posthog Bot commented Aug 10, 2026

Copy link
Copy Markdown

Problem

  • A user loses the entire circuit render — schematic, PCB, everything — when a package is missing one optional 3D model or footprint file; one user had to fall back to an older project version to get anything to draw.
  • .step, .obj, .stl, and .kicad_mod are already first-class extensions (lib/runner/resolveFilePath.ts, lib/shared/static-asset-extensions.ts). But when the asset is absent from the fsMap, resolution returns null and the import falls through to the fatal throw at lib/eval/import-eval-path.ts:344, so a missing 3D preview model kills the whole board.
  • Only the 3D view should degrade. A 60-day project-wide query found 10+ distinct static-asset unresolved-import messages across several packages and users.

Changes

  • Before the final throw in importEvalPath, check isStaticAssetPath(importName).
  • On a match: log a warning (ctx.logger.info + console.warn) and register an empty default in preSuppliedImports, then return — the component renders without its asset.
  • Keep the hard throw for source imports, which are a genuinely broken circuit.
Import type Missing in fsMap — before Missing in fsMap — after
Static asset (.step, .obj, .stl, .kicad_mod) Throws → whole render dies Warns, renders without the asset
Source file (.ts, .tsx, ...) Throws Throws (unchanged)

Test

  • New test tests/features/static-file-imports/missing-static-file-import.test.ts: a board imports a missing .obj and still renders (resistor present).
  • Verified it fails on main (throws Unresolved import) and passes with this change.
  • bunx tsc --noEmit and biome format are clean.

Notes

  • The report suggested also surfacing the skipped asset in the editor warning list. The eval runtime has no direct channel to that list; the console.warn plus logger entry are the surfacing available here. Wiring it into the editor UI belongs in the editor repo.
  • The five single-occurrence error-tracking issues in the report are missing source files (bad input) and correctly keep throwing; they are out of scope.

Agent context

  • Confirmed no open PR, branch, or issue touches these files.

Created with PostHog Desktop from this inbox report.

A missing static asset (.step, .obj, .stl, .kicad_mod, ...) resolved to null
and fell through to the fatal throw in importEvalPath, which took down the whole
render (schematic and PCB included), not just the 3D view.

Before that throw, check isStaticAssetPath(importName). When it matches, log a
warning and register an empty default in preSuppliedImports instead of throwing,
so the component renders without its 3D model. Source imports keep the hard throw.

Generated-By: PostHog Code
Task-Id: aba2d123-1376-417f-a180-bef4f60d27e2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants