Skip to content

AI-native design editor. Open-source Figma alternative.

test(kiwi): record pattern paint oracle gap

Danila Poyarkov3348115a0470
diff --git a/packages/docs/development/roadmap.md b/packages/docs/development/roadmap.md
index eb0e191ee..a0b0cfeb3 100644
--- a/packages/docs/development/roadmap.md
+++ b/packages/docs/development/roadmap.md
@@ -178,26 +178,26 @@ Figma's design documentation groups features into these areas:
OpenPencil deliberately preserves many Figma/Kiwi fields even when they are not rendered or editable. These live under `SceneNode.source.fig` and are applied late during `.fig` export. A schema coverage test compares the current `fig.kiwi` `NodeChange` fields against modeled codec fields, raw-preserved fields, and intentionally schema-only metadata buckets so drift stays visible.
-| Field group | Import/export | Render | UI | Fidelity impact |
-| ----------------------------------------------------------------------- | ------------: | -------: | --: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `source.fig.rawSize` | ✅ | Indirect | — | Preserves original Figma size for round-trip. Cleared when size is edited. |
-| `source.fig.rawTransform` | ✅ | Indirect | — | Preserves exact Figma transform. Cleared when transform is edited. |
-| `source.fig.rawNodeFields` | ✅ | Mixed | — | Late-applied to exported NodeChange for round-trip fidelity; raw-field and schema coverage tests guard preservation drift. |
-| `source.fig.layout` | ✅ | ✅ | ◐ | Preserves original Figma stack metadata while using normalized layout fields. |
-| `source.fig.symbolOverrides` | ✅ | Indirect | — | Important for instance override fidelity. |
-| `source.fig.componentPropAssignments` | ✅ | Indirect | ◐ | Used for component property fidelity; not raw-editable. |
-| `source.fig.derivedSymbolData` | ✅ | Indirect | — | Critical for instance-derived geometry/layout/text. |
-| `source.fig.derivedSymbolDataLayoutVersion` | ✅ | — | — | Figma bookkeeping. |
-| `source.fig.uniformScaleFactor` | ✅ | Indirect | — | Important for scaled instances. |
-| Style IDs: fill/stroke/text/effect/grid | ↩ | — | — | Preserves style linkage for Figma, but OpenPencil has no style manager yet. |
-| Component property refs/defs/specs | ✅ | Indirect | ◐ | Full Figma component-property authoring is incomplete. |
-| State-group metadata | ↩ | — | — | Preserved only. |
-| Version/sort/publish/library metadata | ↩ | — | ◐ | Assets UI shows a subset; publish/update workflow is missing. |
-| Variable and parameter consumption maps | ✅ | ◐ | ◐ | Filtered/preserved for safe round-trip; normalized bindings cover common cases. |
-| Page fields: background, page type, guides | ↩ | ◐ | — | Background color and background paints round-trip for imported pages; page type/guides mostly round-trip. Guides are not rendered/editable. |
-| Text internals: `textData`, layout versions, font version, derived data | ✅ | ✅ | — | Important for text fidelity; most internals are not editable. Imported derived text data, leading trim, decoration style, underline decoration paint/offset/thickness, semantic font metadata, and raw OpenType feature toggles are preserved for round-trip when safe; decoration style/thickness/color now render through CanvasKit. |
-| `fontVariations` | ✅ | ✅ | — | Variable font axes are imported, rendered, and exported for text nodes and style runs. |
-| Raw paint/effect/vector/geometry payloads | ✅ | ✅ | ◐ | Converted fields render; raw payloads preserve Figma import/export details, including mask, background paint, layout grid, export setting, and prototype interaction metadata where safe. |
+| Field group | Import/export | Render | UI | Fidelity impact |
+| ----------------------------------------------------------------------- | ------------: | -------: | --: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `source.fig.rawSize` | ✅ | Indirect | — | Preserves original Figma size for round-trip. Cleared when size is edited. |
+| `source.fig.rawTransform` | ✅ | Indirect | — | Preserves exact Figma transform. Cleared when transform is edited. |
+| `source.fig.rawNodeFields` | ✅ | Mixed | — | Late-applied to exported NodeChange for round-trip fidelity; raw-field and schema coverage tests guard preservation drift. |
+| `source.fig.layout` | ✅ | ✅ | ◐ | Preserves original Figma stack metadata while using normalized layout fields. |
+| `source.fig.symbolOverrides` | ✅ | Indirect | — | Important for instance override fidelity. |
+| `source.fig.componentPropAssignments` | ✅ | Indirect | ◐ | Used for component property fidelity; not raw-editable. |
+| `source.fig.derivedSymbolData` | ✅ | Indirect | — | Critical for instance-derived geometry/layout/text. |
+| `source.fig.derivedSymbolDataLayoutVersion` | ✅ | — | — | Figma bookkeeping. |
+| `source.fig.uniformScaleFactor` | ✅ | Indirect | — | Important for scaled instances. |
+| Style IDs: fill/stroke/text/effect/grid | ↩ | — | — | Preserves style linkage for Figma, but OpenPencil has no style manager yet. |
+| Component property refs/defs/specs | ✅ | Indirect | ◐ | Full Figma component-property authoring is incomplete. |
+| State-group metadata | ↩ | — | — | Preserved only. |
+| Version/sort/publish/library metadata | ↩ | — | ◐ | Assets UI shows a subset; publish/update workflow is missing. |
+| Variable and parameter consumption maps | ✅ | ◐ | ◐ | Filtered/preserved for safe round-trip; normalized bindings cover common cases. |
+| Page fields: background, page type, guides | ↩ | ◐ | — | Background color and background paints round-trip for imported pages; page type/guides mostly round-trip. Guides are not rendered/editable. |
+| Text internals: `textData`, layout versions, font version, derived data | ✅ | ✅ | — | Important for text fidelity; most internals are not editable. Imported derived text data, leading trim, decoration style, underline decoration paint/offset/thickness, semantic font metadata, and raw OpenType feature toggles are preserved for round-trip when safe; decoration style/thickness/color and leading trim now render through CanvasKit. |
+| `fontVariations` | ✅ | ✅ | — | Variable font axes are imported, rendered, and exported for text nodes and style runs. |
+| Raw paint/effect/vector/geometry payloads | ✅ | ✅ | ◐ | Converted fields render; raw payloads preserve Figma import/export details, including mask, background paint, layout grid, export setting, and prototype interaction metadata where safe. |
## Highest-priority visual gaps
@@ -205,8 +205,8 @@ These are parsed or visible in Figma docs and most likely to cause visible diffe
1. **Masks** — tune remaining exact Figma stack semantics beyond common alpha/vector/luminance and consecutive-mask paths.
2. **Corner smoothing** — expand Figma fixture comparisons and tune remaining stroke/effect edge cases.
-3. **Pattern/noise/custom fills** — replace the current solid-color fallback with Figma-oracle rendering for schema-level paint objects and transforms beyond image tile fills.
-4. **Variable-font and rich text fixtures** — broaden real-file coverage for variable axes, derived text data, leading trim, decoration style, semantic font metadata, and raw OpenType feature metadata.
+3. **Pattern/noise/custom fills** — replace the current solid-color fallback with Figma-oracle rendering for schema-level paint objects and transforms beyond image tile fills. `tests/fixtures/figma-oracles/pattern-noise-custom-paints.json` records that the plugin runtime rejects authoring these paint types and current fixtures do not contain them, so this remains blocked on a Figma-authored sample.
+4. **Variable-font and rich text fixtures** — broaden real-file coverage for variable axes, derived text data, leading trim, decoration style, semantic font metadata, and raw OpenType feature metadata; `tests/fixtures/figma-oracles/rich-text-decoration.json` captures the first live Figma rich-text oracle.
5. **Boolean operation editing** — improve inspector/tooling workflows for imported boolean-operation nodes.
6. **Layout grids and guides** — render/edit page guides and Figma layout grids, or clearly keep them round-trip-only.
7. **Full component property and slot workflows** — support authoring, not just preserving imported payloads.
diff --git a/tests/engine/io/fig/import/pattern-paint-oracle.test.ts b/tests/engine/io/fig/import/pattern-paint-oracle.test.ts
new file mode 100644
index 000000000..3c6dea950
--- /dev/null
+++ b/tests/engine/io/fig/import/pattern-paint-oracle.test.ts
@@ -0,0 +1,29 @@
+import { describe, expect, test } from 'bun:test'
+import { readFileSync } from 'node:fs'
+
+interface PaintOracle {
+ pluginRuntimeCreation: Record<string, { ok: boolean; message: string }>
+ currentFileFillTypes: Record<string, number>
+ localFigFixtureFillTypes: Record<string, Record<string, number>>
+ status: string
+}
+
+function readOracle(): PaintOracle {
+ return JSON.parse(
+ readFileSync('tests/fixtures/figma-oracles/pattern-noise-custom-paints.json', 'utf8')
+ ) as PaintOracle
+}
+
+describe('Figma pattern/noise/custom paint oracle availability', () => {
+ test('records that real paint payloads are still blocked on Figma-authored samples', () => {
+ const oracle = readOracle()
+ for (const type of ['PATTERN', 'NOISE', 'CUSTOM']) {
+ expect(oracle.pluginRuntimeCreation[type]?.ok).toBe(false)
+ expect(oracle.currentFileFillTypes[type]).toBeUndefined()
+ for (const counts of Object.values(oracle.localFigFixtureFillTypes)) {
+ expect(counts[type]).toBeUndefined()
+ }
+ }
+ expect(oracle.status).toContain('blocked on a Figma-authored sample')
+ })
+})
diff --git a/tests/fixtures/figma-oracles/pattern-noise-custom-paints.json b/tests/fixtures/figma-oracles/pattern-noise-custom-paints.json
new file mode 100644
index 000000000..a10d3fdbe
--- /dev/null
+++ b/tests/fixtures/figma-oracles/pattern-noise-custom-paints.json
@@ -0,0 +1,47 @@
+{
+ "source": {
+ "tool": "figma-use eval",
+ "fileKey": "jSxlQDCrjsvqEQq17IWEcC",
+ "captured": "2026-05-22"
+ },
+ "pluginRuntimeCreation": {
+ "PATTERN": {
+ "ok": false,
+ "message": "in set_fills: Property \"fills\" failed validation: Invalid discriminator value. Expected 'SOLID' | 'GRADIENT_LINEAR' | 'GRADIENT_RADIAL' | 'GRADIENT_ANGULAR' | 'GRADIENT_DIAMOND' | 'IMAGE' | 'VIDEO' at [0].type"
+ },
+ "NOISE": {
+ "ok": false,
+ "message": "in set_fills: Property \"fills\" failed validation: Invalid discriminator value. Expected 'SOLID' | 'GRADIENT_LINEAR' | 'GRADIENT_RADIAL' | 'GRADIENT_ANGULAR' | 'GRADIENT_DIAMOND' | 'IMAGE' | 'VIDEO' at [0].type"
+ },
+ "CUSTOM": {
+ "ok": false,
+ "message": "in set_fills: Property \"fills\" failed validation: Invalid discriminator value. Expected 'SOLID' | 'GRADIENT_LINEAR' | 'GRADIENT_RADIAL' | 'GRADIENT_ANGULAR' | 'GRADIENT_DIAMOND' | 'IMAGE' | 'VIDEO' at [0].type"
+ }
+ },
+ "currentFileFillTypes": {
+ "SOLID": 562,
+ "GRADIENT_RADIAL": 2,
+ "IMAGE": 8,
+ "GRADIENT_LINEAR": 3
+ },
+ "localFigFixtureFillTypes": {
+ "tests/fixtures/nuxtui.fig": {
+ "SOLID": 168633,
+ "IMAGE": 13609,
+ "GRADIENT_RADIAL": 1,
+ "GRADIENT_LINEAR": 568
+ },
+ "tests/fixtures/gold-preview.fig": {
+ "SOLID": 2521,
+ "IMAGE": 3,
+ "GRADIENT_LINEAR": 1,
+ "GRADIENT_RADIAL": 2
+ },
+ "tests/fixtures/material3.fig": {
+ "SOLID": 41760,
+ "IMAGE": 328,
+ "GRADIENT_LINEAR": 9
+ }
+ },
+ "status": "No real PATTERN, NOISE, or CUSTOM paint payload was available in the connected Figma file or committed .fig fixtures. The plugin runtime rejects creating these paint types directly, so first-class rendering remains blocked on a Figma-authored sample."
+}