Skip to content

Tracking: word-aligned-state-sync round-trip 驗證線(XmlNode tree + .mdocx Swift 腳本) #127

Description

@kiki830621

Problem

Original text:
「我記得che-word-mcp有一個大改動,就是想要用round test確保word修改不會有差的,我會建立swift腳本來測試,想看看目前到哪裡了」
— Source: 使用者直接輸入(2026-07-03 session)

使用者記憶中的「che-word-mcp 大改動」對應到 macdoc 的 Spectra change word-aligned-state-sync(把 ooxml-swift 從破壞性 typed model 改造為 lossless XmlNode tree + operation log + .mdocx Swift 腳本授權面)。此 issue 是該線的 GitHub tracking 入口 —— 之前進度只存在 openspec/changes/word-aligned-state-sync/ 裡,跨 repo 的 round-trip 損失 bugs 沒有單一 dashboard。

Type

tracking(feature line)

Priority

P2(排程)— 回鍋此線時可升級

Current Status (2026-07-03)

Spectra change word-aligned-state-sync10/73 tasks

Phase 內容 目標版本 狀態
Phase 0 XmlNode tree 基礎(lossless 表示、identity round-trip、golden corpus、TreeRoundTripGoldenTests ooxml-swift v0.30.0 ✅ 10/10 完成,已釋出
Phase 1 typed views 變 tree projections(Paragraph/Run/Table/SectionProperties/Settings) v0.31.0 ○ 未開始
Phase 2 Operation log(append-only + JSONL sidecar + reducer/undo/blame) v0.32.0 ○ 未開始
Phase 3 Word-import diff / SyncOrchestrator(conflict 偵測、file watcher、Word lock) v0.33.0 ○ 未開始
Phase 4 Script transcoder(op log ↔ .mdocx Swift 腳本、log→script→log round-trip、macdoc word reverse CLI) v0.34.0 ○ 未開始
Phase 5 v1.0.0 遷移清理(移除 legacy typed-only 路徑) v1.0.0 ○ 未開始

已鎖定 specsooxml-roundtrip-fidelityooxml-roundtrip-completenessmdocx-grammar.mdocx 語法 locked,transcoder 實作在 Phase 4)
既有測試面:ooxml-swift RoundTripFidelityTests / TreeRoundTripCorpusTests / TreeRoundTripGoldenTests / DocumentXmlLosslessRoundTripTests 等;che-word-mcp RealWorldDocxRoundTripSmokeTests
姊妹 changeooxml-edit-isomorphism-foundation(11/35)

關聯的 round-trip 損失 bugs(ooxml-swift,open)

Phase 0 的 tree 表示是這些 bug 的結構性解法;Phase 1 落地後應逐一回頭驗證:

Expected

  • .docx 經 read → mutate → save 後,未被編輯的部分零損(round-trip fidelity)
  • .mdocx Swift 腳本可作為驗證面:log → script → log 等價、script → docx 可迭代(Phase 4;即使用者想寫的 Swift 測試腳本歸屬處)
  • 上列 4 個 ooxml-swift round-trip bugs 隨 phase 推進逐一清空

Actual

  • Phase 0 完成(tree 基礎 + golden corpus 已 merge、v0.30.0 已 tag)
  • Phase 1–5 未開始:typed views 尚未接上 tree,4 個 round-trip bugs 仍 open
  • .mdocx 語法已 locked 但 transcoder 未實作,Swift 腳本驗證還不可用

Impact

沒有這條線,任何經 che-word-mcp / ooxml-swift 寫回的 .docx 都可能靜默丟失未觸碰的內容(shapes、AlternateContent、多 section 結構、settings)—— 對使用者是不可逆的文件損壞風險。

Next Steps

  1. /spectra-apply word-aligned-state-sync 續作 Phase 1(typed views → tree projections,v0.31.0)
  2. Phase 1 落地後回頭驗證上列 4 個 bugs
  3. Phase 4 建立 .mdocx Swift 腳本 round-trip 驗證

Clarity Surface(idd-clarify run 2026-07-03T03:53:43Z)

Type Source Suggested canonical Status
ambiguity "想要用round test確保word修改不會有差的" 「round test」非標準術語;候選解讀:(a) round-trip fidelity test(read→write 無損驗證,body 採此解);(b) 一般 regression test suite surfaced
ambiguity "我會建立swift腳本來測試" 「Swift 腳本」雙解:(a) .mdocx script transcoder 驗證面(Phase 4,body 採此解);(b) 一般 XCTest Swift 測試碼(RoundTripFidelityTests 等既存) surfaced
ambiguity "我記得che-word-mcp有一個大改動" 該大改動實際主體在 ooxml-swift + macdoc(word-aligned-state-sync change);che-word-mcp 是下游消費者,attribution 需注意 surfaced
missing-context "確保word修改不會有差" 「不會有差」的 diff 判準未指定:byte-identical / normalizedFingerprint 等價(spec 現行判準)/ 語意等價 —— 三者嚴格度不同 surfaced

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions