add --type comment doesn't sync commentsExtended.xml/commentsIds.xml/commentsExtensible.xml unless done/parentId is passed
What happens
Adding a comment to a docx that already has real threaded comments (and therefore already has commentsExtended.xml, commentsIds.xml, and commentsExtensible.xml alongside comments.xml) only writes the new comment into comments.xml. The other three parts are left untouched unless done or parentId is passed explicitly on add — and even then, only commentsExtended.xml gets an entry. commentsIds.xml and commentsExtensible.xml have no equivalent prop at all and are never written to, regardless of what's passed.
This leaves the four comment-related parts cross-referentially inconsistent (each individually schema-valid, so officecli validate doesn't catch it), and Word flags the file as needing repair when a human opens it ("Word found unreadable content, do you want to recover this document?").
Repro
officecli create test.docx, add a paragraph, add a comment, thenofficecli setdone=trueon it — this createscommentsExtended.xmlwith one entry (confirming the part only appears once something explicitly writes to it).- Add a second comment with
officecli add --type comment --prop text=... --prop author=..., with or without--prop done=false. - Inspect the docx zip:
comments.xmlhas both comments.commentsExtended.xmlonly has the first (or, withdone=falseon the secondadd, both — butcommentsIds.xml/commentsExtensible.xmlnever get an entry for either comment, ever).
Expected
add --type comment keeps all four comment parts consistent, matching what Word itself writes when a human adds a comment.
Environment
officecli 1.0.146, Windows.
Additional context
Compared this against Word's own repair-on-open behavior for a file left in this inconsistent state. Word's repair does correctly reconcile commentsExtended.xml and commentsIds.xml (adds the missing comment's entry to both), but drops commentsExtensible.xml entirely rather than reconciling it — so even Word's own recovery path doesn't fully restore that fourth part.
Source: iOfficeAI/OfficeCLI