fix: prevent model URI corruption from .optimized directory scanning#17
Open
cryptochris8 wants to merge 1 commit intohytopiagg:mainfrom
Open
fix: prevent model URI corruption from .optimized directory scanning#17cryptochris8 wants to merge 1 commit intohytopiagg:mainfrom
cryptochris8 wants to merge 1 commit intohytopiagg:mainfrom
Conversation
Fixes hytopiagg/sdk#34 - Model URI path corruption (extra character added) Root cause: The glob pattern in ModelRegistry._getAbsoluteModelPaths() scanned ALL .gltf/.glb files recursively, including files inside .optimized/ subdirectories. This caused: 1. Already-optimized models to be re-registered with .optimized/ paths 2. Cascading re-optimization creating nested .optimized/.optimized/ dirs 3. Path construction corruption during the cascading process Fix: Add `ignore: '**/.optimized/**'` to the glob pattern to exclude the optimization output directory from model scanning. Note: The full fix also benefits from the Buffer.from(msgpackr.pack()) change in the security/input-validation-hardening branch, which prevents msgpackr shared buffer corruption that can cause character duplication in serialized strings. Includes BUG_34_ANALYSIS.md with detailed root cause documentation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Fixes SDK issue #34 — model URI corruption during the optimization pipeline.
Two independent root causes identified and fixed:
Glob scanning .optimized/ files (server/src/models/ModelRegistry.ts) — The model registry glob pattern
**/*.{gltf,glb}was picking up already-optimized files inside.optimized/output directories, causing cascading re-optimization. Fixed by addingignore: '**/.optimized/**'to the glob options.msgpackr shared buffer corruption (server/src/networking/Connection.ts) —
Packr.pack()returns a view into a shared internal buffer that gets overwritten on subsequent calls. The server cached this buffer reference without copying it, so model data packets would be silently corrupted. Fixed by wrapping withBuffer.from().A detailed root cause analysis is included in BUG_34_ANALYSIS.md.
Test plan
.optimized/directories are not re-scanned on server startup🤖 Generated with Claude Code