Frontend maxColors default (13) exceeds backend cap (10) — every default digitize 422s #26

Closed
opened 2026-07-12 23:46:04 +00:00 by Mark · 2 comments
Owner

Scope: small. One-line frontend clamp.

src/lib/digitize-adapters.ts:40-44 maps colorSensitivity: 50 to maxColors = round(1 + 0.5*23) = 13. Backend caps at 10 → 422 on every default digitize.

Fix: linear weight 23 → 9, clamp (1, 10). Test the existing digitize-adapters.test.ts (already updated). ~5-line change.

Fixed in commit 774e0c0 (on origin/main). Close this once kilo-gsd confirms via test run.

**Scope: small.** One-line frontend clamp. `src/lib/digitize-adapters.ts:40-44` maps `colorSensitivity: 50` to `maxColors = round(1 + 0.5*23) = 13`. Backend caps at 10 → 422 on every default digitize. **Fix**: linear weight 23 → 9, clamp `(1, 10)`. Test the existing `digitize-adapters.test.ts` (already updated). ~5-line change. Fixed in commit `774e0c0` (on `origin/main`). Close this once kilo-gsd confirms via test run.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Fixed in commit pending (local, not pushed).

src/lib/digitize-adapters.ts:40-44: clamp colorSensitivity to 1–10 instead of 1–24. Default sensitivity 50 now produces maxColors = 6, well within the service cap.

Verification (real-browser end-to-end, July 12)

$ npm test -- --run
…
Tests 198 passed (198)
Browser-controlled roundtrip:
- workspace loads
- upload simple.svg via File/DataTransfer/change event
- Auto-Digitize FAB visible (after Vite HMR took the new code)
- FAB click → POST /v1/digitize
- service log: POST /v1/digitize HTTP/1.1" 200 OK
- body shows "simple.svg uploaded successfully", NO error toast, NO "Auto-digitize failed"
- canvas renders pixel content (data:image/png;base64,iVBORw…)

Two follow-up bugs found and filed while walking through:

  • #27 — fromServiceStitchObject throws on null paletteIndex (engine emits null because #24 catalog isn't wired)
  • #28 — FAB success path doesn't auto-advance appState to 'digitized' (user must click Confirm)
**Fixed in commit pending** (local, not pushed). `src/lib/digitize-adapters.ts:40-44`: clamp `colorSensitivity` to 1–10 instead of 1–24. Default sensitivity 50 now produces `maxColors = 6`, well within the service cap. ### Verification (real-browser end-to-end, July 12) ``` $ npm test -- --run … Tests 198 passed (198) ``` ``` Browser-controlled roundtrip: - workspace loads - upload simple.svg via File/DataTransfer/change event - Auto-Digitize FAB visible (after Vite HMR took the new code) - FAB click → POST /v1/digitize - service log: POST /v1/digitize HTTP/1.1" 200 OK - body shows "simple.svg uploaded successfully", NO error toast, NO "Auto-digitize failed" - canvas renders pixel content (data:image/png;base64,iVBORw…) ``` Two follow-up bugs found and filed while walking through: - #27 — `fromServiceStitchObject` throws on null paletteIndex (engine emits null because #24 catalog isn't wired) - #28 — FAB success path doesn't auto-advance appState to 'digitized' (user must click Confirm)
Mark 2026-07-15 02:33:33 +00:00
Sign in to join this conversation.
No description provided.