Repository navigation
Conversation
Two changes to fix document corruption when adding tracked changes: 1. SKILL.md: Replace hardcoded low IDs (1, 2) in tracked change examples with high-offset IDs (100, 101) and add explicit guidance to scan for max existing w:id before assigning new ones. Add nesting-level warning. 2. base.py validator: Add tracked change elements (ins, del, rPrChange, pPrChange, etc.) to UNIQUE_ID_REQUIREMENTS and introduce a shared ID space check so cross-type duplicates (e.g. bookmarkStart id="1" vs ins id="1") are detected. Previously only same-type duplicates were caught. Closes anthropics#489
0f5749e to
a4fd9cf
Compare
|
Friendly ping: this PR has been ready for review since March 6, 2026. If there is anything blocking it or if you would prefer changes before merge, let me know and I can update it. Would appreciate a review when someone has time. |
|
Following up on this PR. The fix should be ready for review; please let me know if you'd like any updates or additional test coverage from my side. |
|
Following up on this PR. The fix should be ready for review from my side; if you would prefer any updates or additional coverage before merge, let me know and I can handle it. Would appreciate review when someone has time. |
|
Following up on this PR. The docx fix should be ready for review from my side; if you would like any adjustments or extra coverage around tracked changes and bookmark interactions, I can update it. Would appreciate a review when someone has time. |
Summary
Fixes document corruption when the DOCX skill adds tracked changes to documents with existing bookmarks.
Root cause: In OOXML,
w:idis a shared ID space across bookmarks, tracked changes, comments, and move ranges. The SKILL.md examples used hardcoded low IDs (1, 2, 3) which commonly collide with existing bookmark IDs, causing Word to reject the file as corrupt.Changes
1.
skills/docx/SKILL.mdw:idvalues in tracked change examples with high-offset IDs (100, 101, etc.)w:idacross ALL element types before assigning new IDsw:ins/w:delmust be atw:plevel, never insidew:rorw:t2.
skills/docx/scripts/office/validators/base.pyUNIQUE_ID_REQUIREMENTS:ins,del,rPrChange,pPrChange,sectPrChange,tblPrChange,tcPrChange,trPrChange,cellIns,cellDel,cellMerge,numberingChangeSHARED_ID_SPACE_ELEMENTSset defining elements that share thew:idspacevalidate_unique_ids()to check cross-type ID uniqueness for shared-space elements (e.g., detectbookmarkStart id="1"conflicting withins id="1")Closes #489
Test plan
base.pycompiles without syntax errors🤖 Generated with Claude Code