fix(core): fill slab/ceiling hole fields on scene load - #903
Open
alxbouchard wants to merge 1 commit into
Open
alxbouchard wants to merge 1 commit into
alxbouchard wants to merge 1 commit into
Conversation
Slabs and ceilings written by third-party exporters (scanning apps, IFC hand-offs) can omit `holes`, `holeMetadata` and `autoFromWalls`: the schema declares defaults for them. The opening sync and the public viewer read those fields on the raw node, so a scene whose slab has no `holes` throws "Cannot read properties of undefined (reading 'map')" and never renders, while the editor (which fills defaults) opens it fine. Fill the three fields in setScene, the way doors and windows are already normalized on load. Only the hole fields are touched: a full zod parse would also default `thickness`, which the vertical-model migration must still see as absent on legacy solids. Repro: a valid scene (69/69 nodes pass AnyNode.safeParse) exported by A3 Atlas Scanner; black viewer before, renders after adding `holes: []`.
|
I hit an error while handling your request (Model unavailable on AI Gateway free tier: Free tier users do not have access to this model. Upgrade to paid credits at https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dtop-up for unrestricted…). Please try again, rephrase, or reach out if it keeps failing. Error id: 9c519d2f-cb49-4245-b6b3-9f54bdd65b60 |
This branch has not been deployed
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.
What
Fill
holes,holeMetadataand (for slabs)autoFromWallson slab and ceiling nodes when a scene is loaded, the same way doors and windows are already normalized insetScene.Why
The schema declares defaults for these fields, so a third-party writer (a scanning app, an IFC hand-off) can legitimately omit them. But the slab opening sync and the public viewer read them on the raw node. A scene whose slab has no
holestherefore throws:and the public viewer stays black, while the editor (which fills defaults on load) opens the same file fine.
Repro with a real export from A3 Atlas Scanner (69/69 nodes pass
AnyNode.safeParse):pascal.jsoninto a new project → editor renders it; open the project's public viewer → black screen, error above;holes: []added on the slab → viewer renders: https://editor.pascal.app/viewer/project_ej9qncUcEV7RX4loHow
normalizeSurfaceHoleFieldsinuse-scene.ts, applied toslabandceilingin the load migration. Only the three hole fields are touched: a full zod parse would also defaultthickness, which the vertical-model migration still needs to see as absent on legacy solids (three existing tests cover that).Tests
use-scene-surface-holes-defaults.test.ts: a slab and a ceiling written without holes load with empty arrays; existing holes and metadata are kept as written. Fails onmain, passes with this change.bun run testinpackages/core: 2125 pass; the one failure and one module-resolution error are pre-existing onmain.bun check: clean.Context: this is the scanning-app hand-off discussed in #720 / #737.
Note
Low Risk
Narrow load-time normalization for slab/ceiling hole fields only; behavior matches schema defaults and is covered by new tests.
Overview
Scene load now backfills missing hole-related fields on
slabandceilingnodes so third-party exports that omitholes/holeMetadata(andautoFromWallson slabs) no longer crash the public viewer withundefined.map.migrateNodesinuse-scene.tscalls newnormalizeSurfaceHoleFields, which sets empty arrays andautoFromWalls: falsewhen absent. It deliberately avoids a full Zod parse so legacythicknessstays undefined for the vertical-model migration.New tests in
use-scene-surface-holes-defaults.test.tsassert defaults on bare slabs/ceilings and that existing holes/metadata are unchanged.Reviewed by Cursor Bugbot for commit 3f9e966. Bugbot is set up for automated code reviews on this repo. Configure here.