fix(viewer): support variable and unicode filenames in OpenSCAD import and auto-hydrate mesh storage - #260
Conversation
…t and auto-hydrate mesh storage
|
Someone is attempting to deploy a commit to the Adam Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThe PR expands OpenSCAD import filename extraction and restores persisted mesh attachments into conversation-scoped browser storage.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains. No blocking failure remains. Important Files Changed
Reviews (4): Last reviewed commit: "perf: scope recompile trigger to code ch..." | Re-trigger Greptile |
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
- Extract Supabase storage download logic into meshService.ts - Scope MeshFilesContext cache by conversationId to prevent cross-conversation collisions - Parse mesh attachments via messageRowToChatMessage and AppUIMessage canonical types - Keep OpenSCADViewer purely presentational and free of direct network/DB calls
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…ration, and regex identifier boundaries - Eliminate global fallback in MeshFilesContext to prevent cross-conversation mesh collisions - Expose reactive filesVersion from MeshFilesContext so OpenSCADViewer re-prepares and compiles on async hydration - Require identifier boundaries and regex escaping for variable-bound OpenSCAD imports
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
…ted meshes - Return hasNewWrites from prepareMeshFiles - Skip recompilation on filesVersion changes when scadCode has no imports or no new required files were written
Summary
Fixes an issue where uploaded 3D mesh files imported in OpenSCAD code fail to render under two common scenarios:
Variable & Unicode Filename Extraction:
Previously,
extractImportFilenamesused a rigid regex/import\s*\(\s*"([^"]+)"\s*\)/gwhich only matched hardcoded ASCII literal strings. When models generated code using variable references (e.g.model_file = "model.stl"; import(model_file);) or non-ASCII / Unicode filenames (e.g.牛来修.stl),extractImportFilenamesreturned empty, causing OpenSCAD to fail withCan't open import file.extractImportFilenamesto support direct string literals (single/double quotes), variable assignments, and fallback regex for 3D/drawing assets.Supabase Mesh Storage Auto-Hydration:
Previously,
MeshFilesContextonly held mesh files in memory after initial drag/drop. If the user refreshed the page or navigated directly to/editor/:id, the in-memory map was empty andprepareMeshFilesdid not fetch the uploaded mesh from Supabase Storage.EditorView.prepareMeshFilesinOpenSCADViewerto ensure mesh files are seamlessly fetched from Supabase storage and written to the OpenSCAD worker filesystem.Testing
Summary by cubic
Fixes the OpenSCAD viewer import to support variable and Unicode filenames, and auto-hydrates mesh files from Supabase storage when a conversation loads. Previously, filenames with non-ASCII characters or dynamic variables could fail during import, and stored meshes weren't restored after page refresh or direct URL navigation, forcing re-uploads.
conversationIdinMeshFilesContextto prevent cross-conversation collisions.meshService.tssoOpenSCADViewerstays free of network and DB calls.filesVersioncounter triggers a rebuild only when the code changed or a required mesh file was newly written.Written for commit fbdfb0a. Summary will update on new commits.