Skip to content

feat(office): close DOCX round-trip residuals and document Phase 2 closure - #5

Merged
digiogithub merged 1 commit into
mainfrom
copilot/cierre-residuo-round-trip
Aug 2, 2026
Merged

feat(office): close DOCX round-trip residuals and document Phase 2 closure#5
digiogithub merged 1 commit into
mainfrom
copilot/cierre-residuo-round-trip

Conversation

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Closes leftover Phase 2 DOCX round-trip gaps: complete the writer fidelity path, fix DocMark parse/emit residuals that broke corpus identity, and record the closure under kb/.

DOCX writer

  • Floating images as DrawingML wp:anchor (no inline downgrade)
  • Full footnote body write (runs/formatting, not plain text)
  • Image transforms: rotation, flip, crop, border, hyperlink
  • Emit w:start only when set in IR
  • Covered/dropped table cells written correctly

DocMark parser / writer

  • Update ::: fence depth before blank-line chunk splits
  • Nested lists parse at depth+1 so ilvl survives round-trip
  • Empty GFM colspan/rowspan pads → Dropped/Covered cells
  • Covered cells emitted in GFM tables

Tests

  • Full corpus/docx Office→DocMark→Office→DocMark identity
  • serialize(parse) identity on goldens in convert (assets seeded from companion .docx; keeps crate dep rules)

Docs

  • kb/06-phase-2-roundtrip-closure.md
  • Plan / kb index / next-phases / AGENTS.md status updates

Still open (non-blocking)

  • Broader proptest IR→md→IR
  • Manual Word/LibreOffice open checklist
  • First-class text-box write

Copilot AI changed the title feat(office): close DOCX writer round-trip residuals and document in kb feat(office): close DOCX round-trip residuals and document Phase 2 closure Aug 2, 2026
Copilot AI requested a review from digiogithub August 2, 2026 12:10
@digiogithub
digiogithub marked this pull request as ready for review August 2, 2026 12:25
@digiogithub
digiogithub requested a review from Copilot August 2, 2026 12:28
@digiogithub
digiogithub merged commit 4afef44 into main Aug 2, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR closes remaining Phase 2 DOCX round-trip fidelity gaps (writer + DocMark parse/emit edge cases), adds corpus-wide idempotence tests, and updates the knowledge base / plan to document Phase 2 core-path closure.

Changes:

  • Improve DOCX writer fidelity (floating wp:anchor, image transforms + hyperlinks, full footnote body rendering, omit w:start unless set, covered table cells as w:vMerge continuations).
  • Fix DocMark parsing/serialization residuals impacting identity (fence chunking order, nested list depth handling, GFM table span normalization, covered-cell emission).
  • Add/expand tests to enforce DOCX corpus Office→DocMark→Office→DocMark idempotence and serialize(parse(md)) == md over DOCX goldens; update kb/ and plan status to reflect closure.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
kb/README.md Links the new Phase 2 closure note and updates the “status in one line” summary.
kb/06-phase-2-roundtrip-closure.md New KB entry documenting residual Phase 2 issues, what landed, and remaining non-blockers.
kb/04-next-phases.md Updates Phase 2 section from “implemented” to “closed” and summarizes delivered vs still-open items.
kb/01-phases-0-1-summary.md Clarifies that reverse conversion + spreadsheets were later phases and are now closed.
docs/development-plan.md Marks Phase 2 core-path status as closed and updates tasks/acceptance criteria accordingly.
crates/docsai-office/src/docx/write.rs Implements floating anchors, transforms, hyperlink support, full footnote body writing, covered-cell vMerge behavior, and adds a regression test.
crates/docsai-docmark/src/writer.rs Emits covered table cells as empty placeholders to keep GFM grids rectangular.
crates/docsai-docmark/src/parser.rs Fixes list-depth parsing, fence chunk splitting order, and normalizes GFM span placeholders into IR covered/spans.
crates/docsai-convert/tests/goldens.rs Adds corpus-wide DOCX idempotence and DOCX golden serialize(parse) identity tests (with asset seeding from companion .docx).
AGENTS.md Updates current-status text to reflect newly-closed DOCX round-trip fidelity items.
Suppressed comments (2)

crates/docsai-office/src/docx/write.rs:1712

  • The test’s assertion still looks for the Spanish substring "negrita". If the fixture text is updated to English, this should be updated too to keep the test consistent with the English-only guideline (AGENTS.md §5).
                                            if t.contains("negrita") {
                                                *bold_note = true;

crates/docsai-office/src/docx/write.rs:1661

  • AGENTS.md (§5, lines ~102–105) requires English-only code/comments; this newly added literal is Spanish ("cuerpo"). Please change it to English to avoid introducing more non-English content.
                        Inline::Image(image),
                        Inline::Text(" cuerpo".into()),
                        Inline::Footnote(footnote_body),

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1640 to +1642
Inline::Text("Nota con ".into()),
Inline::Styled {
content: vec![Inline::Text("negrita".into())],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants