Skip to content

GLB Local Testing - #1443

Draft
nickcastel50 wants to merge 9 commits into
mainfrom
glb_local
Draft

GLB Local Testing#1443
nickcastel50 wants to merge 9 commits into
mainfrom
glb_local

Conversation

@nickcastel50

Copy link
Copy Markdown
Contributor

IFC to GLB testing

@nickcastel50 nickcastel50 self-assigned this Nov 5, 2025
@netlify

netlify Bot commented Nov 5, 2025

Copy link
Copy Markdown

Deploy Preview for bldrs-share-dev ready!

Name Link
🔨 Latest commit c0f1a0b
🔍 Latest deploy log https://app.netlify.com/projects/bldrs-share-dev/deploys/690df4942dfa5d000846558d
😎 Deploy Preview https://deploy-preview-1443--bldrs-share-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 53 (no change from production)
Accessibility: 89 (🟢 up 1 from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

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
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.

1 participant