fix: pass unknown paint types through marked instead of throwing - #421
Open
gillianrode-123 wants to merge 1 commit into
Open
fix: pass unknown paint types through marked instead of throwing#421gillianrode-123 wants to merge 1 commit into
gillianrode-123 wants to merge 1 commit into
Conversation
parsePaint threw on any paint type outside its known set, and the throw
failed the entire get_figma_data request. Paint types absent from the
REST spec reach real files (Figma code-component CUSTOM paints, observed
2026-08-22), so one such paint on one node made a whole file/subtree
uncapturable.
Unknown paint types now return { type, unknownPaint: true, raw } with
the original paint preserved, log an error line, and leave the rest of
the simplification untouched.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
parsePaintthrows on any paint type outside its known set (SOLID, IMAGE, PATTERN, the four gradients), and the throw fails the entireget_figma_datarequest. Paint types absent from the REST spec do reach real files: on 2026-08-22 we hit Figma code-componentCUSTOMpaints (customEffectId: "CodeComponentId:..."pluscomponentPropAssignments) on several nodes of a production file, and each one made its whole subtree uncapturable withError fetching file: Unknown paint type: CUSTOM. Any future paint type Figma ships has the same effect until the transformer learns it.Change
Unknown paint types degrade instead of throwing:
parsePaintreturns{ type, unknownPaint: true, raw }, whererawis the untouched Figma paint object, and logs an error line. The fill is marked rather than silently dropped, so consumers can detect it (and still read the raw paint), while the rest of the simplification is unaffected. AddsSimplifiedUnknownFillto theSimplifiedFillunion.Backward compatibility
type(e.g. image download collection matching"IMAGE") skips the unknown entry naturally.Validation
src/tests/unknown-paint.test.ts): marked passthrough, raw-field preservation, known paints untouched, and stroke parsing surviving a mixed known/unknown paint list. Against the current code, 3 of 4 fail with the exact production error (Unknown paint type: CUSTOM); with the change, the full suite passes (254 passed / 1 skipped).tsc --noEmitclean.Relation to #420
Independent of #420 (different files, no overlap); both come out of the same production usage. Happy to rebase either if both are accepted.
🤖 Generated with Claude Code