parseDesignFile's SVG and PDF parsers fabricate stitch counts (count <path> elements × 50) — they don't actually parse stitch data; either return honest zeros or drop the 'support' claim from the file header and Help page #131
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#131
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?
Finding
src/components/gallery/parseDesignFile.tsclaims to support.svgand.pdffor stitch/thread metric extraction. The implementations are fabrications:<path>elements in the file and multiplies by 50. SVG<path>elements are not stitches; this number has no relationship to actual stitch count.path operationsand multiplies by 50. Same problem — PDF path operations are not stitches.The PES parser and DST parser at the top of the file are honest (they read the real binary headers). The SVG and PDF parsers are dishonest.
The Help page advertises that you can "load any PES, DST, SVG, PDF" into the gallery (
src/pages/Help.tsx:122). For PES and DST that's true. For SVG and PDF it isn't — the displayed metrics are made up.Where
src/components/gallery/parseDesignFile.ts(156 lines)parsePES(line 47-78),parseDST(line 85-99)parseSVG(line 107-124),parsePDF(line 126-140)src/pages/Help.tsx:122Suggested fix shape
Three options, in order of preference:
Honest behavior: have
parseSVGandparsePDFreturn{ stitchCount: 0, threadCount: 0, thumbnailColors: [] }. The Gallery card will show "stitch count: 0" for these files, which is correct — the file is an image or document, not a stitch file. Update the file header comment to remove the SVG/PDF "support" claim and update the Help page to say "load any PES or DST file into the gallery" (the SVG/PDF path is for direct image upload, not Gallery).Try-harder behavior: parse the file more thoroughly to extract what we can. For SVG, count path segments with realistic stitch density. For PDF, use a real PDF parser (pdf.js or similar) to extract path data. This is a bigger feature and probably not worth it for a metric that's barely used in the UI.
Document the lie: add a JSDoc to
parseSVGandparsePDFthat explicitly states "approximate metric, not real stitch data" and add a small warning in the Gallery card when the file is SVG or PDF.Option 1 is the right call. The metric is for the Gallery card display, the user already knows they uploaded an image, "0 stitches" is honest and doesn't mislead them.
Discovered by
Gap analysis (2026-10-02) of dishonest file parsers.
Related
parseDesignFile.tsas "dead code - hash-derived fake metrics." Was marked closed but the SVG/PDF fabrications are still there.Closed by commit
51f1048on main (pushed).Applied Option 1 from the issue body:
parseSVGandparsePDFinsrc/components/gallery/parseDesignFile.tsnow return{ stitchCount: 0, threadCount: 0, thumbnailColors: FALLBACK_COLORS }. SVG<path>elements and PDF path operators are not stitches; the displayed metric had no relationship to actual stitch count.stitchCount/threadCount/thumbnailColorsfrom the return shape; nothing else breaks../node_modules/.bin/tsc -b). The pre-existing Gallery.test.tsx and workspace/ test failures on main are unrelated to this change (confirmed by running tests with and without the patch).The user's SVG/PDF upload is still accepted; the Gallery thumbnail renders from the file itself. The card now shows "stitch count: 0" for these files instead of a number from a lie.