Bug: /v1/digitize response always returns regions: [] (dead or broken field) #28

Closed
opened 2026-09-09 20:29:52 +00:00 by Mark · 1 comment
Owner

Summary

POST /v1/digitize always returns "regions": [] regardless of input, even when the engine successfully produces stitchObjects and reports colorCount: 2. The regions field is part of the documented response shape but appears to never be populated.

Reproduction

# Valid 200x200 SVG with rect+circle, hex colors, balanced settings
curl -s -X POST http://127.0.0.1:8080/v1/digitize \
  -F 'image=@/tmp/probe.svg;type=image/svg+xml' \
  -F 'settings={"stitch_preference":"balanced","fill_density_mm":0.4,"satin_stitch_spacing_mm":0.4,"running_stitch_spacing_mm":0.4,"min_stitch_length_mm":1.0,"max_stitch_length_mm":8.0,"hoop_size_mm":{"w":100,"h":100},"max_colors":10,"machine_profile":"brother-pr10"}'

# Returns:
# {"regions":[], "stitchObjects":[<2 objects, 8400+10842 stitches>],
#  "stats":{"totalStitches":10842,"colorCount":2,"processingMs":709}}

# regions is ALWAYS empty. Same result on multiple SVG inputs.

Why this matters

ThreadCraft's UI relies on regions[] to render overlay polygons on the Fabric.js canvas. When regions: [], the user gets the stitch objects (which is what gets exported) but no visible overlay of where the regions are. UX is degraded without obvious feedback.

Likely root cause

Per the secondary finding in the 2026-09-01 shakedown (session 20260901_085043_f35d0513): "the grouping loop never flushing." pipeline_runner.py produces the StitchObject list but the regional grouping pass before it isn't producing output (or its output is dropped before serialization).

Suggested fix

Either:

  1. Trace _group_stitches_into_objects (or equivalent) in pipeline_runner.py to find where region results get dropped, or
  2. If the field is dead code, remove it from the response schema and the OpenAPI spec to avoid misleading clients.
  • Issue #22 (settings don't actually affect output) — overlapping with the regions symptom
  • Session 2026-09-01 secondary finding: "even with hex colors, stitch_objects came back empty while stats said 6572 stitches"

UI verification follow-up (2026-09-10)

The file upload barrier is now cracked (DataTransfer + Object.defineProperty + dispatchEvent). Confirmed via BrowserOS MCP snapshot that ThreadCraft's settings panel unlocks after upload but:

  • FABRIC TYPE / STABILIZER / HOOP SIZE comboboxes in the Design Settings panel render all options in the accessibility tree but clicking any option via act click / act kind=select / PointerEvent sequence closes the dropdown without updating React state. The next snapshot re-shows the original option as [selected]. Captured React props via __reactProps confirmed onClick exists but does not fire under synthetic dispatch.
  • Auto-Digitize (toolbar FAB e12 or inner-modal Confirm & Edit e65) sets Redux state to 'digitizing' then 'digitized' with a hardcoded "Auto-digitize complete!" message but never fires runAutoDigitize() → digitize() → POST to /v1/digitize. BrowserOS MCP hook fetch confirmed only /healthz GETs during the click sequence. Service log shows zero digitize POSTs across the entire 2026-09-09/10 verification session.

This means the UI cannot drive a digitize or export at all in the current ThreadCraft build. The API bugs (#27-31) are still the canonical surface; the UI bugs are symptom-level and tracked separately as #32 (silent no-op), #33 (combobox click swallowed), #34 (false-complete message). Those three will be closed as duplicates of this issue family once the canonical root causes land.

## Summary `POST /v1/digitize` always returns `"regions": []` regardless of input, even when the engine successfully produces `stitchObjects` and reports `colorCount: 2`. The `regions` field is part of the documented response shape but appears to never be populated. ## Reproduction ```bash # Valid 200x200 SVG with rect+circle, hex colors, balanced settings curl -s -X POST http://127.0.0.1:8080/v1/digitize \ -F 'image=@/tmp/probe.svg;type=image/svg+xml' \ -F 'settings={"stitch_preference":"balanced","fill_density_mm":0.4,"satin_stitch_spacing_mm":0.4,"running_stitch_spacing_mm":0.4,"min_stitch_length_mm":1.0,"max_stitch_length_mm":8.0,"hoop_size_mm":{"w":100,"h":100},"max_colors":10,"machine_profile":"brother-pr10"}' # Returns: # {"regions":[], "stitchObjects":[<2 objects, 8400+10842 stitches>], # "stats":{"totalStitches":10842,"colorCount":2,"processingMs":709}} # regions is ALWAYS empty. Same result on multiple SVG inputs. ``` ## Why this matters ThreadCraft's UI relies on `regions[]` to render overlay polygons on the Fabric.js canvas. When `regions: []`, the user gets the stitch objects (which is what gets exported) but no visible overlay of where the regions are. UX is degraded without obvious feedback. ## Likely root cause Per the secondary finding in the 2026-09-01 shakedown (session `20260901_085043_f35d0513`): "the grouping loop never flushing." `pipeline_runner.py` produces the StitchObject list but the regional grouping pass before it isn't producing output (or its output is dropped before serialization). ## Suggested fix Either: 1. Trace `_group_stitches_into_objects` (or equivalent) in `pipeline_runner.py` to find where region results get dropped, or 2. If the field is dead code, remove it from the response schema and the OpenAPI spec to avoid misleading clients. ## Related - Issue #22 (settings don't actually affect output) — overlapping with the regions symptom - Session 2026-09-01 secondary finding: "even with hex colors, `stitch_objects` came back empty while stats said 6572 stitches" --- **UI verification follow-up (2026-09-10)** The file upload barrier is now cracked (DataTransfer + Object.defineProperty + dispatchEvent). Confirmed via BrowserOS MCP `snapshot` that ThreadCraft's settings panel unlocks after upload but: - FABRIC TYPE / STABILIZER / HOOP SIZE comboboxes in the Design Settings panel render all options in the accessibility tree but **clicking any option via `act click` / `act kind=select` / PointerEvent sequence closes the dropdown without updating React state**. The next snapshot re-shows the original option as `[selected]`. Captured React props via `__reactProps` confirmed `onClick` exists but does not fire under synthetic dispatch. - Auto-Digitize (toolbar FAB `e12` or inner-modal Confirm & Edit `e65`) sets Redux state to `'digitizing'` then `'digitized'` with a hardcoded "Auto-digitize complete!" message **but never fires `runAutoDigitize()` → `digitize()` → POST to `/v1/digitize`**. BrowserOS MCP `hook fetch` confirmed only `/healthz` GETs during the click sequence. Service log shows zero digitize POSTs across the entire 2026-09-09/10 verification session. This means **the UI cannot drive a digitize or export at all in the current ThreadCraft build**. The API bugs (#27-31) are still the canonical surface; the UI bugs are symptom-level and tracked separately as #32 (silent no-op), #33 (combobox click swallowed), #34 (false-complete message). Those three will be closed as duplicates of this issue family once the canonical root causes land.
Author
Owner

Visual verification (2026-09-09): All four canvas screenshots show empty workspace ("Drop your image here" / dashed drop zone visible in 3 of 4, blank faint circular hoop outline visible in FINAL_workspace_full.png). The bug's surface symptom (no region polygons after digitize) cannot be visually confirmed without first uploading an image, which BrowserOS MCP cannot do for hidden file inputs. The curl probe in the original bug body (showing regions: [] in successful responses) is still the primary evidence.

Visual verification (2026-09-09): All four canvas screenshots show empty workspace ("Drop your image here" / dashed drop zone visible in 3 of 4, blank faint circular hoop outline visible in FINAL_workspace_full.png). The bug's surface symptom (no region polygons after digitize) cannot be visually confirmed without first uploading an image, which BrowserOS MCP cannot do for hidden file inputs. The curl probe in the original bug body (showing `regions: []` in successful responses) is still the primary evidence.
Mark closed this issue 2026-09-10 02:56:34 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/easystitch-service#28
No description provided.