From 1a0b81342f27a933a89e2623db9994a7521436c7 Mon Sep 17 00:00:00 2001 From: Jeremy Massel <1123407+jkmassel@users.noreply.github.com> Date: Wed, 29 Apr 2026 13:11:09 -0600 Subject: [PATCH 1/2] fix(js): add iconForeground to block-inserter payload schema #468 added `iconForeground: getBlockIconForeground(item)` to the block payload, but the schema (added in #467, in trunk) still has `additionalProperties: false` on `BlockType` with no `iconForeground` entry. Trunk doesn't emit the field so trunk CI is fine; this branch carries both pieces and AJV rejects the payload. Mirrors the existing `icon` entry: nullable string. --- schemas/block-inserter-payload.schema.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/schemas/block-inserter-payload.schema.json b/schemas/block-inserter-payload.schema.json index 3bdc5a605..090d8583d 100644 --- a/schemas/block-inserter-payload.schema.json +++ b/schemas/block-inserter-payload.schema.json @@ -75,6 +75,10 @@ "type": [ "string", "null" ], "description": "SVG markup as a string, or null when the block has no renderable icon." }, + "iconForeground": { + "type": [ "string", "null" ], + "description": "CSS color (hex or rgba) applied to the SVG icon's foreground, or null when the block uses default tinting." + }, "frecency": { "type": "number" }, "isDisabled": { "type": "boolean" }, "isSearchOnly": { "type": "boolean" }, From de8a1f6a2b842a4d88a544406117e5ae1b20fc61 Mon Sep 17 00:00:00 2001 From: Jeremy Massel <1123407+jkmassel@users.noreply.github.com> Date: Wed, 29 Apr 2026 13:17:24 -0600 Subject: [PATCH 2/2] test(js): read AJV dataPath alongside instancePath in shape helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolved AJV in node_modules is 6.12.6 (despite package.json declaring ^8.18.0 — pulled in transitively). AJV 6 surfaces the failing field as `dataPath`; AJV 7+ uses `instancePath`. The helper only read `instancePath`, so error messages came back as `/: should be array` instead of `.patterns[0].blockTypes: should be array`, and the regex matchers in the rejection tests failed to find the field name. Read both, fall back across versions. --- src/utils/blocks.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/blocks.test.js b/src/utils/blocks.test.js index 984b2643e..d7f2ff60a 100644 --- a/src/utils/blocks.test.js +++ b/src/utils/blocks.test.js @@ -38,8 +38,8 @@ function assertBlockInserterPayloadShape( payload ) { if ( validate( payload ) ) { return; } - const { instancePath, message } = validate.errors[ 0 ]; - throw new Error( `${ instancePath || '/' }: ${ message }` ); + const { instancePath, dataPath, message } = validate.errors[ 0 ]; + throw new Error( `${ instancePath || dataPath || '/' }: ${ message }` ); } function makeInserterItem( overrides = {} ) {