Cross-platform golden comparison fails on equivalent w16du namespace placement
While preparing the corpus contribution requested in issue #137, two real Word Online edit pairs expose a Python/TypeScript serialization difference. Both engines generate the intended tracked replacement, but the TypeScript consistency tests fail against the Python-generated golden_abstract.xml.
Reproduced on Adeu 3.0.3, commit d825fd0 (macOS, Python 3.12.14, Node 24.19.0). No Adeu source files were changed.
Inputs and operation
The inputs are unchanged, already-sanitized synthetic documents from ooxml-integrity at e07ee5cdb1993786aff293e7799e62d32c2f04bd:
| Scenario | Corpus input | Input SHA-256 |
|---|---|---|
06_word_online_contract_edit |
roundtrips/online-contract-01.docx |
05babc00844596b4614f5ed00de672e086260e78d3b0fcf8c0baaca9a6e2fb8f |
07_word_online_table_edit |
roundtrips/online-table-01.docx |
bbf0fb5a84dae1491a9a202198013e1e1d3481c0519e158ef4516e59ce71b09f |
The corresponding after files are sources/online-contract-01.docx and sources/online-table-01.docx. They were downloaded after an observed Word for the web editing session on 2026-09-06; the web service build was not exposed. The before documents were generated with python-docx 1.2.0. Their default app.xml application string should not be mistaken for an observed Word for Mac save.
For both pairs, uv run adeu diff <before> <after> --json correctly returns:
[{"type":"modify","target_text":"WEBINPUT","new_text":"WEBSAVED"}]
This is a targeted replacement, not a whole-document diff failure.
Contribution scope
The two fixture folders reproducing this issue are already prepared. They will be contributed in a second PR once the comparison is settled. They are deliberately not part of the separate PR containing three passing comment-projection fixtures for LibreOffice and Word.
Self-contained reproduction
Use Python >=3.12, uv, Node 24 and npm. Start in a disposable checkout, because the goldens script also regenerates existing scenarios:
git clone --branch v3.0.3 https://github.com/dealfluence/adeu.git adeu-namespace-repro
cd adeu-namespace-repro
cd python
uv sync --all-extras --dev
cd ..
From that repository root, run this script with python3 (or uv run --project python python). It uses only the Python standard library, downloads the four exact corpus files, verifies all SHA-256 values, generates the actual diff arrays, and includes only the before documents in the two folders. It does not depend on an unpublished branch or PR.
"""Run from a disposable Adeu checkout; fetch and verify the pinned public inputs."""
import hashlib
import json
from pathlib import Path
import subprocess
import tempfile
import urllib.request
ROOT = Path.cwd()
assert (ROOT / 'python/scripts/generate_goldens.py').is_file(), 'Run from the Adeu repository root'
COMMIT = 'e07ee5cdb1993786aff293e7799e62d32c2f04bd'
URL = f'https://raw.githubusercontent.com/Dmitry-Kov/ooxml-integrity/{COMMIT}/evidence/docx-beta/'
CASES = [
('06_word_online_contract_edit', 'online-contract-01',
'05babc00844596b4614f5ed00de672e086260e78d3b0fcf8c0baaca9a6e2fb8f',
'f4f3860271936360a9074d945bed25daf6523a28c2bd1ba8610ad8e7968bf323'),
('07_word_online_table_edit', 'online-table-01',
'bbf0fb5a84dae1491a9a202198013e1e1d3481c0519e158ef4516e59ce71b09f',
'b70595169e7ec4d093d91e05aa228877912c216de80b2a7b2715cfc8b8db5d1e'),
]
for folder, *_ in CASES:
assert not (ROOT / 'shared/cross_platform_tests' / folder).exists(), f'{folder} already exists'
with tempfile.TemporaryDirectory() as tmp:
for folder, source, before_hash, after_hash in CASES:
paths = []
for role, subdir, digest in [('before', 'roundtrips', before_hash), ('after', 'sources', after_hash)]:
with urllib.request.urlopen(URL + f'{subdir}/{source}.docx') as response:
data = response.read()
assert hashlib.sha256(data).hexdigest() == digest, (source, role, 'hash mismatch')
path = Path(tmp) / f'{source}-{role}.docx'
path.write_bytes(data)
paths.append(path)
run = subprocess.run(['uv', 'run', 'adeu', 'diff', str(paths[0]), str(paths[1]), '--json'],
cwd=ROOT / 'python', check=True, capture_output=True, text=True, encoding='utf-8')
changes = json.loads(run.stdout)
assert changes == [{'type': 'modify', 'target_text': 'WEBINPUT', 'new_text': 'WEBSAVED'}]
dest = ROOT / 'shared/cross_platform_tests' / folder
dest.mkdir()
(dest / 'input.docx').write_bytes(paths[0].read_bytes())
config = {
'name': folder[3:],
'description': f'Producer session: Word for the web, 2026-09-06; service build not exposed. '
f'Before generated with python-docx 1.2.0. after.docx sha256: {after_hash}. '
f'Source: ooxml-integrity@{COMMIT}, MIT.',
'changes': changes,
}
(dest / 'test.json').write_bytes((json.dumps(config, indent=2) + '\n').encode('utf-8'))
print(folder, changes)
Then run the unchanged repository tooling:
cd python
uv run python scripts/generate_goldens.py
uv run pytest tests/test_cross_platform_consistency.py -n 0 -q
cd ../node
npm ci
npm run build
npm test --workspace @adeu/core -- consistency
Both web scenarios fail the TypeScript abstract-XML comparison. In the original local run with all three projection additions also present, Python had 7 passed, and TypeScript had 5 passed, 2 failed. A fresh v3.0.3 checkout contains two existing scenarios rather than those three additional projections; the failing scenario names are unchanged.
Observed difference
Python declares w16du locally on the inserted/deleted revision elements:
<w:document ...>
<w:del xmlns:w16du="http://schemas.microsoft.com/office/word/2023/wordml/word16du"
w16du:dateUtc="DATE" ...>...</w:del>
<w:ins xmlns:w16du="http://schemas.microsoft.com/office/word/2023/wordml/word16du"
w16du:dateUtc="DATE" ...>...</w:ins>
</w:document>
TypeScript declares the same prefix on the document root:
<w:document xmlns:w16du="http://schemas.microsoft.com/office/word/2023/wordml/word16du" ...>
<w:del w16du:dateUtc="DATE" ...>...</w:del>
<w:ins w16du:dateUtc="DATE" ...>...</w:ins>
</w:document>
The namespace-aware word/document.xml trees have identical expanded element names, attributes, text, tails and child order after normalizing the timestamps. The serialized abstract snapshots differ in the namespace declaration locations. This reproduction establishes a comparison/serialization mismatch; it does not demonstrate document corruption.
The relevant paths are python/src/adeu/redline/engine.py (prefix registration and _inject_w16du_if_needed, which skips the main document), node/packages/core/src/engine.ts (root declaration in the constructor), and python/src/adeu/utils/xml_debug.py (the abstract snapshot retains declaration placement for word/document.xml). These are observations from the current implementation, not a proposed source patch.
Expected behavior
The shared consistency suite should agree on these valid, equivalent namespace declarations, either by aligning serialization or by deliberately normalizing equivalent namespace placement in the comparison. Any comparison change should retain checks for undeclared prefixes and invalid namespace bindings. The fixture goldens should not be removed to hide the failure.
Full local validation
- Python: 1925 passed, 130 skipped. The macOS run does not cover Windows-only live Word COM tests or every Python version in CI.
- TypeScript core: 1056 passed, 32 skipped, 2 failed (the two new cases).
- MCP server: 327 passed.
- n8n: 50 passed.
- All Node workspaces built successfully.
The four input/after files used by this reproduction have been approved for publication at the exact hashes above and in the script. No source fix is included in the fixture contribution.
The same namespace-declaration mismatch also occurs in two prepared accept/reject scenarios: 10_agent_counsel_accept_reject and 11_agent_table_accept_reject, reproduced on v3.0.3 (d825fd0). Neither engine's output contains a w16du:dateUtc attribute in these cases. TypeScript adds an unused xmlns:w16du declaration to the document root; Python does not. This shows that the comparison can fail on the declaration alone, without timestamp injection.
Both scenarios' raw and clean Markdown goldens match across engines, and the selected revisions are accepted/rejected as intended. Only the abstract XML snapshot differs, on that root declaration. Both scenarios are held back from the next fixture PR; their generated goldens are retained for a later PR once this comparison issue is resolved.
@Dmitry-Kov , The namespace comparison issues are fixed, including the unused w16du declaration case after accept/reject. Thanks for the detailed report and reproductions. Please go ahead with the next fixture PR, including the held-back scenarios, whenever you’re ready.