Skip to content

fix(docx-compare): emit schema-valid paragraph move markup #941

Description

@stevenobiajulu

Problem

The tagged comparison engine emits paragraph move markup that fails the repo's
vendored ECMA-376 Transitional WML schema gate. This is observable in a real
compareDocuments result, not only the lower-level tagged publication helper.

For a two-paragraph reorder with detectMoves: true, the output includes:

<w:moveFromRangeStart w:id="1" w:name="taggedMove1"/>
<w:moveFrom w:id="1" w:author="Range Statistics" w:date="2026-08-23T12:00:00Z">
  <w:p>...</w:p>
</w:moveFrom>
<w:moveFromRangeEnd w:id="1" w:name="taggedMove1"/>

with an analogous moveTo sequence.

scripts/check_emitted_document_schema.mjs reports:

  • moveFromRangeStart / moveToRangeStart are missing required w:author and
    w:date attributes;
  • moveFromRangeEnd / moveToRangeEnd carry disallowed w:name attributes;
  • block-level w:p is emitted inside w:moveFrom / w:moveTo, where the
    vendored schema rejects it.

This shape is not listed in coverage/emitted-schema-known-failures.json.

Acceptance criteria

  • Emit paragraph moves using an ECMA-376-conformant structure accepted by the
    repo's vendored Transitional WML schemas.
  • Add the appropriate @conformance ECMA-376 edition 5, Part 1 § ... citation
    to the implementation and Allure conformance metadata to the tests after the
    exact governing section is verified.
  • Preserve a balanced, ID-consistent move source/destination pair.
  • Preserve Accept All and Reject All projections and Word/LibreOffice opening
    behavior.
  • Add an end-to-end generated-DOCX schema fixture; do not merely allow-list the
    current invalid output.
  • Confirm the fixed markup in Microsoft Word and at least one independent
    consumer oracle.

Premise independently reproduced at 065eef59 on 2026-08-23 with a synthetic
public DOCX and:

node /tmp/revscratch/e2e.mjs
node scripts/check_emitted_document_schema.mjs /tmp/revscratch/e2e

The schema command failed with the errors listed above. No duplicate issue was
found by searching for moveFromRangeStart author date schema or move-schema
terms.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions