stripHtmlEmbedNodes only filtered children, so a (never-in-practice) bare htmlEmbed root node would be returned as-is. Add a defensive root check that returns an embed-free doc, making the helper total — it can never return a node for which hasHtmlEmbedNode is true. Adds a unit test for the root case. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>