POST /v1/digitize #85

Closed
opened 2026-06-26 18:51:40 +00:00 by Mark · 0 comments
Owner

Phase 1: POST /v1/digitize

Wire the 5-stage pipeline to a single endpoint. This is the core of the
service.

Files:

  • Modify: src/service/app.py (add /v1/digitize route)
  • Modify: src/service/models.py (DigitizeRequest, DigitizeResponse
    pydantic models)
  • New: src/service/handlers/digitize.py (route handler, calls
    EmbroideryPipeline.process_bytes(), formats response)

Acceptance:

  • POST /v1/digitize with a 1024×1024 PNG and default settings returns
    a valid DigitizeResponse (regions, stitchObjects, stats) within 5
    seconds on a 4-core dev box.
  • The response includes a stats.stages breakdown (depends on issue
    #35 — the stages dict population fix — being merged first).
  • Errors at any stage (raster conversion fails, no regions detected,
    format emit fails) return a structured 503 with the failing stage
    named in the body. No 500s on expected failures.
  • 3 concurrent requests handled without deadlock.

Depends on: P1 (skeleton). Soft-depends on #32 (importable pipeline)
and #33 (process_bytes method) — if those aren't done first, this
phase has to call process(input_path) and write temp files, which
adds friction. Land them first for cleanliness.



Decomposed from easystitch#31


Decomposed from easystitch#47

## Phase 1: POST /v1/digitize Wire the 5-stage pipeline to a single endpoint. This is the core of the service. **Files:** - Modify: `src/service/app.py` (add `/v1/digitize` route) - Modify: `src/service/models.py` (DigitizeRequest, DigitizeResponse pydantic models) - New: `src/service/handlers/digitize.py` (route handler, calls `EmbroideryPipeline.process_bytes()`, formats response) **Acceptance:** - `POST /v1/digitize` with a 1024×1024 PNG and default settings returns a valid `DigitizeResponse` (regions, stitchObjects, stats) within 5 seconds on a 4-core dev box. - The response includes a `stats.stages` breakdown (depends on issue #35 — the `stages` dict population fix — being merged first). - Errors at any stage (raster conversion fails, no regions detected, format emit fails) return a structured `503` with the failing stage named in the body. No 500s on expected failures. - 3 concurrent requests handled without deadlock. **Depends on:** P1 (skeleton). Soft-depends on #32 (importable pipeline) and #33 (process_bytes method) — if those aren't done first, this phase has to call `process(input_path)` and write temp files, which adds friction. Land them first for cleanliness. --- --- _Decomposed from [easystitch#31](https://forgejo.tail018ac4.ts.net/Mark/easystitch/issues/31)_ --- _Decomposed from [easystitch#47](https://forgejo.tail018ac4.ts.net/Mark/easystitch/issues/47)_
Mark 2026-06-26 18:52:09 +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#85
No description provided.