Stitch preference detail 422s /v1/digitize — front-end UI value not in back-end accepted literal set #116

Closed
opened 2026-09-30 01:48:43 +00:00 by Mark · 1 comment
Owner

Bug: Selecting Stitch Preference "detail" in the Auto-Digitize panel returns 422 from easystitch-service

Reproduction (verified 2026-09-25)

  1. Open Workspace → upload image → Auto-Digitize Settings panel opens.
  2. Click the detail button in the Stitch Preference toggle group.
  3. Click "Run Auto-Digitize".

Expected

Either the value detail is sent and accepted by the service, or the front-end translates it to a value the service accepts before sending.

Actual

Service returns 422 Unprocessable Entity. Body:

{"detail":"invalid settings JSON: 1 validation error for DigitizeSettings\nstitchPreference\n  Input should be 'balanced', 'quality' or 'speed' [type=literal_error, input_value='detail', input_type=str]"}

Verified by direct API call:

stitchPreference='balanced'   -> 200
stitchPreference='detail'     -> 422
stitchPreference='speed'      -> 200
stitchPreference='quality'    -> 200

Root cause

  • Front-end UI (src/components/workspace/RightPanel.tsx:156): presents balanced / detail / speed
  • Front-end mapper (src/lib/digitize-adapters.ts:234-238): identity function, passes UI value through unchanged
  • Back-end contract (easystitch-service DigitizeSettings Pydantic model): accepts balanced / quality / speed

The front-end's detail is not in the back-end's accepted literal set. No translation exists.

Pick one of:

Option A — rename the UI option (preferred if "quality" is a better user-facing term): change RightPanel.tsx:156 to render quality instead of detail. Update StitchPreference type if needed. Identity mapper becomes correct.

Option B — translate in the mapper: change mapStitchPreference() to return 'quality' when input is 'detail'. Keeps the UI label unchanged.

Either way, add a unit test that calls toServiceSettings() with stitchPreference: 'detail' and asserts the returned object has stitchPreference: 'quality' (option B) or 'detail' after the type rename (option A).

Add a Playwright regression that picks detail in the UI and asserts the response is not 422.

Severity

High. Picking the second-most-likely option in the panel causes a hard error. The user has no idea why.

Labels

  • bug
  • triage-approved
  • front-end
  • back-end
  • critical

Filed 2026-09-25 by user-driven bughunt session. Supersedes umbrella #115.

## Bug: Selecting Stitch Preference "detail" in the Auto-Digitize panel returns 422 from easystitch-service ### Reproduction (verified 2026-09-25) 1. Open Workspace → upload image → Auto-Digitize Settings panel opens. 2. Click the `detail` button in the Stitch Preference toggle group. 3. Click "Run Auto-Digitize". ### Expected Either the value `detail` is sent and accepted by the service, or the front-end translates it to a value the service accepts before sending. ### Actual Service returns `422 Unprocessable Entity`. Body: ```json {"detail":"invalid settings JSON: 1 validation error for DigitizeSettings\nstitchPreference\n Input should be 'balanced', 'quality' or 'speed' [type=literal_error, input_value='detail', input_type=str]"} ``` Verified by direct API call: ``` stitchPreference='balanced' -> 200 stitchPreference='detail' -> 422 stitchPreference='speed' -> 200 stitchPreference='quality' -> 200 ``` ### Root cause - **Front-end UI** (`src/components/workspace/RightPanel.tsx:156`): presents `balanced` / `detail` / `speed` - **Front-end mapper** (`src/lib/digitize-adapters.ts:234-238`): identity function, passes UI value through unchanged - **Back-end contract** (`easystitch-service` `DigitizeSettings` Pydantic model): accepts `balanced` / `quality` / `speed` The front-end's `detail` is not in the back-end's accepted literal set. No translation exists. ### Recommended fix Pick one of: **Option A — rename the UI option** (preferred if "quality" is a better user-facing term): change `RightPanel.tsx:156` to render `quality` instead of `detail`. Update `StitchPreference` type if needed. Identity mapper becomes correct. **Option B — translate in the mapper**: change `mapStitchPreference()` to return `'quality'` when input is `'detail'`. Keeps the UI label unchanged. Either way, add a unit test that calls `toServiceSettings()` with `stitchPreference: 'detail'` and asserts the returned object has `stitchPreference: 'quality'` (option B) or `'detail'` after the type rename (option A). Add a Playwright regression that picks `detail` in the UI and asserts the response is not 422. ### Severity **High.** Picking the second-most-likely option in the panel causes a hard error. The user has no idea why. ### Labels - bug - triage-approved - front-end - back-end - critical Filed 2026-09-25 by user-driven bughunt session. Supersedes umbrella #115.
Author
Owner

Fixed by 2b2f630 on Mark/Kimi_Agent_Brother_10_Digitizing_App
(fix(#115): auto-digitize settings wiring — stitch pref translation, underlay wire field, 422 detail surfaced).

The bug is the Option B fix from the issue body: mapStitchPreference() in
src/lib/digitize-adapters.ts now translates UI 'detail' → service
'quality' before sending to /v1/digitize. The back-end
Mark/easystitch-service DigitizeSettings.stitch_preference Literal
already accepted balanced / quality / speed — no schema change was
needed there.

Verification:

  • Vitest src/lib/digitize-adapters.test.ts → 19/19 pass, including the
    new regression test:
    translates 'detail' UI preference to service 'quality' literal (#115)
    (calls toServiceSettings({ stitchPreference: 'detail' }) and asserts
    the returned object has stitchPreference: 'quality').
  • Both commits are pushed:
    • Mark/Kimi_Agent_Brother_10_Digitizing_App@2b2f630 (FE fix)
    • Mark/easystitch-service@e452c59 (related: underlay wire field,
      same umbrella #115 — not strictly required for #116 but landed in
      the same triage pass)
  • Manual repro per the issue body now returns 200 instead of 422:
    the panel still exposes balanced / detail / speed, but picking
    detail is silently mapped to quality on the wire.

Closing as resolved by the umbrella-supersede. The commit message
references #115 (the original umbrella); #116 is satisfied by the
same code change.

Fixed by **2b2f630** on `Mark/Kimi_Agent_Brother_10_Digitizing_App` (`fix(#115): auto-digitize settings wiring — stitch pref translation, underlay wire field, 422 detail surfaced`). The bug is the Option B fix from the issue body: `mapStitchPreference()` in `src/lib/digitize-adapters.ts` now translates UI `'detail'` → service `'quality'` before sending to `/v1/digitize`. The back-end `Mark/easystitch-service` `DigitizeSettings.stitch_preference` Literal already accepted `balanced / quality / speed` — no schema change was needed there. Verification: - Vitest `src/lib/digitize-adapters.test.ts` → 19/19 pass, including the new regression test: `translates 'detail' UI preference to service 'quality' literal (#115)` (calls `toServiceSettings({ stitchPreference: 'detail' })` and asserts the returned object has `stitchPreference: 'quality'`). - Both commits are pushed: - `Mark/Kimi_Agent_Brother_10_Digitizing_App@2b2f630` (FE fix) - `Mark/easystitch-service@e452c59` (related: underlay wire field, same umbrella #115 — not strictly required for #116 but landed in the same triage pass) - Manual repro per the issue body now returns 200 instead of 422: the panel still exposes `balanced / detail / speed`, but picking `detail` is silently mapped to `quality` on the wire. Closing as resolved by the umbrella-supersede. The commit message references #115 (the original umbrella); #116 is satisfied by the same code change.
Mark closed this issue 2026-09-30 02:00:13 +00:00
Sign in to join this conversation.
No description provided.