Repository navigation
Detect orphaned docx comments - #1734
rohitjain25 wants to merge 7 commits into
Conversation
|
Closes #1733. This adds validation for comments.xml entries that have no corresponding comment marker in document.xml. |
|
Thanks for reviewing this contribution. The validator now reports comment IDs present in comments.xml but missing from document.xml markers, while preserving existing marker/reference checks. I also verified the orphaned-comment case with a focused runtime test. |
|
Thanks for this — it closes a real gap (comments present in comments.xml with no anchor in document.xml currently pass silently). One correctness concern: Verified with lxml (two-state check):
Suggested fix: use |
|
@98zc5g5jyw-arch On the threaded-reply concern above: I don't think replies are nested I checked it against a Word-authored file rather than leaving it at the schema — Word 16.0, one comment plus one Reply on the same phrase: Both comments are flat siblings, both carry all three markers, and the thread relationship exists only as Two smaller notes:
The three copies of this validator (docx, pptx and xlsx skill trees) are byte-identical here and this PR patches all three, so that part is already covered. For what it's worth, the checker I used to find the original issue does the same reverse check with direct children only and produced no false positives across 220 labelled producer pairs from five producers — though that corpus contains no threaded comments, which is why I made the file above. |
|
Fixture-tested this against the #1733 files and a few synthetic cases (head The orphan check is correct. Main still silent-passes the same file. The nested-reply false positive is real — but only on schema-invalid XML. Nested
Nested I’d still switch all three copies to Residual, out of scope: markers are collected only from |
|
Confirmed the residual you flagged, and it applies to my checker too — worth stating since I cited its false-positive record above. Built a document where the only anchor for comment id=1 lives in word/header1.xml (range start, range end and the reference run all inside the header paragraph), with nothing left in document.xml: Same cause: marker collection reads document.xml only. Word's UI doesn't offer comments in headers, but the schema permits the range markup there and programmatic producers can write it, which is exactly the population these checks exist for. Fixing it on my side and adding a labelled pair for it. So for this PR I'd agree with your scoping: |
|
Follow-up on the header-only residual: fixed on my side, with the labelled pair. ooxml-integrity now reads comment ranges and references in every story the main document relates (headers, footers, footnotes, endnotes), not only in The labelled pairs: comment 1 anchored only in the default header, and only in footnote 1, each with an untouched control and a copy that loses the anchors. The previous checker reported CMT005 on both controls; the fixed one reports nothing there and still reports CMT005 on both damaged copies. The files are synthetic, and I haven't checked how Word displays them. The fix is on main, not yet in a PyPI release. Nothing changes for this PR: |
No description provided.