Skip to content

archive-mail Step 8.5: post-#107 改消費 batch-export manifest 取代 frontmatter 重掃 + index 原子寫入 #110

Description

@kiki830621

Problem

Step 8.5 reconcile gate(mail#261,PR #108)目前靠重掃 ${output_dir} frontmatter 重建孤兒 entry。frontmatter 缺 subject(要從本文 Subject: 行抽)、缺 to/cc(participants 不可重建,threads 只能 defer 給 /archive-mail-rebuild-threads)——欄位推導的縫隙都源自「事後從 md 反推」。

Proposed Solution

#107(Step 5 → batch_export_emails_markdown 遷移)落地後,reconcile gate 改消費 export manifest(manifest 已帶 message_id 與完整欄位),機械化 reconciliation、消除 frontmatter-vs-schema 的推導縫隙。同時重訪 index 原子寫入(temp+rename)作為 durable fix(#261 diagnosis 的「先解有 gate」註記)。

Context


✅ Verified(PR #115 @ frozen ddabc6a,tag idd-110-verified

Step 8.5 重構為 Phase 0(manifest-driven)+ Phase 1(full-scan fallback) + atomic temp+rename index write(Step 6 + Step 8.5)。shell v2.33.0(binary 不動 v2.19.0)。

修正原案前提(承 #107 的 binary-capability verify):原案假設「manifest 已帶完整欄位」,但實證 manifest 只帶 message_id + written_path(條件性),不帶 date/subject/thread_key。故 Phase 0 是三源合併非純 manifest-consume:filewritten_path、key←manifest message_iddate/thread_key←寫出 md frontmatter(工具已寫這兩 frozen 欄位)、subject←Step 4.5 preview(frontmatter 無 subject)。這消除原案關切的 subject-from-body heuristic(僅 Phase 1 歷史孤兒保留)。

Phase 1 全掃 ${output_dir} 收斂歷史孤兒(前一 run 中斷 / 非 batch / 外部 md),跳過 Phase 0 已處理的 message_id。Atomic write 防 single-file partial-write 損毀,與 gate 的 cross-file 孤兒覆蓋互補(power-fail 級 durability 另需 fsync,威脅模型外)。threads.json participant 重建仍 defer 給 /archive-mail-rebuild-threads(manifest + frontmatter 皆無 to/cc)。

兩獨立 6-AI verify pass(互補):Pass A 攔下 #107 Step 5.0 forward-ref 與本 PR 自相矛盾(同檔 stacked);Pass B 三 verifier 收斂攔下 reconcile summary arithmetic 錯誤(49 verified61,49+66+8≠135)。整合修正 ddabc6a 另含 3 hardening(Phase 0 也觸發 rebuild-threads、batch-manifest-lost ⚠ 不靜默降級、Phase 1 缺 date/thread_key 填空+揭露)。整合態 confirmation lens PASSMaster report

狀態:停在 verified。merge 順序 #108#111#113#114#115(archive-mail 塔);close 由維護者決定。

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