You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Keep 3MF imports responsive and bound archive expansion - #32
3MF imports can freeze the interface while extracting textures, and tiny malformed ZIP headers can make the readers attempt multi-gigabyte allocations. Move texture extraction off the UI thread and check the complete directory before expanding any selected entry.
The texture worker is short-lived, transfers expanded images back, and terminates on completion or failure. The original archive stays intact for mesh parsing and project saving. Untextured files skip the worker. Failures reject the import while preserving the current scan, measurements, draft and history.
Both model and texture readers now share the existing 1 GiB project-archive budget. The preflight counts model/relationship/configuration files and textures together, including 3MFs nested in projects, before the first decompression. It accounts for the allocation fields used by both stored and deflated entries. Ignored thumbnails and slicer sidecars are not expanded or counted; there is no new member-count or per-entry cap. Oversized input produces an actionable error.
The responsiveness experiment used a generated 4K PNG in a 40.5 MB 3MF. Median synchronous extraction dropped from 1,154.5 ms to 11 ms; the largest event-loop gap dropped from 1,157 ms to 97.7 ms (three runs, Chrome with 4× main-thread CPU slowdown). Canvas readback remains on the main thread. Workers are not equally throttled, so this demonstrates UI responsiveness, not equal-CPU throughput. scripts/bench-3mf-textures.mjs reproduces the synthetic workload.
Regression evidence:
Actual bundled fflate runs behind a test allocator that refuses large allocations. The original readers attempt 2 GiB allocations from tiny archives; the guarded readers reject before allocating. Combined model/texture budget and mismatched stored-entry sizes have failing-before/passing-after cases too.
Exact texture colours, retained archive bytes, worker disposal, live scene, project save/reopen and injected worker failure are checked through browser paths.
Oversized model, texture and nested-project imports preserve source, scene, worker mesh, measurement, draft and undo/redo identities. Valid packages with many small entries and ignored sidecars remain supported.
Related: #28 by Jozkah proposes 512-member, 256 MiB entry and 512 MiB total limits. This takes an alternative approach: reuse the existing project budget, inspect all selected members before the first allocation, and avoid limits on unused sidecars or member count. The two patches overlap and should be reconciled rather than stacked blindly. This PR is independent of #22, #23 and #31 and contains no automation, startup/memory optimization or design-overhaul files.
Validation:
Full integration gate: 3,111 unit tests, 123 MCP tests, production build and every executable browser suite pass. Private scooter fixture unavailable and skipped; 24 unit cases skipped and one todo.
Isolated upstream-based branch: 36 relevant unit tests, plugin-boundary and units checks, build, archive-rejection, textured-3MF and import browser suites pass.
Independent production preview: bundled texture worker requested; red texture rendered; exact source bytes saved; project reopened through the worker and rendered again.
Chrome only. No Safari/Firefox, private scan accuracy or physical hardware claim.
Thank you for the pull request. ScanRuler is dual-licensed (AGPL and commercial), which only works if its author may license every line of it, so a short Contributor License Agreement is needed once. You keep your copyright. To sign, reply with the sentence below exactly:
I agree to CLA.md
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.
The archive limits have landed since (src/core/parsers/archiveLimits.ts, in 0.9.x), so the part of this that's still new is moving texture extraction off the UI thread. It needs the CLA signed once, just reply with
I agree to CLA.md
and please rebase it on main, keeping only the worker part. If it isn't signed by November 16, I'll close this and look at the textures on my side.
This branch has not been deployed
No deployments
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
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.
3MF imports can freeze the interface while extracting textures, and tiny malformed ZIP headers can make the readers attempt multi-gigabyte allocations. Move texture extraction off the UI thread and check the complete directory before expanding any selected entry.
The texture worker is short-lived, transfers expanded images back, and terminates on completion or failure. The original archive stays intact for mesh parsing and project saving. Untextured files skip the worker. Failures reject the import while preserving the current scan, measurements, draft and history.
Both model and texture readers now share the existing 1 GiB project-archive budget. The preflight counts model/relationship/configuration files and textures together, including 3MFs nested in projects, before the first decompression. It accounts for the allocation fields used by both stored and deflated entries. Ignored thumbnails and slicer sidecars are not expanded or counted; there is no new member-count or per-entry cap. Oversized input produces an actionable error.
The responsiveness experiment used a generated 4K PNG in a 40.5 MB 3MF. Median synchronous extraction dropped from 1,154.5 ms to 11 ms; the largest event-loop gap dropped from 1,157 ms to 97.7 ms (three runs, Chrome with 4× main-thread CPU slowdown). Canvas readback remains on the main thread. Workers are not equally throttled, so this demonstrates UI responsiveness, not equal-CPU throughput.
scripts/bench-3mf-textures.mjsreproduces the synthetic workload.Regression evidence:
Related: #28 by Jozkah proposes 512-member, 256 MiB entry and 512 MiB total limits. This takes an alternative approach: reuse the existing project budget, inspect all selected members before the first allocation, and avoid limits on unused sidecars or member count. The two patches overlap and should be reconciled rather than stacked blindly. This PR is independent of #22, #23 and #31 and contains no automation, startup/memory optimization or design-overhaul files.
Validation: