Problem
Original text:
「好,開一個新的 Spectra change 或 issue 來規劃這條線,所以看起來複製是step1, 然後用合法的operation來序列化是第二步」
— Source: 使用者於 format-alignment-engine(#130)完成歸檔後的方向指示(2026-07-08 session)
format-alignment-engine(#130,已歸檔,ooxml-swift v1.1.0–v1.3.0)完成了兩步框架的第一步:
- Step 1 複製(done):raw channel byte-equal floor。真實 Word 文件(
90_template_ja.docx、thesis-fixture)reverse → script → rebuild 全部 Stage B byte-equal。
- Step 2 用合法 operation 序列化(本 issue):讓真實 Word 文件的內容能被 typed operations 表示、且 reducer + serializer 重建出 identical bytes——即通過既有的 trial-rebuild byte-equal gate(Decision 3),使 DSL coverage 從 0% 誠實爬升。
現狀(docs/format-alignment-baselines.md 實測):五層 extraction(run rPr / paragraph pPr / sections / canonical tables / text+style)對自家 writer 產物已達 57.5% DSL coverage,但對 Word-authored 文件是 0%——extraction 在 Word 的 XML forms 上誠實 bail 到 raw:rsid 屬性群、多命名空間 root(mc:Ignorable 等)、xml:space、attribute 順序、以及 ReverseExtractor.Result.rawReasons 記錄的其他 unsupported-form。
Type
feature
Expected
真實 Word 文件(以 90_template_ja.docx 為 acceptance fixture,經 MACDOC_TEMPLATE_DIR env-gate):
- document.xml 通過 trial-rebuild byte-equal gate 升級 DSL channel,aggregate coverage 顯著 > 0%
- 升級後
--slot 對它可用——實用驗收:對日本心理學會 template 指定 title/body slots,填新內容產生格式完整的新投稿文件(template-content-slots spec 的 title-and-body scenario 在真實 template 上成立)
- Stage B 恆綠(既有 UpgradeClassGuardTests + FormatAlignmentAcceptanceTests 機制保護)
Actual
- Word-authored 文件 DSL coverage = 0.0%(
90_template_ja 13 parts / 134,050 bytes 全 raw;thesis-fixture 39 parts / 1,746,868 bytes 全 raw)
--slot 對 raw-channel 段落 loud-fail(strict mode 設計如此)
技術方向(初步,propose 時細化)
- Form-gap corpus 分析:細化
rawReasons 到具體 bail 點清單(元素/屬性/form 統計),對 gated real templates 跑量測,決定詞彙擴充的優先序
- 詞彙擴充:rsid 屬性群(
w:rsidR/rsidRDefault/...)、root namespace 集參數化(emptyAuthoringDocument 目前固定 xmlns:w + xmlns:w14)、xml:space="preserve"、rPr/pPr 長尾(szCs、rFonts hint/hAnsi/cs、lang、kern…)
- Sibling parts 的 typed 化(styles.xml/settings.xml 等)可作為後續 phase——分母的大宗(
sibling-part class)
- 每一步都受既有 trial-rebuild byte-equal gate 保護:升級只在 byte-equal 證明後發生,Stage A/B binary、無 fuzzy pass
Impact
關聯
Clarity Surface(idd-clarify run 2026-07-08T15:55:37Z)
| Type |
Source |
Suggested canonical |
Status |
| ambiguity |
"aggregate coverage 顯著 > 0%" |
「顯著」未定義具體驗收閾值——propose 時需定:以 90_template_ja 的 document.xml 佔比推導目標(如 document.xml 全升級 ≈ 34%),或以 slot 可用性(Expected #2)為功能性驗收、不設數值閾值 |
surfaced |
| missing-context |
"Form-gap corpus 分析:…對 gated real templates 跑量測" |
corpus 範圍未指定——目前已知僅 2 個 gated 真實文件(90_template_ja、thesis-fixture);是否需收集更多樣本(不同 Word 版本/語言/來源)以避免詞彙擴充過擬合單一 template |
surfaced |
Linked-Context Siblings Filed (v2.48.0+ #529)
Problem
format-alignment-engine(#130,已歸檔,ooxml-swift v1.1.0–v1.3.0)完成了兩步框架的第一步:
90_template_ja.docx、thesis-fixture)reverse → script → rebuild 全部 Stage B byte-equal。現狀(
docs/format-alignment-baselines.md實測):五層 extraction(run rPr / paragraph pPr / sections / canonical tables / text+style)對自家 writer 產物已達 57.5% DSL coverage,但對 Word-authored 文件是 0%——extraction 在 Word 的 XML forms 上誠實 bail 到 raw:rsid 屬性群、多命名空間 root(mc:Ignorable 等)、xml:space、attribute 順序、以及ReverseExtractor.Result.rawReasons記錄的其他unsupported-form。Type
feature
Expected
真實 Word 文件(以
90_template_ja.docx為 acceptance fixture,經MACDOC_TEMPLATE_DIRenv-gate):--slot對它可用——實用驗收:對日本心理學會 template 指定 title/body slots,填新內容產生格式完整的新投稿文件(template-content-slotsspec 的 title-and-body scenario 在真實 template 上成立)Actual
90_template_ja13 parts / 134,050 bytes 全 raw;thesis-fixture 39 parts / 1,746,868 bytes 全 raw)--slot對 raw-channel 段落 loud-fail(strict mode 設計如此)技術方向(初步,propose 時細化)
rawReasons到具體 bail 點清單(元素/屬性/form 統計),對 gated real templates 跑量測,決定詞彙擴充的優先序w:rsidR/rsidRDefault/...)、root namespace 集參數化(emptyAuthoringDocument目前固定 xmlns:w + xmlns:w14)、xml:space="preserve"、rPr/pPr 長尾(szCs、rFonts hint/hAnsi/cs、lang、kern…)sibling-partclass)Impact
關聯
docs/format-alignment-baselines.mdReverseExtractor(trial-rebuild gate)、PartFidelity、ScriptExporter.exportSwift(log:slots:)Clarity Surface(idd-clarify run 2026-07-08T15:55:37Z)
Linked-Context Siblings Filed (v2.48.0+ #529)