Files
Oleg Isonen 0d448313ab fix: harden MCP mutations and validation (#6402)
## Summary

Fixes the reproducible MCP regressions reported today:

- validate font upload metadata locally instead of surfacing an HTTP 500
- replace only the addressed child when `insertIndex` is supplied
- support cross-parent duplication
- bind data-variable assignments in actions
- reject string-valued `style` bindings
- include descriptions for every advertised MCP tool
- preserve resource data-source exposure on full updates
- render mixed expression/element children in the Builder canvas
- preserve explicit outer Collection references in nested scopes
- reject unsupported `update-page-settings` fields instead of dropping
them
- reject unavailable asset-query variables and log server error details

Closes #6390
Closes #6391
Closes #6392
Closes #6393
Closes #6394
Closes #6395
Closes #6398
Closes #6399
Closes #6401
Closes #6404
Closes #6405

## Verification

- 484 project-build tests
- 62 CLI tests
- 35 Builder browser tests
- 25 SDK tests
- project-build, Builder, CLI, and SDK type checks
- root lint and generated runtime contracts
2026-09-17 10:16:11 +02:00

41 lines
982 B
TypeScript

import { expect, test } from "vitest";
import { ROOT_INSTANCE_ID } from "@webstudio-is/sdk";
import { getInstanceVariableValues } from "./variable-values";
test("merges fallback values with a root-qualified canvas scope", () => {
const directValues = new Map([["direct", "value"]]);
expect(
getInstanceVariableValues(
new Map([[JSON.stringify(["box", "body"]), directValues]]),
["box", "body"]
)
).toBe(directValues);
const valuesByInstanceSelector = new Map([
[
JSON.stringify(["box", "body", ROOT_INSTANCE_ID]),
new Map([
["overridden", "scoped"],
["scoped", "value"],
]),
],
]);
expect(
getInstanceVariableValues(
valuesByInstanceSelector,
["box", "body"],
new Map([
["unscoped", "value"],
["overridden", "unscoped"],
])
)
).toEqual(
new Map([
["unscoped", "value"],
["overridden", "scoped"],
["scoped", "value"],
])
);
});