Repository navigation
Description
Version: docx-cli 0.28.0, release binary (Windows x64), Windows 11, Word 16 (365).
What happens
comments add writes the comment into word/comments.xml and the
commentRangeStart / commentRangeEnd / commentReference into word/document.xml, but does not
add the matching w16cid:commentId to word/commentsIds.xml, nor a w15:commentEx to
word/commentsExtended.xml. On a Word-saved input — i.e. any real document — the package is left
inconsistent from the first added comment onwards, and Word shows "This file contains unreadable
content. Recover?" on open.
Repro
Attached: fixture-comments-base.docx (7.6 KB). It is a clean package with 2 comments and all
three parts populated 2 / 2 / 2; the side-parts carry Word's shape (w16cid:commentId with
paraId+durableId, w15:commentEx with paraId+done, both keyed to the comment paragraph's
w14:paraId), and docx validate reports valid — 6 parts checked.
$ docx comments add fixture-comments-base.docx --anchor "dritte Absatz" --text "Dritter Kommentar." --author "Test Reviewer"
c2| part | before | after one comments add |
|---|---|---|
word/comments.xml |
2 | 3 |
word/commentsIds.xml |
2 | 2 |
word/commentsExtended.xml |
2 | 2 |
docx validate still reports valid — 6 parts checked afterwards.
Evidence from the document that hit it
18.5 MB report, 63 pages, 2'366 paragraphs, 25 comments, saved by Word before the session. After the
session the parts stood at 25 / 3 / 4 — the 3 and 4 are the comments the file already had and its two
reply threads. Word offered recovery and rebuilt both side-parts:
| part | as written by docx-cli | after Word's repair |
|---|---|---|
word/comments.xml |
25 | 25 |
word/commentsIds.xml |
3 | 25 |
word/commentsExtended.xml |
4 | 25 |
document.xml commentRangeStart / End / Reference |
25 / 25 / 25 | 25 / 25 / 25 |
Comment texts and anchors survive the repair unchanged, but comment ids are renumbered (measured:
c23 → c105, c28 → c49, c40 → c598), so any external reference to a comment handle is
invalidated by it. That is what makes this more than cosmetic: the reviewer is handed a repaired copy
of the file they were asked to redline, with every handle shifted.
Expected
One commentId and one commentEx per comment, keyed by the comment's paragraph w14:paraId,
written on comments add and removed on comments delete — the shape Word itself writes.
Where it likely lives
src/cli/comments/add.tsx contains no reference to commentsIds, commentsExtended or paraId.
A reply does produce an entry (measured: 4 comments, one a reply → 2 commentEx entries), so the
write path exists in the reply flow — likely through the CommentsView that CLAUDE.md describes as
owning the part. This looks like one omitted registration plus a missing rebuild path; I did not read
the save path far enough to name the call site.
Suggested regression test
tests/cli/comments.test.ts: on a fixture whose side-parts already list its comments, after two
comments add the entry count in commentsIds.xml and commentsExtended.xml equals the comment
count. The attached file is exactly that fixture, so it can become tests/fixtures/comments-base.docx
as-is.
Notes
docx createnever writescommentsIds.xml, andcommentsExtended.xmlonly appears once a
reply is added (measured: 4 comments → 2 entries). A purely docx-cli-produced file is therefore
consistent (parts absent, not stale). The breakage is specific to Word-authored input.- If an input's side-parts are already partial, rebuild them from
comments.xmlrather than append.
docx comments rebuild-parts FILEwould also let files written by 0.28.0 be repaired without
opening Word. - Related, but a different mechanism: Threaded replies are added but not rendered #1, fix: anchor comment replies and cascade delete through thread descendants #2, fix: anchor comment replies in the body, mint valid paraIds, cascade thread delete #3 (threading, paraId minting).
validatenot seeing
this is filed separately.
Activity
kklimuk commentedon Nov 6, 2026
Shipped in v0.29.0 (#35 plus follow-ups on main).
What changed
commentsExtended.xml/commentsIds.xml/commentsExtensible.xmlagainstcomments.xml:w14:paraIds, which docx-cli < 0.14.1 wrote, together with their entries.docx validate FILE --fixdoes the same explicitly.What live Word showed (Word for Mac 16.114.4, tested on 2026-11-05)
The exact state in this report (a comment missing from both commentsIds and commentsExtended) opened without a repair prompt, with alerts on and with alerts off. Word added the missing entries itself on save. It's still a real problem, because Word loses data on that save:
commentExentry becomes a top-level comment;In our tests the only comment state that stopped Word from opening the file was a
commentReferencepointing at a comment that doesn't exist.validatereports that as an error, and--fixremoves it.If your Word build does show the repair prompt for the file you attached, please reopen with the Word version. We couldn't download the attachment, so we built our own repro.
kklimuk commentedon Nov 6, 2026
@michaelgasser thanks for the report!