computeThreadStops aggregates by paletteIndex; paletteIndex: null from the engine collapses to one fake stop at index 0 #77
Labels
No labels
blocked:commit-ready-failed
blocked:gate-fetch
blocked:gate-lint
blocked:gate-plan
blocked:gate-research
blocked:needs-attention
blocked:needs-decision
blocked:needs-human
blocked:no-changes
blocked:verify-failed
bug
deferred
feature-request
in-progress
needs-decompose
needs-triage
quickfix
security/medium
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/Kimi_Agent_Brother_10_Digitizing_App#77
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?
Where:
src/lib/digitize-adapters.ts:203-218(computeThreadStops), in concert withsrc/lib/digitize-adapters.ts:143(thepaletteIndex ?? 0fallback infromServiceStitchObject).Bug:
paletteIndex: nullfor every stitch (see comment atdigitize-adapters.ts:120-124— "The engine currently returnspaletteIndex: nullbecause the Brother PR10 catalog lookup is a downstream concern (see issue #24).").fromServiceStitchObjectcollapses null → 0 (paletteIndex: obj.paletteIndex ?? 0 as number).computeThreadStopsaggregates bypaletteIndexvia aMap<number, ThreadStop>keyed onobj.paletteIndex. After the null-collapse, every stitch hashes to0, so the result is oneThreadStopregardless of how many distinct colors the design actually has.src/components/workspace/BottomThreadBar.tsx) then displays one color stop even for multi-color designs.This is the visible side of #24 / #29 — until the catalog lookup lands, the UI shows a single merged thread stop.
Fix consistent with existing patterns:
Mirror how
commitDigitizedResult(useWorkspace.ts:391) already keys by hex:Change
computeThreadStops's map key frompaletteIndexto a stable identity per distinct color:The existing per-hex grouping in
commitDigitizedResult(useWorkspace.ts:391) means stitches already sharecolorIdwhen colors match, so this key is stable across the design.Acceptance: digitizing a 4-color test image produces 4 thread stops in the bottom bar (not 1).