test(docx-core,docx-mcp): final regression suite for canonical emission (#143)#175
Merged
Merged
Conversation
…on (#143) Closes #143. **FINAL sub-PR for #120** — closes out the umbrella shift. Builds the comprehensive regression suite that locks in the canonical- emission contract introduced by #135-#142. Three test groups: **Group A — Per-primitive emission** (10 tests in docx-core): For every Table A primitive, invoke with ctx and assert the expected revision element is emitted with valid w:id/w:author/w:date attributes. Walks SUPPORT.md as the source of truth. Locks current behavior including the known rPrChange gap (#173) and addCommentReply Table B classification gap (#174). **Group B — Round-trip with comparison** (4 tests in docx-core): Apply primitive with ctx, run compareDocuments, assert AI revisions survive semantically through the comparison pipeline. The litmus test for the umbrella's correctness story. The replace_text round-trip test deliberately locks in TWO claims: - AI author identity IS preserved through compareDocuments - AI date timestamps are NOT preserved (regenerated by comparison) This is a known partial-correctness boundary that #126 (remove comparison from default save path) will close. The test asserts the current gap explicitly so future maintainers get an alert when comparison gains date-preservation — the failure message tells them to update the assertion to require preservation, marking #126 progress. **Group C — Tool integration through SessionManager** (10 tests in docx-mcp): For every Table A MCP tool, exercise via SessionManager + save + unzip. NOT full MCP-dispatch end-to-end (those would also exercise server.ts CallToolRequestSchema handler) — naming clarifies the scope. Asserts revision elements with w:author='SafeDocX' in the saved buffer. SUPPORT.md updates: - 'Verified by [120.8] (#143) regression test.' note appended to each of the 20 write-time emitter rows in Table A. - compare_documents and save (tracked branch) rows are intentionally NOT marked as verified (they're comparison-time, not write-time). - replaceParagraphTextRange row reflects the rPrChange follow-up #173. - addCommentReply row reflects the #174 Table B classification. Peer review: Gemini (LGTM) + Codex (4 findings, all addressed): 1. SUPPORT.md verification scope drift — confirmed only 20 of 22 Table A rows are verified; the 2 unverified are comparison-time legacy. 2. Group B too weak — strengthened to capture pre/post-compare revision tuples and lock in the date-regeneration gap explicitly. 3. Group C is tool-integration not MCP dispatch — describe block renamed for clarity. 4. rPrChange and addCommentReply gaps — filed as #173 and #174 with SUPPORT.md cross-references. Verification: npm run build -w @usejunior/docx-core # clean npm run lint:workspaces # clean npm run test:run -w @usejunior/docx-core Test Files 83 passed (83) Tests 1208 passed | 1 skipped (1209) npm run test:run -w @usejunior/docx-mcp Test Files 71 passed (71) Tests 720 passed (720) After this lands, #120 fully closes out and the umbrella checklist on #118 ticks #120. Total tests added across the entire #120 chain: 1102 → 1208 (docx-core, +106) and 688 → 720 (docx-mcp, +32) = +138 new tests covering the canonical-emission shift end-to-end. Follow-ups filed (out of scope for this PR): - #165 — accept_changes side-part extension - #171 — inferStartingRevisionIdState side-part scanning - #173 — replaceParagraphTextRange rPrChange emission - #174 — addCommentReply Table B reclassification No changes to baselines/.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Remove unused W import and ISO_Z_RE constant - Correct epic label from 'Document Editing' to 'Document Comparison' - Type-strengthen toPartMap so Record<K, string> destructuring is well-typed CI's tsc was stricter than local lint cache; these errors only surfaced on the clean CI build.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced May 8, 2026
This was referenced May 26, 2026
This was referenced May 27, 2026
Open
7 tasks
This was referenced Jun 4, 2026
Merged
Merged
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FINAL sub-PR for #120. Builds the comprehensive regression suite that locks in the canonical-emission contract introduced by #135–#142. After this lands, #120 fully closes out and the umbrella checklist on #118 ticks #120.
Three test groups across two packages:
docx-core/src/integration/canonical-emission-regression.test.tsdocx-mcp/src/integration/canonical-emission-mcp.test.tsTotal: 24 new tests locking in the surface.
The litmus test (Group B)
The
replace_textround-trip test deliberately locks in two claims:This is a known partial-correctness boundary that #126 (remove comparison from default save path) will close. The test asserts the current gap explicitly so future maintainers get an alert when comparison gains date-preservation:
SUPPORT.md updates
Verified by [120.8] (#143) regression test.note appended to each of the 20 write-time emitter rows in Table A.compare_documentsandsave (tracked branch)rows are intentionally NOT marked as verified — they're comparison-time, not write-time.replaceParagraphTextRangerow reflects the rPrChange follow-up replaceParagraphTextRange should emit w:rPrChange when run formatting changes #173.addCommentReplyrow reflects addCommentReply should emit body revision markup OR SUPPORT.md should be softened #174 Table B classification.Peer review
{kind, id, author, date, textContent}tuples; the strengthened test caught a real gap (date regeneration) which is now locked in as a known limitationVerification
Total impact across the #120 chain
Total chain: ~138 new tests covering the canonical-emission shift end-to-end.
Follow-ups filed (out of scope)
accept_changesside-part extensioninferStartingRevisionIdStateside-part scanningreplaceParagraphTextRangew:rPrChangeemissionaddCommentReplyTable B reclassificationCloses