Bug: /v1/digitize ignores hoop_size_mm — design extends beyond requested hoop, no scaling or clipping #20
Labels
No labels
blocked:needs-attention
blocked:needs-decision
bug
feature-request
in-progress
needs-decompose
quickfix
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/easystitch-service#20
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
POST /v1/digitizeaccepts ahoop_size_mmparameter inDigitizeSettingsbut the pipeline does not scale or constrain the design to the hoop. The output stitch coordinates extend beyond the requested hoop dimensions, regardless of how small the hoop is set.This silently produces embroidery files that exceed the physical hoop — a real production hazard.
Steps to Reproduce
The response
stitchObjects[0].stitches[]shows x coordinates extending to~200 mmeven though the requested hoop is 50 × 50 mm.Expected
The engine should either:
Currently: silently produces an oversized file. Same response from
100×100,130×180,200×300— all produce identical 6572-stitch output, identical PES bounding box(-1, -1, 2001, 997)in 0.1mm units (the BB SVG native size).Actual
PES bounds returned by pyembroidery are also identical across all three hoop sizes:
Root Cause
In
easystitch-service/pipeline_runner.py, theDigitizeSettingsis passed through to the engine viaengine_settings:The engine (
src/main_pipeline.py/EmbroideryPipeline) is givenhoop_size_mmbut its SVG→stitch converter doesn't consume that parameter for scale/clip decisions. Likely the converter falls back to the SVG's native viewBox dimensions.Suggested Fix
Pick one:
_digitize_syncbefore the engine call: scale image_bytes bymin(hoop.w / svg.width, hoop.h / svg.height)(or for raster, draw onto a canvas of hoop size with white margin), pass the scaled image to the engine.DigitizeSettings.model_validate_json), or in pipeline_runner, compute the expected design bbox and return422with a clear error if it exceeds hoop.hoop_size_mmintoEmbroideryPipeline.run()and have the converter scale to fit. (Most thorough.)Severity
High — silent failure mode that would ship unusable designs to a customer's machine.
Shakedown Context
2026-09-01 BB-monogram shakedown. Discovered when user asked to drive the hoop-size selector through the GUI. The native
<select>element correctly updated React state to all four values (100x100, 130x180, 160x260, 200x300). The export PES files were byte-identical across sizes, which is what surfaced the issue.Environment
localhost:8080(uvicorn pid 1457239)Mark/easystitch-servicerepo at test time