Skip to content

list_images 只列 relationship 層,看不見 body 引用——孤兒圖片被誤報為存在(sister concern from macdoc#175) #199

Description

@kiki830621

Problem

list_images 回報的是 relationship/media 的存在,不是 body 有引用——macdoc#175 的實測中,body 缺 4 張圖的文件被 list_images 回報「7 張全在」,成為三個測不到靜默遺失的驗證管道之一。

即使 macdoc#175 的 root cause(appendParagraph payload 投影丟 drawing)修復,這個語意缺口獨立存在:任何來源的「rels 有、body 無」孤兒 payload(含 genoffice 研究註記過的同款狀態)都會被 list_images 誤報為存在。

Type

feature(tool 語意強化)

Expected

擇一或並行:

  1. list_images 輸出區分「has relationship」與「referenced in body」兩個欄位;或
  2. 直接以 body <w:drawing> 引用為準,孤兒 rels 另列 warning 欄

Actual

list_images 列 relationship/media 層,body 引用狀態不可見。


Source: surfaced during macdoc#175 /idd-diagnose sister concern surfacing (Step 3.6)

Parent context: PsychQuant/macdoc#175(append 圖片靜默遺失)——本 issue 是其驗證管道側的獨立旁支,root-cause 修復不涵蓋


Current Status

Phase: needs-fix
Last updated: 2026-09-04 by idd-verify (R3) — unattended loop stopped

Key Decisions

  • Verify R3 FAIL,無人值守迴圈到此停止https://github.com/PsychQuant/che-word-mcp/pull/218#issuecomment-5538385180)。fix round 2(74e3eec + 68a3e8a)確認收掉 R2 的 B2′/B4′(三個 inspector 呼叫點)/DA-1(list 側)/I-a…I-f;殘留為同一族(R3-B1 CRLF 折疊、R3-B2 gate 端重複 id 預檢與文案、R3-B3 declaredDocumentImageIds 自帶 regex、R3-B4 guard 範圍+空 baseline 讓合法文件拒存、R3-B5 拒絕訊息未跳脫、R3-B6 nested+換行)
  • 待決(使用者):A 根因修在 ooxml-swift(PackageInspector 改 XMLParser 解析 rels/引用、暴露每 part 宣告清單與重複診斷、線性 stripper、merge 不 trap → 3.7.0 → che-word-mcp 刪除模擬層 → R4;建議)/B 續修 che-word-mcp 模擬層(預期第四種形狀)/C 收窄 PR、殘留列為已知限制
  • Verify R2 FAIL(見 PR feat: list_images reports body references — orphans are named, not listed as present (#199) #218 Verify (R2) comment):fix round 1 收掉 B2 與 B5 算術半邊、I1/I2/I4/I5/I8/I9;B1/B3/B4 各剩第二種形狀(listing 與 gate 兩套正規形、長字元參照/屬性空白正規化、guard 順序繞過+open/revert/reload 三個呼叫點無 guard)、B2′(guard 錯誤路徑回射 part 名、C1 controls)、B5′(body 有引用但 media 缺的 rel 不對帳、chart-only 文件自相矛盾回覆)、新 DA-1(重複 rel id 讓 Session list 觸發 writer fatalError)。超過 idd-all 預設 MAX_ROUND=2,依使用者「七張全部走完 IDD 到 close」的既定指示續做 fix round 2 → R3
  • 修法定調:canonicalization 只做在 gate 端一處((part, id) tuple,字元參照無長度上限+屬性空白正規化),listing 消費 gate 的判定;guard 改線性前向配對並套到三個 inspector 呼叫點;failure reason 整段跳脫、跳脫依 general category;從 rels 位元組做完整對帳;序列化前預檢重複 rel id
  • Follow-ups R2 → ooxml-swift#139(merge fatalError)、Direct Mode(source_path)的 resolveDocument 從不呼叫 doc.close()——每次呼叫漏一個解壓 tempDir(follow-up finding from #199 verify R2) #221(Direct Mode 不 close)
  • Verify R1 FAIL(https://github.com/PsychQuant/che-word-mcp/pull/218#issuecomment-5537006645):5 blocking 全 in-scope——B1 save 預告對 baseline 孤兒錯誤(new-vs-pre-existing 標示)、B2 未轉義回射可偽造列(atoms 加引號+跳脫)、B3 entity 解碼不對稱(Direct)、B4 原始位元組暴露於二次退化 regex(線性預掃拒檢)、B5 兩母體計數與早退順序(列與 inspection 對帳、inspection 先於早退);另 9 項 in-scope(Direct 單次讀取、鑑別性 fixture、措辭、快照斷言、reason 遮蔽路徑、docs 鏡像、混合案例、helper throw)。unattended fix round 1/2 進行中
  • Implemented 2026-09-04:branch idd/199-list-images-body-reference-semantics,commits b82b505(feat)+ c22ef74(docs);392 tests 綠;PR 已開(見 Implementation Complete comment)
  • 新增 ImageListingInspection(從 ImageConsistencyReport 轉入;後者 memberwise init 在 ooxml-swift 是 internal)與純排版函式 imageListing,讓 unknown / other-part 分支可離線測
  • Diagnosis:list_images 只列 relationship 層,看不見 body 引用——孤兒圖片被誤報為存在(sister concern from macdoc#175) #199 (comment)
  • Complexity Plan(Layer P decision-heavy:位元組層 inspector vs typed-model 走訪);/idd-all unattended → 直送 implement,Plan deliberation skipped
  • 選 A:讀側與 save gate 讀同一份位元組(PackageInspector.imageConsistencyReport,ooxml-swift ≥ 3.6.0);Session 走 DocxWriter.writeData、Direct 讀磁碟位元組
  • 輸出同時滿足 Expected 1+2:每列 referenced: yes|NO (orphan)|unknown + 標題列計數 + 孤兒區塊(具名 rId、env-gated cross-check tests need version-alignment guards after dependency bumps #175 訊號、save gate 預告);檢查失敗 → unknown,不退回「全部視為存在」;不設 isError(列出成功、孤兒是內容)
  • Conflict Class B_resource_serialize:Sources/CheWordMCP/Server.swift
  • Sister concerns → che-word-mcp#217(get_document_info imagesCount 同根)、ooxml-swift#136(getImages() 尺寸查找漏表格)

Scope Changes

  • header/footer 圖片不進 list_images 的列(本來就不在 document.images);只在它們有孤兒時具名 part:rId

Blocking

Tasks

  • listImages:inspector + referenced 欄位 + 標題列計數 + 區塊 + Package: 行;檢查失敗 → unknown
  • list_images tool description
  • Issue199ListImagesBodyReferenceTests(Session 孤兒 / Direct 孤兒 / 一致 / 無圖 / isError != true)
  • CHANGELOG 4.0.11 Added + README 工具表
  • swift test 全綠(含 RefusalIsErrorSweepTests)

Commits

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