Add canonical canvas edits, identity migration and idempotent resource/AI operations #19

Merged
Zayden-Jung merged 49 commits from codex/headless-canvas-v1 into main 2026-11-11 14:53:34 +00:00
2 changed files with 4 additions and 2 deletions
Showing only changes of commit bf8763e0de - Show all commits
+2 -2
View File
@@ -95,8 +95,8 @@ func modelJSONSafe(value any, depth int) bool {
}
return true
case map[string]any:
for key, item := range value {
if canvasChoice(key, "__proto__", "constructor", "prototype") || !modelJSONSafe(item, depth+1) {
for _, item := range value {
if !modelJSONSafe(item, depth+1) {
return false
}
}
+2
View File
@@ -102,6 +102,8 @@ func TestCanonicalOperationsPreserveOpaquePayloadAndStableMoveIdentity(t *testin
model.Versions[modelChildID] = 1
future := modelTestNode("future", modelRootID)
future["componentId"], future["dataVersion"], future["data"], future["futureEnvelope"] = "plugin.future", float64(42), map[string]any{"nested": map[string]any{"list": []any{"x", float64(2)}}}, map[string]any{"retain": true}
future["data"].(map[string]any)["constructor"] = map[string]any{"retain": true}
future["data"].(map[string]any)["__proto__"] = map[string]any{"ordinary": "JSON data"}
model.Elements["future"] = future
op := modelOperation{ID: modelTestID(1), Changes: []modelChange{{Kind: "field", Target: modelTarget{ID: "a", Incarnation: 1}, Field: "ownerCanvasId", Before: modelJSON(modelRootID), After: modelJSON(modelChildID)}}}
after, touched, err := applyModelOperations(model, []modelOperation{op})