Evals & Deep Dives
Safe-DOCX: MCP for Microsoft Word (DOCX)
Evaluation scenarios from implementing TypeScript-native DOCX editing primitives — illustrated with fixtures, expected results, and tests drawn from the package's own traceability suite.
The 34 pages below are curated exemplars, not the full suite — hand-picked to show how each primitive behaves. The complete run lives in the Allure report.
How to read this evidence
From a claim to a line of code
- 990+ automated tests run on every change to the safe-docx engine.
- 100% OpenSpec traceability means each behavior maps to a named spec scenario.
- The Allure report is the full, machine-generated run of all of them.
- The curated scenario pages below walk representative cases with real fixtures and expected output, each footnoted to its test, implementation, and ECMA-376 reference.
- The cross-implementation matrix runs the spec-anchored subset of these scenarios against other OOXML libraries, wpt.fyi-style.
- Known limitations states plainly where the edges still are.
Accept Tracked Changes
-
Deletion acceptance by removing w:del elements
When accepting tracked deletions in a WordprocessingML document, deletion wrappers and their deleted content are removed while kept content remains.
-
Insertion acceptance by unwrapping w:ins wrappers
To accept inserted content in a WordprocessingML paragraph, acceptChanges removes the w:ins wrapper while preserving the inserted run content.
-
Accept moves by keeping destination and removing source
A test scenario for acceptChanges — a paired OOXML move keeps the destination text and removes the source text.
-
Property change acceptance by removal of change records
When accepting tracked formatting changes in a WordprocessingML document, property-change records are removed while the stable document text remains present.
-
Bottom-up resolution of nested revisions
When accepting tracked revisions in OOXML, bottom-up processing removes nested deleted content before insertion wrappers promote the remaining run elements.
-
When accepting tracked move revisions, orphaned move sources are removed while unaffected paragraph content remains.
Comments
-
Threaded replies from addCommentReply
When reading threaded comments from a Word document, root comments need to stay separate from replies so the thread tree stays nested.
-
Comment readback after addComment
When reviewing comments that were just added to a Word document, the comment reader must return the saved metadata and comment text from the document package.
-
Single-paragraph comment range metadata
When reviewing comments anchored to a paragraph range, editors need the comment body and the range metadata to describe the same marked span.
Compare Documents
-
Session redline comparison against original
When reviewing edits from an active document session, a redline file records differences from the original baseline.
-
Two-file DOCX redline comparison
When comparing a revised DOCX against an original DOCX, a redline document records tracked changes while leaving the source files as inputs.
Detect Tracked Changes
-
Insertion and deletion revision wrapper detection
When reviewing OOXML for tracked edits, insertion and deletion revision wrappers must be counted as document-body content markers.
-
Property-only tracked change detection
When reviewing a DOCX document for tracked formatting changes, property revision markers must be counted even when no inserted or deleted content appears.
Extract Revisions
-
Comment association for changed paragraphs
When reviewing tracked insertions with paragraph comments, the change report keeps the reviewer note attached to the paragraph it annotates.
-
Tracked deletion before and after text
When reviewing tracked deletions in a Word document, deleted substrings must appear in the before state and be absent from the after state.
-
Format change extraction from rPrChange
When reviewing tracked formatting in OOXML, run property changes need to be reported as format-change revisions rather than ignored.
-
Insertion revision with before and after text
When reviewing tracked insertions in a paragraph, before and after text shows how the paragraph reads before and after the change is applied.
Layout
-
Table cell padding container creation
When applying padding to selected Word table cells, the document mutation must create the required cell-property containers without adding margin containers to untargeted cells.
-
Missing index reporting for table row height
When applying row-height rules to selected Word tables, invalid table or row references are reported as skipped selections.
Move Detection
-
When reviewing tracked edits in a Word document, moved content needs linked source and destination markings so the relocation is not treated as unrelated deletion and insertion.
-
Similarity threshold for move detection
When detecting moved document content, similarity thresholds prevent unrelated deleted and inserted atoms from being marked as the same move.
Parsing Heuristics
-
Multi-character Roman numeral list labels
When classifying text-formatted list labels in legal documents, multi-character Roman numerals need a distinct list-label type.
-
Parenthesized letter label extraction
When parsing agreement paragraphs that use typed list labels, the leading marker must be separated from the paragraph content before classification can proceed.
-
Null label for plain paragraph text
Plain paragraph list-label parsing records that ordinary paragraph text has no explicit list label.
-
List label removal with leading whitespace
When preparing legal-document list text for comparison, a leading list label can be stripped while preserving the item wording that follows.
Reject Tracked Changes
-
When rejecting tracked insertions, inserted OOXML content is removed so the document keeps only the original paragraph text.
-
Restored deleted text after rejecting tracked changes
When reversing tracked deletions in WordprocessingML, deleted text returns as ordinary paragraph text and deletion text elements are removed.
-
Original Run Properties Restored From rPrChange
When rejecting tracked formatting changes, original run properties from an rPrChange record replace the current run properties.
-
Tracked move rejection at original position
When rejecting tracked moves in a DOCX document, the original position retains moved content while the destination position is removed.
Text Matching
-
Exact match for a literal substring
A test scenario for the baseline successful case of findUniqueSubstringMatch — a search string that appears once, verbatim, inside a paragraph's plain text.
-
Flexible whitespace match across spacing variance
When locating a defined phrase in document text, flexible whitespace matching preserves a unique substring match even when spacing differs between the source text and the search phrase.
-
Quote-normalized match across quote styles
When locating a defined term in paragraph text, quote normalization allows different quote styles to describe the same substring.
XML Parsing
-
Element structure preservation through XML round-trip
When round-tripping XML content, serialized output needs to preserve the element names, attributes, and text that carry document meaning.
-
Concatenated Text Content For Nested XML Elements
When reading visible XML text from a parsed document element, concatenated text content preserves descendant text in document order.