GLB Local Testing - #1443
Draft
nickcastel50 wants to merge 9 commits into
Draft
Conversation
…. Needs matrix transform fix. Heavy WIP
…eed merge with main
✅ Deploy Preview for bldrs-share-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
17 tasks
pablo-mayrgundter
pushed a commit
that referenced
this pull request
May 11, 2026
Re-base of Nick's #1443 onto current main. The unrelated-histories merge was untractable (257 conflicts, 270 files), so this commit selectively brings across only the substantive net-new files from glb_local that do not yet exist on main: - src/loader/ExtBldrsPropertiesPayload.js — gzipped-JSON extension reader. Style-fixed (no semicolons, debug() over console), made decompressData synchronous (pako is sync). - src/OPFS/OPFSWorkerRef.js + __mocks__/OPFSWorkerRef.stub.js — split the worker handle out of OPFSService so Jest can mock it. - public/static/js/draco/{decoder,encoder,wasm_wrapper}.{js,wasm} — DRACO decoder bundle. Per design, DRACO write-side stays off in V1 (Three.js 0.135 bug) but the decoder is committed for future read of DRACO-encoded GLBs. - package.json — add pako 2.1.0 dependency. Explicitly NOT brought across from #1443: - bldrs-ai-conway-*.tgz (4 files) and committed ConwayGeom*.wasm/*.js — would downgrade Conway from 0.23.954-2 to 0.22.962. Phase 0 keeps main's Conway and wires the copy via the existing build-share-copy-wasm-conway scripts. - src/utils/IfcTypesMap.js (865 LOC) — deferred. BLDRS_spatial_tree carries type strings in v1 of the artifact schema, so this map is not needed in the runtime path. - All file modifications in #1443 (Loader.js, OPFS.worker.js, CadView.jsx, etc.) — deferred to subsequent commits where they can be applied surgically on top of current main rather than reverting main's evolution. GlbClipper.js and ExtBldrsPropertiesPayload.js note: main already carries a GlbClipper.js refactored to use CutPlaneArrowHelper — kept main's version. Tests: 64/64 pass in OPFSService, OPFS.worker, GlbClipper, Loader. Lint clean on brought-over files. Companion design: design/new/glb-model-sharing.md (committed previously, included in this commit due to branch reset). https://claude.ai/code/session_01Mae5byPdiqpfy65qRydpdu
pablo-mayrgundter
pushed a commit
that referenced
this pull request
May 11, 2026
Closes the loop with Phase 1's reader: after a successful IFC parse on the
GitHub source path, kick off a fire-and-forget GLB export and write the
result to OPFS at exactly the cache key tryLoadCachedGlb() looks up. The
next load of the same source short-circuits to the GLB.
Behavior remains inert in prod: the writer is gated on the same
GLB_SERVING_IS_ENABLED flag that gates the reader; both default false.
Writer (src/loader/glbExport.js):
- exportIfcAsGlb({ifcAPI, modelID, fileName}) — runs Conway's
GeometryAggregator -> GeometryConvertor.toGltfs pipeline against the
parsed scene, copies bytes off the wasm heap, releases native vectors
in finally blocks (this addresses the malloc/free leak called out in
Phase 0's review of #1443).
- exportAndCacheGlb({...}) — derives the cache key via glbCacheKey() so
reader and writer are guaranteed to agree (T-1).
- Reaches into conway-web-ifc-adapter's internal proxy.model[1] to obtain
the parsed scene; documented as a PHASE2-FOLLOWUP for when an upstream
public accessor lands.
- Phase 2a scope is geometry-only. The BLDRS_* extension payload
(properties, spatial_tree) lands in Phase 2b. Until then, cached GLBs
render as flat meshes; the reader's ExtBldrsPropertiesPayload extension
already tolerates "no extension".
- Single-chunk only. Default options means no maxGeometrySize, so Conway
emits one buffer; multi-chunk handling (very large models) is Phase 2b.
OPFS write helper:
- New worker command 'writeBytesByPath' + opfsWriteBytesByPath() service
call + writeGlbBytesToOPFS() promise wrapper. Uses the existing
writeFileToPath helper so the file is keyed in the same scheme as
doesFileExistInOPFS / readModelByPathFromOPFS.
Loader.js wiring:
- glbExportContext captured on the source-IFC path (both download and
base64 branches), null otherwise. Skip path leaves it null since the
artifact already exists.
- After readModel() succeeds, fire-and-forget exportAndCacheGlb() if the
context is set and the model exposes modelID + ifcAPI. No await — the
user sees their model immediately; the cache warm-up runs in the
background.
Tests (src/loader/glbExport.test.js, 7 new):
- Conway and OPFS both mocked; tests cover the wiring + free/copy semantics.
- T-1 satisfied explicitly: an "exportAndCacheGlb writes the GLB to OPFS at
exactly the cache key the reader looks up" assertion compares the
writer-side OPFS call args against glbCacheKey()'s output (the same
helper the reader uses).
- Native vector .delete() asserted in success, no-geometry, and
failed-chunk paths (regression guard for the malloc/free leak).
- exportAndCacheGlb returns false (no throw) on empty geometry and on
OPFS write failure — guarantees the user-facing IFC path is unaffected.
171/171 test suites pass (1124 tests + 5 skipped). Lint + typecheck clean.
End-to-end status with both flags off (prod): no behavior change.
End-to-end with GLB_SERVING_IS_ENABLED on (dev): load IFC -> background
GLB write -> reload -> Loader.js fast path serves the GLB. Properties /
nav-tree wiring follows in Phase 2b.
https://claude.ai/code/session_01Mae5byPdiqpfy65qRydpdu
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.

IFC to GLB testing