fix(eval): degrade gracefully when a static asset import is missing - #3805
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix(eval): degrade gracefully when a static asset import is missing#3805posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
.step,.obj,.stl, and.kicad_modare already first-class extensions (lib/runner/resolveFilePath.ts,lib/shared/static-asset-extensions.ts). But when the asset is absent from thefsMap, resolution returnsnulland the import falls through to the fatal throw atlib/eval/import-eval-path.ts:344, so a missing 3D preview model kills the whole board.Changes
importEvalPath, checkisStaticAssetPath(importName).ctx.logger.info+console.warn) and register an empty default inpreSuppliedImports, then return — the component renders without its asset.fsMap— beforefsMap— after.step,.obj,.stl,.kicad_mod).ts,.tsx, ...)Test
tests/features/static-file-imports/missing-static-file-import.test.ts: a board imports a missing.objand still renders (resistor present).main(throwsUnresolved import) and passes with this change.bunx tsc --noEmitandbiome formatare clean.Notes
console.warnplus logger entry are the surfacing available here. Wiring it into the editor UI belongs in the editor repo.Agent context
Created with PostHog Desktop from this inbox report.