{
  "format": "filelovenote-markdown-fixtures-v1",
  "sources": [
    "client/paper/editor-core.ts",
    "client/paper/canvas-node.ts",
    "src/services/drive-notes-markdown-service.js",
    "src/services/notes-markdown-service.js"
  ],
  "scope": "Synthetic compatibility evidence plus explicitly labelled REQUIRED REBUILD outcomes. No live API calls.",
  "fixtures": [
    {
      "id": "MD-DRIVE-RICH",
      "operation": "drive-roundtrip",
      "input": {
        "id": "doc-markdown-example",
        "title": "Field observations",
        "folderId": "folder-notes",
        "createdAt": 1793000000000,
        "updatedAt": 1793000001000,
        "trashedAt": null,
        "questions": [
          {
            "text": "What changed?"
          }
        ],
        "goalReferences": [],
        "forcedLanguage": "en",
        "content": {
          "type": "doc",
          "content": [
            {
              "type": "heading",
              "attrs": {
                "level": 1,
                "uid": "h-example",
                "slug": "field-observations"
              },
              "content": [
                {
                  "type": "text",
                  "text": "Field observations"
                }
              ]
            },
            {
              "type": "paragraph",
              "content": [
                {
                  "type": "text",
                  "text": "Strong",
                  "marks": [
                    {
                      "type": "strong"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Emphasis",
                  "marks": [
                    {
                      "type": "em"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Underline",
                  "marks": [
                    {
                      "type": "underline"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Strike",
                  "marks": [
                    {
                      "type": "strike"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Highlight",
                  "marks": [
                    {
                      "type": "highlight"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "code",
                  "marks": [
                    {
                      "type": "code"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Source",
                  "marks": [
                    {
                      "type": "link",
                      "attrs": {
                        "href": "https://example.invalid/source",
                        "target": "_blank",
                        "rel": "noopener noreferrer"
                      }
                    }
                  ]
                }
              ]
            },
            {
              "type": "blockquote",
              "content": [
                {
                  "type": "paragraph",
                  "content": [
                    {
                      "type": "text",
                      "text": "A source stays close to its notes."
                    }
                  ]
                }
              ]
            },
            {
              "type": "code_block",
              "content": [
                {
                  "type": "text",
                  "text": "const observed = true;"
                }
              ]
            },
            {
              "type": "horizontal_rule"
            },
            {
              "type": "bullet_list",
              "content": [
                {
                  "type": "list_item",
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "One source"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "ordered_list",
              "attrs": {
                "order": 3
              },
              "content": [
                {
                  "type": "list_item",
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "Third observation"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "task_list",
              "content": [
                {
                  "type": "task_item",
                  "attrs": {
                    "status": "todo",
                    "checked": false
                  },
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "todo"
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "task_item",
                  "attrs": {
                    "status": "done",
                    "checked": true
                  },
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "done"
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "task_item",
                  "attrs": {
                    "status": "cancelled",
                    "checked": false
                  },
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "cancelled"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "table",
              "attrs": {
                "numberedRows": true
              },
              "content": [
                {
                  "type": "table_row",
                  "content": [
                    {
                      "type": "table_header",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": null,
                        "background": null,
                        "color": null,
                        "textAlign": "left"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "Topic"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "type": "table_header",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": null,
                        "background": null,
                        "color": null,
                        "textAlign": "right"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "Count"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "table_row",
                  "content": [
                    {
                      "type": "table_cell",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": [
                          180
                        ],
                        "background": "#eef3f7",
                        "color": "#29353c",
                        "textAlign": "left"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "Sources"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "type": "table_cell",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": null,
                        "background": null,
                        "color": null,
                        "textAlign": "right"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "2"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "imageEmbed",
              "attrs": {
                "src": "/google-drive/raw/file-image-example",
                "caption": "Field image",
                "width": 320
              }
            },
            {
              "type": "audioEmbed",
              "attrs": {
                "src": "/google-drive/raw/file-audio-example"
              }
            },
            {
              "type": "videoEmbed",
              "attrs": {
                "src": "/google-drive/raw/file-video-example"
              }
            },
            {
              "type": "paragraph",
              "content": [
                {
                  "type": "text",
                  "text": "See "
                },
                {
                  "type": "inlineMediaReference",
                  "attrs": {
                    "src": "/google-drive/raw/file-audio-example",
                    "kind": "audio",
                    "name": "Field audio"
                  }
                },
                {
                  "type": "text",
                  "text": " and "
                },
                {
                  "type": "documentReference",
                  "attrs": {
                    "docId": "doc-related-example",
                    "title": "Related observations"
                  }
                },
                {
                  "type": "hard_break"
                },
                {
                  "type": "text",
                  "text": "Continue below."
                }
              ]
            },
            {
              "type": "canvas",
              "attrs": {
                "canvasId": "cv-example",
                "summary": {
                  "title": "Source map",
                  "elementCount": 2,
                  "refTitles": [
                    "Field audio"
                  ]
                }
              }
            },
            {
              "type": "youtubeSearch",
              "attrs": {
                "query": "synthetic source query"
              }
            },
            {
              "type": "youtubeReference",
              "attrs": {
                "src": "https://www.youtube.com/watch?v=abcDEF012_-",
                "title": "Example source",
                "channelTitle": "Example channel",
                "thumbnailUrl": "https://example.invalid/thumb.jpg",
                "videoId": "abcDEF012_-"
              }
            }
          ]
        }
      },
      "expected": {
        "id": "doc-markdown-example",
        "title": "Field observations",
        "folderId": "folder-notes",
        "createdAt": 1793000000000,
        "updatedAt": 1793000001000,
        "trashedAt": null,
        "questions": [
          {
            "text": "What changed?"
          }
        ],
        "goalReferences": [],
        "forcedLanguage": "en",
        "content": {
          "type": "doc",
          "content": [
            {
              "type": "heading",
              "attrs": {
                "level": 1,
                "uid": "h-example",
                "slug": "field-observations"
              },
              "content": [
                {
                  "type": "text",
                  "text": "Field observations"
                }
              ]
            },
            {
              "type": "paragraph",
              "content": [
                {
                  "type": "text",
                  "text": "Strong",
                  "marks": [
                    {
                      "type": "strong"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Emphasis",
                  "marks": [
                    {
                      "type": "em"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Underline",
                  "marks": [
                    {
                      "type": "underline"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Strike",
                  "marks": [
                    {
                      "type": "strike"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Highlight",
                  "marks": [
                    {
                      "type": "highlight"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "code",
                  "marks": [
                    {
                      "type": "code"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Source",
                  "marks": [
                    {
                      "type": "link",
                      "attrs": {
                        "href": "https://example.invalid/source",
                        "target": "_blank",
                        "rel": "noopener noreferrer"
                      }
                    }
                  ]
                }
              ]
            },
            {
              "type": "blockquote",
              "content": [
                {
                  "type": "paragraph",
                  "content": [
                    {
                      "type": "text",
                      "text": "A source stays close to its notes."
                    }
                  ]
                }
              ]
            },
            {
              "type": "code_block",
              "content": [
                {
                  "type": "text",
                  "text": "const observed = true;"
                }
              ]
            },
            {
              "type": "horizontal_rule"
            },
            {
              "type": "bullet_list",
              "content": [
                {
                  "type": "list_item",
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "One source"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "ordered_list",
              "attrs": {
                "order": 3
              },
              "content": [
                {
                  "type": "list_item",
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "Third observation"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "task_list",
              "content": [
                {
                  "type": "task_item",
                  "attrs": {
                    "status": "todo",
                    "checked": false
                  },
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "todo"
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "task_item",
                  "attrs": {
                    "status": "done",
                    "checked": true
                  },
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "done"
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "task_item",
                  "attrs": {
                    "status": "cancelled",
                    "checked": false
                  },
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "cancelled"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "table",
              "attrs": {
                "numberedRows": true
              },
              "content": [
                {
                  "type": "table_row",
                  "content": [
                    {
                      "type": "table_header",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": null,
                        "background": null,
                        "color": null,
                        "textAlign": "left"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "Topic"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "type": "table_header",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": null,
                        "background": null,
                        "color": null,
                        "textAlign": "right"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "Count"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "table_row",
                  "content": [
                    {
                      "type": "table_cell",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": [
                          180
                        ],
                        "background": "#eef3f7",
                        "color": "#29353c",
                        "textAlign": "left"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "Sources"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "type": "table_cell",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": null,
                        "background": null,
                        "color": null,
                        "textAlign": "right"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "2"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "imageEmbed",
              "attrs": {
                "src": "/google-drive/raw/file-image-example",
                "caption": "Field image",
                "width": 320
              }
            },
            {
              "type": "audioEmbed",
              "attrs": {
                "src": "/google-drive/raw/file-audio-example"
              }
            },
            {
              "type": "videoEmbed",
              "attrs": {
                "src": "/google-drive/raw/file-video-example"
              }
            },
            {
              "type": "paragraph",
              "content": [
                {
                  "type": "text",
                  "text": "See "
                },
                {
                  "type": "inlineMediaReference",
                  "attrs": {
                    "src": "/google-drive/raw/file-audio-example",
                    "kind": "audio",
                    "name": "Field audio"
                  }
                },
                {
                  "type": "text",
                  "text": " and "
                },
                {
                  "type": "documentReference",
                  "attrs": {
                    "docId": "doc-related-example",
                    "title": "Related observations"
                  }
                },
                {
                  "type": "hard_break"
                },
                {
                  "type": "text",
                  "text": "Continue below."
                }
              ]
            },
            {
              "type": "canvas",
              "attrs": {
                "canvasId": "cv-example",
                "summary": {
                  "title": "Source map",
                  "elementCount": 2,
                  "refTitles": [
                    "Field audio"
                  ]
                }
              }
            },
            {
              "type": "youtubeSearch",
              "attrs": {
                "query": "synthetic source query"
              }
            },
            {
              "type": "youtubeReference",
              "attrs": {
                "src": "https://www.youtube.com/watch?v=abcDEF012_-",
                "title": "Example source",
                "channelTitle": "Example channel",
                "thumbnailUrl": "https://example.invalid/thumb.jpg",
                "videoId": "abcDEF012_-"
              }
            }
          ]
        }
      },
      "expectation": "decodeDriveNote(encodeDriveNote(input)) deep-equals expected; schema.check succeeds; payload includes every supported custom node/mark."
    },
    {
      "id": "MD-DRIVE-EXTERNAL-HEADING",
      "operation": "drive-external-replace",
      "input": {
        "id": "doc-markdown-example",
        "title": "Field observations",
        "folderId": "folder-notes",
        "createdAt": 1793000000000,
        "updatedAt": 1793000001000,
        "trashedAt": null,
        "questions": [
          {
            "text": "What changed?"
          }
        ],
        "goalReferences": [],
        "forcedLanguage": "en",
        "content": {
          "type": "doc",
          "content": [
            {
              "type": "heading",
              "attrs": {
                "level": 1,
                "uid": "h-example",
                "slug": "field-observations"
              },
              "content": [
                {
                  "type": "text",
                  "text": "Field observations"
                }
              ]
            },
            {
              "type": "paragraph",
              "content": [
                {
                  "type": "text",
                  "text": "Strong",
                  "marks": [
                    {
                      "type": "strong"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Emphasis",
                  "marks": [
                    {
                      "type": "em"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Underline",
                  "marks": [
                    {
                      "type": "underline"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Strike",
                  "marks": [
                    {
                      "type": "strike"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Highlight",
                  "marks": [
                    {
                      "type": "highlight"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "code",
                  "marks": [
                    {
                      "type": "code"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Source",
                  "marks": [
                    {
                      "type": "link",
                      "attrs": {
                        "href": "https://example.invalid/source",
                        "target": "_blank",
                        "rel": "noopener noreferrer"
                      }
                    }
                  ]
                }
              ]
            },
            {
              "type": "blockquote",
              "content": [
                {
                  "type": "paragraph",
                  "content": [
                    {
                      "type": "text",
                      "text": "A source stays close to its notes."
                    }
                  ]
                }
              ]
            },
            {
              "type": "code_block",
              "content": [
                {
                  "type": "text",
                  "text": "const observed = true;"
                }
              ]
            },
            {
              "type": "horizontal_rule"
            },
            {
              "type": "bullet_list",
              "content": [
                {
                  "type": "list_item",
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "One source"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "ordered_list",
              "attrs": {
                "order": 3
              },
              "content": [
                {
                  "type": "list_item",
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "Third observation"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "task_list",
              "content": [
                {
                  "type": "task_item",
                  "attrs": {
                    "status": "todo",
                    "checked": false
                  },
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "todo"
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "task_item",
                  "attrs": {
                    "status": "done",
                    "checked": true
                  },
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "done"
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "task_item",
                  "attrs": {
                    "status": "cancelled",
                    "checked": false
                  },
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "cancelled"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "table",
              "attrs": {
                "numberedRows": true
              },
              "content": [
                {
                  "type": "table_row",
                  "content": [
                    {
                      "type": "table_header",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": null,
                        "background": null,
                        "color": null,
                        "textAlign": "left"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "Topic"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "type": "table_header",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": null,
                        "background": null,
                        "color": null,
                        "textAlign": "right"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "Count"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "table_row",
                  "content": [
                    {
                      "type": "table_cell",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": [
                          180
                        ],
                        "background": "#eef3f7",
                        "color": "#29353c",
                        "textAlign": "left"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "Sources"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "type": "table_cell",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": null,
                        "background": null,
                        "color": null,
                        "textAlign": "right"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "2"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "imageEmbed",
              "attrs": {
                "src": "/google-drive/raw/file-image-example",
                "caption": "Field image",
                "width": 320
              }
            },
            {
              "type": "audioEmbed",
              "attrs": {
                "src": "/google-drive/raw/file-audio-example"
              }
            },
            {
              "type": "videoEmbed",
              "attrs": {
                "src": "/google-drive/raw/file-video-example"
              }
            },
            {
              "type": "paragraph",
              "content": [
                {
                  "type": "text",
                  "text": "See "
                },
                {
                  "type": "inlineMediaReference",
                  "attrs": {
                    "src": "/google-drive/raw/file-audio-example",
                    "kind": "audio",
                    "name": "Field audio"
                  }
                },
                {
                  "type": "text",
                  "text": " and "
                },
                {
                  "type": "documentReference",
                  "attrs": {
                    "docId": "doc-related-example",
                    "title": "Related observations"
                  }
                },
                {
                  "type": "hard_break"
                },
                {
                  "type": "text",
                  "text": "Continue below."
                }
              ]
            },
            {
              "type": "canvas",
              "attrs": {
                "canvasId": "cv-example",
                "summary": {
                  "title": "Source map",
                  "elementCount": 2,
                  "refTitles": [
                    "Field audio"
                  ]
                }
              }
            },
            {
              "type": "youtubeSearch",
              "attrs": {
                "query": "synthetic source query"
              }
            },
            {
              "type": "youtubeReference",
              "attrs": {
                "src": "https://www.youtube.com/watch?v=abcDEF012_-",
                "title": "Example source",
                "channelTitle": "Example channel",
                "thumbnailUrl": "https://example.invalid/thumb.jpg",
                "videoId": "abcDEF012_-"
              }
            }
          ]
        }
      },
      "replace": {
        "from": "# Field observations",
        "to": "# Renamed observations"
      },
      "expected": {
        "title": "Renamed observations",
        "unchangedNodeIndices": [
          1,
          2,
          3,
          4,
          5,
          6,
          7,
          8,
          9,
          10,
          11,
          12,
          13,
          14,
          15
        ]
      },
      "expectation": "Changed H1 body is reparsed and renames the note; every untouched block remains the original JSON."
    },
    {
      "id": "MD-PLAIN-TABLE",
      "markdown": "| Topic | Count |\n| :--- | ---: |\n| Sources | 2 |",
      "operation": "plain-parse",
      "expected": {
        "type": "doc",
        "content": [
          {
            "type": "table",
            "attrs": {
              "numberedRows": false
            },
            "content": [
              {
                "type": "table_row",
                "content": [
                  {
                    "type": "table_header",
                    "attrs": {
                      "colspan": 1,
                      "rowspan": 1,
                      "colwidth": null,
                      "background": null,
                      "color": null,
                      "textAlign": "left"
                    },
                    "content": [
                      {
                        "type": "paragraph",
                        "content": [
                          {
                            "type": "text",
                            "text": "Topic"
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "type": "table_header",
                    "attrs": {
                      "colspan": 1,
                      "rowspan": 1,
                      "colwidth": null,
                      "background": null,
                      "color": null,
                      "textAlign": "right"
                    },
                    "content": [
                      {
                        "type": "paragraph",
                        "content": [
                          {
                            "type": "text",
                            "text": "Count"
                          }
                        ]
                      }
                    ]
                  }
                ]
              },
              {
                "type": "table_row",
                "content": [
                  {
                    "type": "table_cell",
                    "attrs": {
                      "colspan": 1,
                      "rowspan": 1,
                      "colwidth": null,
                      "background": null,
                      "color": null,
                      "textAlign": "left"
                    },
                    "content": [
                      {
                        "type": "paragraph",
                        "content": [
                          {
                            "type": "text",
                            "text": "Sources"
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "type": "table_cell",
                    "attrs": {
                      "colspan": 1,
                      "rowspan": 1,
                      "colwidth": null,
                      "background": null,
                      "color": null,
                      "textAlign": "right"
                    },
                    "content": [
                      {
                        "type": "paragraph",
                        "content": [
                          {
                            "type": "text",
                            "text": "2"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      "expectedExport": "| Topic | Count |\n| :--- | ---: |\n| Sources | 2 |",
      "expectation": "Current source evidence; see required rebuild outcomes for lossy formatting cases."
    },
    {
      "id": "MD-PLAIN-TASKS",
      "markdown": "- [ ] Observe\n- [x] Read\n- [-] Discard",
      "operation": "plain-parse",
      "expected": {
        "type": "doc",
        "content": [
          {
            "type": "task_list",
            "content": [
              {
                "type": "task_item",
                "attrs": {
                  "status": "todo",
                  "checked": false
                },
                "content": [
                  {
                    "type": "paragraph",
                    "content": [
                      {
                        "type": "text",
                        "text": "Observe"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "task_item",
                "attrs": {
                  "status": "done",
                  "checked": true
                },
                "content": [
                  {
                    "type": "paragraph",
                    "content": [
                      {
                        "type": "text",
                        "text": "Read"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "task_item",
                "attrs": {
                  "status": "cancelled",
                  "checked": false
                },
                "content": [
                  {
                    "type": "paragraph",
                    "content": [
                      {
                        "type": "text",
                        "text": "Discard"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      "expectedExport": "- [ ] Observe\n\n- [x] Read\n\n- [-] Discard",
      "expectation": "Current source evidence; see required rebuild outcomes for lossy formatting cases."
    },
    {
      "id": "MD-PLAIN-FENCE",
      "markdown": "```js\nconst observed = true;\n```",
      "operation": "plain-parse",
      "expected": {
        "type": "doc",
        "content": [
          {
            "type": "code_block",
            "content": [
              {
                "type": "text",
                "text": "const observed = true;"
              }
            ]
          }
        ]
      },
      "expectedExport": "```\nconst observed = true;\n```",
      "expectation": "Current source evidence; see required rebuild outcomes for lossy formatting cases."
    },
    {
      "id": "MD-PLAIN-LINK",
      "markdown": "[Source](https://example.invalid/source \"Optional title\")",
      "operation": "plain-parse",
      "expected": {
        "type": "doc",
        "content": [
          {
            "type": "paragraph",
            "content": [
              {
                "type": "text",
                "marks": [
                  {
                    "type": "link",
                    "attrs": {
                      "href": "https://example.invalid/source",
                      "target": "_blank",
                      "rel": "noopener noreferrer"
                    }
                  }
                ],
                "text": "Source"
              }
            ]
          }
        ]
      },
      "expectedExport": "[Source](https://example.invalid/source)",
      "expectation": "Current source evidence; see required rebuild outcomes for lossy formatting cases."
    },
    {
      "id": "MD-PLAIN-UNDERLINE",
      "markdown": "__Underlined in the editor__",
      "operation": "plain-parse",
      "expected": {
        "type": "doc",
        "content": [
          {
            "type": "paragraph",
            "content": [
              {
                "type": "text",
                "marks": [
                  {
                    "type": "strong"
                  }
                ],
                "text": "Underlined in the editor"
              }
            ]
          }
        ]
      },
      "expectedExport": "**Underlined in the editor**",
      "expectation": "Current source evidence; see required rebuild outcomes for lossy formatting cases."
    },
    {
      "id": "MD-PLAIN-HIGHLIGHT-STRIKE",
      "markdown": "==Highlighted== and ~~struck~~",
      "operation": "plain-parse",
      "expected": {
        "type": "doc",
        "content": [
          {
            "type": "paragraph",
            "content": [
              {
                "type": "text",
                "text": "==Highlighted== and ~~struck~~"
              }
            ]
          }
        ]
      },
      "expectedExport": "==Highlighted== and \\~\\~struck\\~\\~",
      "expectation": "Current source evidence; see required rebuild outcomes for lossy formatting cases."
    },
    {
      "id": "MD-PLAIN-REFERENCES",
      "markdown": "[Audio](/google-drive/raw/file-audio-example)\n\n[Related](/notes?id=doc-related-example)\n\n[Canvas: Source map](#canvas-cv-example)",
      "operation": "plain-parse",
      "expected": {
        "type": "doc",
        "content": [
          {
            "type": "paragraph",
            "content": [
              {
                "type": "text",
                "marks": [
                  {
                    "type": "link",
                    "attrs": {
                      "href": "/google-drive/raw/file-audio-example",
                      "target": "_blank",
                      "rel": "noopener noreferrer"
                    }
                  }
                ],
                "text": "Audio"
              }
            ]
          },
          {
            "type": "paragraph",
            "content": [
              {
                "type": "text",
                "marks": [
                  {
                    "type": "link",
                    "attrs": {
                      "href": "/notes?id=doc-related-example",
                      "target": "_blank",
                      "rel": "noopener noreferrer"
                    }
                  }
                ],
                "text": "Related"
              }
            ]
          },
          {
            "type": "paragraph",
            "content": [
              {
                "type": "text",
                "marks": [
                  {
                    "type": "link",
                    "attrs": {
                      "href": "#canvas-cv-example",
                      "target": "_blank",
                      "rel": "noopener noreferrer"
                    }
                  }
                ],
                "text": "Canvas: Source map"
              }
            ]
          }
        ]
      },
      "expectedExport": "[Audio](/google-drive/raw/file-audio-example)\n\n[Related](/notes?id=doc-related-example)\n\n[Canvas: Source map](#canvas-cv-example)",
      "expectation": "Current source evidence; see required rebuild outcomes for lossy formatting cases."
    },
    {
      "id": "MD-CURRENT-IMAGE-GAP",
      "operation": "plain-parse-error",
      "markdown": "![Field image](https://example.invalid/image.png)",
      "expectedErrorContains": "Token type `image` not supported",
      "requiredRebuildOutcome": {
        "standalone": "imageEmbed with src=https://example.invalid/image.png and caption=Field image",
        "inline": "ordinary link mark with the safe URL and visible alt text",
        "overwrite": "Keep good note/base/queue on failure; no empty replacement"
      },
      "knownCurrentGap": true
    },
    {
      "id": "MD-BAD-METADATA",
      "operation": "drive-decode-error",
      "markdown": "---\nfilesandnotes: {invalid json}\n---\n\nReadable text",
      "expectedError": true
    },
    {
      "id": "MD-BAD-BLOCK",
      "operation": "drive-decode-error",
      "markdown": "<!-- filesandnotes:block broken -->\nReadable text",
      "expectedError": true
    },
    {
      "id": "MD-METADATA-ONLY",
      "operation": "drive-decode-empty-current",
      "markdown": "---\nfilesandnotes: {\"id\":\"doc-markdown-example\",\"title\":\"Empty remote projection\"}\n---\n",
      "currentOutcome": "decodeDriveNote returns content:[{type:\"paragraph\"}]. This is not proof of an intentional deletion.",
      "requiredRebuildOutcome": "During refresh of a known nonempty note, retain local/base/pending data and report a per-note read/validation error unless an intentional empty edit is explicitly confirmed by the write contract.",
      "knownCurrentGap": true
    }
  ],
  "requiredRebuildCases": [
    {
      "id": "MD-REBUILD-TITLE-MARKS",
      "operation": "drive-roundtrip",
      "input": {
        "id": "doc-markdown-example",
        "title": "Field observations",
        "folderId": "folder-notes",
        "createdAt": 1793000000000,
        "updatedAt": 1793000001000,
        "trashedAt": null,
        "questions": [
          {
            "text": "What changed?"
          }
        ],
        "goalReferences": [],
        "forcedLanguage": "en",
        "content": {
          "type": "doc",
          "content": [
            {
              "type": "heading",
              "attrs": {
                "level": 1,
                "uid": "h-example",
                "slug": "field-observations"
              },
              "content": [
                {
                  "type": "text",
                  "text": "Field observations",
                  "marks": [
                    {
                      "type": "strong"
                    }
                  ]
                }
              ]
            },
            {
              "type": "paragraph",
              "content": [
                {
                  "type": "text",
                  "text": "Strong",
                  "marks": [
                    {
                      "type": "strong"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Emphasis",
                  "marks": [
                    {
                      "type": "em"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Underline",
                  "marks": [
                    {
                      "type": "underline"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Strike",
                  "marks": [
                    {
                      "type": "strike"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Highlight",
                  "marks": [
                    {
                      "type": "highlight"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "code",
                  "marks": [
                    {
                      "type": "code"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Source",
                  "marks": [
                    {
                      "type": "link",
                      "attrs": {
                        "href": "https://example.invalid/source",
                        "target": "_blank",
                        "rel": "noopener noreferrer"
                      }
                    }
                  ]
                }
              ]
            },
            {
              "type": "blockquote",
              "content": [
                {
                  "type": "paragraph",
                  "content": [
                    {
                      "type": "text",
                      "text": "A source stays close to its notes."
                    }
                  ]
                }
              ]
            },
            {
              "type": "code_block",
              "content": [
                {
                  "type": "text",
                  "text": "const observed = true;"
                }
              ]
            },
            {
              "type": "horizontal_rule"
            },
            {
              "type": "bullet_list",
              "content": [
                {
                  "type": "list_item",
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "One source"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "ordered_list",
              "attrs": {
                "order": 3
              },
              "content": [
                {
                  "type": "list_item",
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "Third observation"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "task_list",
              "content": [
                {
                  "type": "task_item",
                  "attrs": {
                    "status": "todo",
                    "checked": false
                  },
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "todo"
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "task_item",
                  "attrs": {
                    "status": "done",
                    "checked": true
                  },
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "done"
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "task_item",
                  "attrs": {
                    "status": "cancelled",
                    "checked": false
                  },
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "cancelled"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "table",
              "attrs": {
                "numberedRows": true
              },
              "content": [
                {
                  "type": "table_row",
                  "content": [
                    {
                      "type": "table_header",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": null,
                        "background": null,
                        "color": null,
                        "textAlign": "left"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "Topic"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "type": "table_header",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": null,
                        "background": null,
                        "color": null,
                        "textAlign": "right"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "Count"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "table_row",
                  "content": [
                    {
                      "type": "table_cell",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": [
                          180
                        ],
                        "background": "#eef3f7",
                        "color": "#29353c",
                        "textAlign": "left"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "Sources"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "type": "table_cell",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": null,
                        "background": null,
                        "color": null,
                        "textAlign": "right"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "2"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "imageEmbed",
              "attrs": {
                "src": "/google-drive/raw/file-image-example",
                "caption": "Field image",
                "width": 320
              }
            },
            {
              "type": "audioEmbed",
              "attrs": {
                "src": "/google-drive/raw/file-audio-example"
              }
            },
            {
              "type": "videoEmbed",
              "attrs": {
                "src": "/google-drive/raw/file-video-example"
              }
            },
            {
              "type": "paragraph",
              "content": [
                {
                  "type": "text",
                  "text": "See "
                },
                {
                  "type": "inlineMediaReference",
                  "attrs": {
                    "src": "/google-drive/raw/file-audio-example",
                    "kind": "audio",
                    "name": "Field audio"
                  }
                },
                {
                  "type": "text",
                  "text": " and "
                },
                {
                  "type": "documentReference",
                  "attrs": {
                    "docId": "doc-related-example",
                    "title": "Related observations"
                  }
                },
                {
                  "type": "hard_break"
                },
                {
                  "type": "text",
                  "text": "Continue below."
                }
              ]
            },
            {
              "type": "canvas",
              "attrs": {
                "canvasId": "cv-example",
                "summary": {
                  "title": "Source map",
                  "elementCount": 2,
                  "refTitles": [
                    "Field audio"
                  ]
                }
              }
            },
            {
              "type": "youtubeSearch",
              "attrs": {
                "query": "synthetic source query"
              }
            },
            {
              "type": "youtubeReference",
              "attrs": {
                "src": "https://www.youtube.com/watch?v=abcDEF012_-",
                "title": "Example source",
                "channelTitle": "Example channel",
                "thumbnailUrl": "https://example.invalid/thumb.jpg",
                "videoId": "abcDEF012_-"
              }
            }
          ]
        }
      },
      "expected": {
        "id": "doc-markdown-example",
        "title": "Field observations",
        "folderId": "folder-notes",
        "createdAt": 1793000000000,
        "updatedAt": 1793000001000,
        "trashedAt": null,
        "questions": [
          {
            "text": "What changed?"
          }
        ],
        "goalReferences": [],
        "forcedLanguage": "en",
        "content": {
          "type": "doc",
          "content": [
            {
              "type": "heading",
              "attrs": {
                "level": 1,
                "uid": "h-example",
                "slug": "field-observations"
              },
              "content": [
                {
                  "type": "text",
                  "text": "Field observations",
                  "marks": [
                    {
                      "type": "strong"
                    }
                  ]
                }
              ]
            },
            {
              "type": "paragraph",
              "content": [
                {
                  "type": "text",
                  "text": "Strong",
                  "marks": [
                    {
                      "type": "strong"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Emphasis",
                  "marks": [
                    {
                      "type": "em"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Underline",
                  "marks": [
                    {
                      "type": "underline"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Strike",
                  "marks": [
                    {
                      "type": "strike"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Highlight",
                  "marks": [
                    {
                      "type": "highlight"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "code",
                  "marks": [
                    {
                      "type": "code"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Source",
                  "marks": [
                    {
                      "type": "link",
                      "attrs": {
                        "href": "https://example.invalid/source",
                        "target": "_blank",
                        "rel": "noopener noreferrer"
                      }
                    }
                  ]
                }
              ]
            },
            {
              "type": "blockquote",
              "content": [
                {
                  "type": "paragraph",
                  "content": [
                    {
                      "type": "text",
                      "text": "A source stays close to its notes."
                    }
                  ]
                }
              ]
            },
            {
              "type": "code_block",
              "content": [
                {
                  "type": "text",
                  "text": "const observed = true;"
                }
              ]
            },
            {
              "type": "horizontal_rule"
            },
            {
              "type": "bullet_list",
              "content": [
                {
                  "type": "list_item",
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "One source"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "ordered_list",
              "attrs": {
                "order": 3
              },
              "content": [
                {
                  "type": "list_item",
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "Third observation"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "task_list",
              "content": [
                {
                  "type": "task_item",
                  "attrs": {
                    "status": "todo",
                    "checked": false
                  },
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "todo"
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "task_item",
                  "attrs": {
                    "status": "done",
                    "checked": true
                  },
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "done"
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "task_item",
                  "attrs": {
                    "status": "cancelled",
                    "checked": false
                  },
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "cancelled"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "table",
              "attrs": {
                "numberedRows": true
              },
              "content": [
                {
                  "type": "table_row",
                  "content": [
                    {
                      "type": "table_header",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": null,
                        "background": null,
                        "color": null,
                        "textAlign": "left"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "Topic"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "type": "table_header",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": null,
                        "background": null,
                        "color": null,
                        "textAlign": "right"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "Count"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "table_row",
                  "content": [
                    {
                      "type": "table_cell",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": [
                          180
                        ],
                        "background": "#eef3f7",
                        "color": "#29353c",
                        "textAlign": "left"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "Sources"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "type": "table_cell",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": null,
                        "background": null,
                        "color": null,
                        "textAlign": "right"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "2"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "imageEmbed",
              "attrs": {
                "src": "/google-drive/raw/file-image-example",
                "caption": "Field image",
                "width": 320
              }
            },
            {
              "type": "audioEmbed",
              "attrs": {
                "src": "/google-drive/raw/file-audio-example"
              }
            },
            {
              "type": "videoEmbed",
              "attrs": {
                "src": "/google-drive/raw/file-video-example"
              }
            },
            {
              "type": "paragraph",
              "content": [
                {
                  "type": "text",
                  "text": "See "
                },
                {
                  "type": "inlineMediaReference",
                  "attrs": {
                    "src": "/google-drive/raw/file-audio-example",
                    "kind": "audio",
                    "name": "Field audio"
                  }
                },
                {
                  "type": "text",
                  "text": " and "
                },
                {
                  "type": "documentReference",
                  "attrs": {
                    "docId": "doc-related-example",
                    "title": "Related observations"
                  }
                },
                {
                  "type": "hard_break"
                },
                {
                  "type": "text",
                  "text": "Continue below."
                }
              ]
            },
            {
              "type": "canvas",
              "attrs": {
                "canvasId": "cv-example",
                "summary": {
                  "title": "Source map",
                  "elementCount": 2,
                  "refTitles": [
                    "Field audio"
                  ]
                }
              }
            },
            {
              "type": "youtubeSearch",
              "attrs": {
                "query": "synthetic source query"
              }
            },
            {
              "type": "youtubeReference",
              "attrs": {
                "src": "https://www.youtube.com/watch?v=abcDEF012_-",
                "title": "Example source",
                "channelTitle": "Example channel",
                "thumbnailUrl": "https://example.invalid/thumb.jpg",
                "videoId": "abcDEF012_-"
              }
            }
          ]
        }
      },
      "currentKnownGap": "encodeDriveNote drops the first H1 inline marks.",
      "required": true
    },
    {
      "id": "MD-REBUILD-IMAGE",
      "operation": "plain-parse",
      "markdown": "![Field image](https://example.invalid/image.png)",
      "expected": {
        "type": "doc",
        "content": [
          {
            "type": "imageEmbed",
            "attrs": {
              "src": "https://example.invalid/image.png",
              "caption": "Field image",
              "width": null
            }
          }
        ]
      },
      "currentKnownGap": "Plain parser throws for image tokens.",
      "required": true
    },
    {
      "id": "MD-REBUILD-INLINE-IMAGE",
      "operation": "plain-parse",
      "markdown": "Before ![Field image](https://example.invalid/image.png) after.",
      "requiredOutcome": "Paragraph with unchanged surrounding text and a safe normal link labelled Field image. No unsupported inline image node and no dropped alt text.",
      "required": true
    },
    {
      "id": "MD-REBUILD-UNSAFE-URL",
      "operation": "plain-parse",
      "markdown": "![Visible label](javascript:alert(1))",
      "requiredOutcome": "No active unsafe src or href; visible text survives; rejected source is reported, not silently imported as executable markup.",
      "required": true
    },
    {
      "id": "MD-REBUILD-UNKNOWN-NODE",
      "operation": "integration-read-failure",
      "mutation": {
        "encodedNode": {
          "type": "futureUnsupportedBlock",
          "attrs": {
            "label": "Synthetic unsupported content"
          }
        }
      },
      "requiredOutcome": "Keep original remote content plus known local document/base/pending operation; report unsupported data and prevent destructive sync.",
      "required": true
    },
    {
      "id": "MD-REBUILD-EMPTY-OVERWRITE",
      "operation": "integration-read-failure",
      "existingDocument": {
        "id": "doc-markdown-example",
        "title": "Field observations",
        "folderId": "folder-notes",
        "createdAt": 1793000000000,
        "updatedAt": 1793000001000,
        "trashedAt": null,
        "questions": [
          {
            "text": "What changed?"
          }
        ],
        "goalReferences": [],
        "forcedLanguage": "en",
        "content": {
          "type": "doc",
          "content": [
            {
              "type": "heading",
              "attrs": {
                "level": 1,
                "uid": "h-example",
                "slug": "field-observations"
              },
              "content": [
                {
                  "type": "text",
                  "text": "Field observations"
                }
              ]
            },
            {
              "type": "paragraph",
              "content": [
                {
                  "type": "text",
                  "text": "Strong",
                  "marks": [
                    {
                      "type": "strong"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Emphasis",
                  "marks": [
                    {
                      "type": "em"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Underline",
                  "marks": [
                    {
                      "type": "underline"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Strike",
                  "marks": [
                    {
                      "type": "strike"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Highlight",
                  "marks": [
                    {
                      "type": "highlight"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "code",
                  "marks": [
                    {
                      "type": "code"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " "
                },
                {
                  "type": "text",
                  "text": "Source",
                  "marks": [
                    {
                      "type": "link",
                      "attrs": {
                        "href": "https://example.invalid/source",
                        "target": "_blank",
                        "rel": "noopener noreferrer"
                      }
                    }
                  ]
                }
              ]
            },
            {
              "type": "blockquote",
              "content": [
                {
                  "type": "paragraph",
                  "content": [
                    {
                      "type": "text",
                      "text": "A source stays close to its notes."
                    }
                  ]
                }
              ]
            },
            {
              "type": "code_block",
              "content": [
                {
                  "type": "text",
                  "text": "const observed = true;"
                }
              ]
            },
            {
              "type": "horizontal_rule"
            },
            {
              "type": "bullet_list",
              "content": [
                {
                  "type": "list_item",
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "One source"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "ordered_list",
              "attrs": {
                "order": 3
              },
              "content": [
                {
                  "type": "list_item",
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "Third observation"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "task_list",
              "content": [
                {
                  "type": "task_item",
                  "attrs": {
                    "status": "todo",
                    "checked": false
                  },
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "todo"
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "task_item",
                  "attrs": {
                    "status": "done",
                    "checked": true
                  },
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "done"
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "task_item",
                  "attrs": {
                    "status": "cancelled",
                    "checked": false
                  },
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "cancelled"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "table",
              "attrs": {
                "numberedRows": true
              },
              "content": [
                {
                  "type": "table_row",
                  "content": [
                    {
                      "type": "table_header",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": null,
                        "background": null,
                        "color": null,
                        "textAlign": "left"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "Topic"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "type": "table_header",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": null,
                        "background": null,
                        "color": null,
                        "textAlign": "right"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "Count"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "table_row",
                  "content": [
                    {
                      "type": "table_cell",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": [
                          180
                        ],
                        "background": "#eef3f7",
                        "color": "#29353c",
                        "textAlign": "left"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "Sources"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "type": "table_cell",
                      "attrs": {
                        "colspan": 1,
                        "rowspan": 1,
                        "colwidth": null,
                        "background": null,
                        "color": null,
                        "textAlign": "right"
                      },
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "2"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "imageEmbed",
              "attrs": {
                "src": "/google-drive/raw/file-image-example",
                "caption": "Field image",
                "width": 320
              }
            },
            {
              "type": "audioEmbed",
              "attrs": {
                "src": "/google-drive/raw/file-audio-example"
              }
            },
            {
              "type": "videoEmbed",
              "attrs": {
                "src": "/google-drive/raw/file-video-example"
              }
            },
            {
              "type": "paragraph",
              "content": [
                {
                  "type": "text",
                  "text": "See "
                },
                {
                  "type": "inlineMediaReference",
                  "attrs": {
                    "src": "/google-drive/raw/file-audio-example",
                    "kind": "audio",
                    "name": "Field audio"
                  }
                },
                {
                  "type": "text",
                  "text": " and "
                },
                {
                  "type": "documentReference",
                  "attrs": {
                    "docId": "doc-related-example",
                    "title": "Related observations"
                  }
                },
                {
                  "type": "hard_break"
                },
                {
                  "type": "text",
                  "text": "Continue below."
                }
              ]
            },
            {
              "type": "canvas",
              "attrs": {
                "canvasId": "cv-example",
                "summary": {
                  "title": "Source map",
                  "elementCount": 2,
                  "refTitles": [
                    "Field audio"
                  ]
                }
              }
            },
            {
              "type": "youtubeSearch",
              "attrs": {
                "query": "synthetic source query"
              }
            },
            {
              "type": "youtubeReference",
              "attrs": {
                "src": "https://www.youtube.com/watch?v=abcDEF012_-",
                "title": "Example source",
                "channelTitle": "Example channel",
                "thumbnailUrl": "https://example.invalid/thumb.jpg",
                "videoId": "abcDEF012_-"
              }
            }
          ]
        }
      },
      "incomingMarkdown": "---\nfilesandnotes: {\"id\":\"doc-markdown-example\",\"title\":\"Truncated remote\"}\n---\n",
      "requiredOutcome": "No automatic blank replacement or queued empty push; keep good local/base/pending state, report ambiguous empty read.",
      "required": true
    },
    {
      "id": "MD-REBUILD-METADATA-SHAPE",
      "operation": "drive-decode-error",
      "markdown": "---\nfilesandnotes: []\n---\n\nText",
      "requiredOutcome": "Reject a non-record metadata shape rather than accepting a JSON array as note metadata.",
      "required": true
    }
  ]
}
