Commit 2b70119
authored
* feat(comments): Threaded Comments & Review — issue #25 epic
Implements all 8 sub-features additively, built from the OOXML spec
(no upstream prior art):
- SF1 CommentAuthors (legacy integer-id) + modern GUID-keyed authors
- SF2 legacy <p:cm> + modern <p188:cm> oxml/part classes (2018/8/main)
- SF3 Slide.comments add/remove/iter (lazy modern part create+relate)
- SF4 Comment.replies threaded chains
- SF5 author/text/created_at(tz-aware)/anchor_position accessors
- SF6 Comment.resolve()/resolved (modern; legacy raises, documented)
- SF7 Shape.comments per-shape anchored filter
- SF8 legacy<->modern coexistence on round-trip (both enumerable)
DEFECT caught by Interceptor visual verification (trinity was green):
modern <p188:cm> referenced GUID authorIds while only a legacy
integer-id commentAuthors.xml existed -> dangling refs -> PowerPoint
repair dialog. Fixed: modern /ppt/authors.xml
(application/vnd.ms-powerpoint.authors+xml, GUID-keyed <p188:author>,
presentation->authors threadedCommentAuthors rel). providerId made
RequiredAttribute so it always serializes (PowerPoint always writes it).
Tests: +97 pytest (tests/test_issue25_comments.py, 43 issue-25),
+14 behave. Trinity: pytest 3751, ruff clean, behave 1062, 0 failed.
uat_issue25.py 17/17 (script-QA). Post-fix PowerPoint Review-pane
visual deferred to maintainer UAT per repo §6a (env wall on re-open;
residual risk disclosed — structural reasoning produced one false-green
on this part). No push/PR pre-signoff.
Refs #25 Closes scanny#487 scanny#538 scanny#756
* fix(comments): move shape-anchor out of p188:cm into extLst (Cato audit)
Cato cross-vendor audit flagged `anchorShapeId` as an out-of-schema
attribute on <p188:cm> (2018/8/main defines only id/authorId/created/
status) — a plausible second PowerPoint repair-dialog trigger that the
deferred post-fix visual would have hidden.
Anchor now stored in <p188:extLst>/<p188:ext uri="{fork URI}"> — the
OOXML-sanctioned extension mechanism conformant consumers MUST ignore
on unknown URI. SF7 per-shape filter + round-trip preserved
(anchored comment round-trips True). <p188:cm> now carries only
schema attributes.
Trinity green: pytest 3751, ruff clean, behave 1062, 0 failed.
Refs #25
* Updated uat instructions to use uat folder
* Remove uat files.
* fix(comments): emit required <a:bodyPr> in <p188:txBody> (maintainer UAT)
Maintainer opened uat_issue25_comments.pptx in PowerPoint: file opened
clean (no repair) but ZERO comments displayed. Root cause: the add
path builds the body via get_or_add_txBody() (a bare <p188:txBody/>)
then sets text via _set_txBody_text, which only PRESERVED a pre-existing
<a:bodyPr> and never created one. <p188:txBody> is a DrawingML
a:CT_TextBody whose schema REQUIRES <a:bodyPr> as first child;
PowerPoint silently drops comments with a bodyPr-less txBody — no
repair dialog, the comment is just absent. The entire green trinity +
17/17 UAT could not see this; only maintainer visual review did.
Fix: _set_txBody_text now GUARANTEES a leading <a:bodyPr/> (inserts it
when absent) for both comments and replies. Added
DescribeThreadedCommentBodyPrRegression (2 tests) asserting every
txBody carries <a:bodyPr> before <a:p>, so the silent-drop class is
now test-caught. uat_issue25.py OUT path moved under ./uat/ per
CLAUDE.md §6a update.
Trinity: pytest 3753, ruff clean, behave 1062, 0 failed.
Refs #25
* fix(comments): use PowerPoint's real modern-comment contract — parent threads now render (issue #25)
Threaded comments were invisible in PowerPoint's Comments pane despite a
green trinity and clean script UAT. Root-caused by diffing our OOXML
against a threaded comment PowerPoint for Mac itself authored+saved
(ground truth, captured this session) — three string axes and one
element were inferred wrong in Waves 1-2:
- comment-part content type: was application/vnd.ms-powerpoint.threadedComments+xml
-> application/vnd.ms-powerpoint.comments+xml
- slide -> comment-part reltype: was .../2018/10/relationships/threadedComment
-> .../2018/10/relationships/comments
- presentation -> authors reltype: was .../2018/10/relationships/threadedCommentAuthors
-> .../2018/10/relationships/authors
- every <p188:cm> now emits its required first child
<pc:sldMkLst><pc:docMk/><pc:sldMk cId="0" sldId="{p:sldId}"/></pc:sldMkLst>
(ns .../2013/main/command) — the slide binding PowerPoint needs;
omitting it (or the fork-private extLst anchor) leaves the comment
unbound.
PowerPoint resolves the comment part by the slide relationship type; an
unrecognized reltype meant the part was never loaded -> empty pane.
Files: opc/constants.py (3 values; symbols unchanged so the PartFactory
registry + producer move in lockstep — Cato-audited), oxml/ns.py (+pc),
oxml/comments.py (sldMkLst ZeroOrOne + set_slide_marker), comments.py
(Comments.add binds the slide). 6 regression assertions in
DescribeThreadedCommentPowerPointContract lock all four axes
(red->green proven by stashing src) plus set_slide_marker idempotency.
Verification: pytest 3759 passed; ruff check + format clean; behave
1062 scenarios / 3215 steps 0 failed. Regenerated UAT deck opened in
real PowerPoint via Interceptor — Comments pane renders 3 threads,
correct author/text, resolved status persisted (uat/FIXED_comments_rendering.png
vs uat/REPRO_no_comments_pane.png). Cato cross-vendor audit: pass.
KNOWN-INCOMPLETE: PowerPoint still drops every <p188:reply> (replies do
not render; only parent comments do). This is a logically independent
reply-level contract defect, deliberately NOT inference-fixed — it needs
its own PowerPoint-authored <p188:reply> ground-truth diff. Tracked as a
scoped follow-up in the session ISA.
UAT script runs clean — pending maintainer visual signoff in
PowerPoint/Keynote. No push/PR per repo §6a. Refs #25.
* fix(comments): order replyLst before txBody per [MS-PPTX] CT_Comment — replies now render (issue #25)
Follow-up to ca4da3f. After the four parent-binding fixes, PowerPoint
rendered parent comment threads but SILENTLY DROPPED every reply
(`interceptor macos find "Merging"` → 0; only empty Reply boxes). The
advisor (Rule 2) correctly flagged reply-rendering as a logically
independent concern none of the four parent fixes touched.
Root cause is authoritative, not inference: the [MS-PPTX] CT_Comment
schema (learn.microsoft.com/openspecs MS-PPTX, 2018/8/main) defines
<xsd:complexType name="CT_Comment"><xsd:sequence>
<xsd:group ref="EG_CommentAnchor"/> <!-- pc:sldMkLst -->
<xsd:element name="pos" minOccurs="0"/>
<xsd:element name="replyLst" type="CT_CommentReplyList" minOccurs="0"/>
<xsd:group ref="EG_CommentProperties"/> <!-- txBody, extLst -->
</xsd:sequence></xsd:complexType>
replyLst MUST precede txBody. Our CT_ThreadedComment ZeroOrOne
successors emitted txBody first, replyLst after — out of sequence, so
PowerPoint validated the parent and discarded the misplaced replyLst.
The reply element itself (CT_CommentReply = EG_CommentProperties only)
was already correct; this was purely a child-ordering defect.
Fix: reorder the successor tuples in src/pptx/oxml/comments.py so the
emitted order is pc:sldMkLst, [pos], p188:replyLst, p188:txBody,
[p188:extLst] — matching the schema sequence exactly. No API change.
Two new regression assertions lock it
(it_places_replyLst_before_txBody_per_ms_pptx_sequence,
it_keeps_reply_txBody_with_bodyPr_after_reorder); red->green proven by
stashing oxml/comments.py (the order test fails pre-fix).
Verification: pytest 3761 passed; ruff check All checks passed; ruff
format clean; behave 1062 scenarios / 3215 steps 0 failed. Regenerated
UAT deck: replyLst-before-txBody True, reply texts present. Opened in
real PowerPoint via Interceptor — AX tree now exposes the reply node
"Comment from Alex Reviewer. Merging now." plus a "View 1 more reply"
control (PowerPoint parsed the full reply list); pre-fix that count was
zero. uat/FIXED_replies_rendering.png.
Issue #25 now fully resolves: parent comments AND replies render in
PowerPoint's Comments pane. UAT script runs clean — pending maintainer
visual signoff in PowerPoint/Keynote. No push/PR per repo §6a. Refs #25.
1 parent fed7e45 commit 2b70119
16 files changed
Lines changed: 2568 additions & 155 deletions
File tree
- features
- steps
- src/pptx
- opc
- oxml
- parts
- shapes
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
13 | 19 | | |
14 | 20 | | |
15 | 21 | | |
| |||
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
44 | 54 | | |
45 | 55 | | |
46 | 56 | | |
| |||
80 | 90 | | |
81 | 91 | | |
82 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
83 | 97 | | |
84 | 98 | | |
85 | 99 | | |
| |||
0 commit comments