Skip to content

[docs] archive-mail YAML message_id parser brittle — reduce 'schema diversity' claim or strengthen (sister concern from #49) #54

Description

@kiki830621

Problem

From verification of #49:
「YAML message_id: parser brittle for single-quoted / inline-comment / CRLF / trailing-whitespace cases. archive-mail v2.6+ self-archived files always double-quoted (19 chchen_lab historical files all OK), so impact limited to manual-archive edge case. README claim "Resilient to schema diversity" is overpromised.」
— Source: idd-verify #49 (logic F5 + codex P3 + DA verification)

archive-mail.md Step 2.1 sibling-archive dedup extension uses awk to extract message_id: value from markdown YAML frontmatter:

mid=$(head -30 "$mdfile" 2>/dev/null | awk '/^message_id:[ \t]*/{sub(/^message_id:[ \t]*"?/,"");sub(/"?$/,"");print;exit}')

This works for archive-mail's own writer (always emits message_id: "<...>" with double quotes), but the README and docs claim "Resilient to schema diversity" — overpromise.

Type

docs (claim reduction) OR refactor (parser hardening)

Three sub-issues

A. False claim in archive-mail.md properties block

archive-mail.md Step 2.1 properties states "Resilient to schema diversity:只 require message_id: field 在 YAML frontmatter 開頭~30 lines". This is not actually robust — it fails on:

  • Single-quoted values: message_id: '<...>'
  • Inline comments: message_id: "<...>" # received 2026-01-01
  • CRLF line endings (sub trailing ?$/ matches \r")
  • Trailing whitespace before closing quote
  • Multi-line YAML values (rare but valid)

B. Mitigations

Two paths:

  1. Reduce claim: change "Resilient to schema diversity" to "Compatible with archive-mail's own message_id frontmatter format (v2.6+); manual archives or external sources may need explicit conversion". Doc-only fix, pure honesty.

  2. Strengthen parser: switch from awk to a proper YAML parser (e.g. yq, or hand-rolled awk that handles quotes / comments / CRLF). Requires yq dep OR more bash code.

C. README log line claim

README L99 says detection "extends dedup with N entries" — if YAML parser silently skips files, N undercounts without warning. User can't tell if dedup is actually working from the log.

Priority

P3 — low impact unless user has manually-edited or externally-sourced markdown archives. archive-mail's own outputs are 100% covered by the current parser.

Strategy sketch

Recommended: Option A.1 (claim reduction) for cheap fix. Defer parser hardening until N≥3 user reports of manual-archive missed dedup.

- - **Resilient to schema diversity**:只 require `message_id:` field 在 YAML frontmatter 開頭~30 lines;archive-mail v2.6.0+ 全有,manual archive 若有 `message_id:` 也認得;沒有則跳過該檔(silent skip,計入 ENTRIES_THIS_DIR=0 不報)。
+ - **archive-mail v2.6+ format compatibility**:設計 target 是 archive-mail 自產的 frontmatter(`message_id: "<...>"` 雙引號格式)。Manual archive 若 frontmatter 用單引號 / 內含 inline comment / CRLF / trailing whitespace,parser 會 silent skip 該檔(計入 ENTRIES_THIS_DIR=0)。Future hardening 見 follow-up issue。

Plus add a runtime log when ENTRIES_THIS_DIR=0 but *.md files exist in symlink dir (signal silent-skip to user).

Related

Current Status

Phase: implemented (cluster-PR mode)
Last updated: 2026-05-10 by /idd-implement cluster

Key Decisions

Scope Changes

  • Single file change per issue, all 4 issues touch different files (no inter-issue scope overlap).
  • No sister bugs surfaced (Step 5.7 sweep returned empty).

Blocking

  • (none) Awaiting /idd-verify --pr 71 cluster verify + per-issue /idd-close after merge.

Commits

Current Status

Phase: verified
Last updated: 2026-05-10 by /idd-verify cluster

Key Decisions

  • Cluster verify (PR cluster: 4 docs follow-ups from #49 / #60 IDD lifecycles #71) returned PASS after empirical adjudication of Codex GPT-5.5 cross-model dissent. Full report: cluster: 4 docs follow-ups from #49 / #60 IDD lifecycles #71 (comment)
  • This issue's verify-stage fix(es): MEDIUM parser failure-mode wording corrected
  • Codex caught parser-behavior accuracy issue Claude reviewer flat-passed — cross-model verify did its job.
  • 2 Codex HIGH findings on ### Notes non-KAC section names rejected as false positives — empirical evidence shows ### Notes is established repo convention (6× usage in che-apple-mail-mcp CHANGELOG, also batch-ocr/plugin-tools/parallel-ai-agents).
  • DA skipped — disagreements were empirically resolvable via repo grep + bash awk test, no need for separate DA agent.

Scope Changes

Blocking

Commits

Current Status

Phase: closed
Last updated: 2026-05-10 by /idd-close cluster

Key Decisions

  • Closed via cluster /idd-close PsychQuant/psychquant-claude-plugins#52 PsychQuant/psychquant-claude-plugins#54 PsychQuant/psychquant-claude-plugins#55 PsychQuant/psychquant-claude-plugins#64 after PR cluster: 4 docs follow-ups from #49 / #60 IDD lifecycles #71 merged.
  • Per-issue closing summary written independently (NOT batched — IDD discipline).
  • Step 0 supersession active(Implementation Complete > Checklist all - [x])→ Strategy/Plan unchecked items 視為 superseded per #515 fix。
  • Step 1.5 PR Gate PASS(PR cluster: 4 docs follow-ups from #49 / #60 IDD lifecycles #71 MERGED at 2026-05-10T12:02:27Z as 1557fbf)。
  • Step 1.6 semantic gate PASS(每個 issue 的 backtick file path 都在 #54 commit 的 changed-files 列表)。

Scope Changes

  • Cluster of 4 issues sharing 1 PR + 1 squash-merge commit 1557fbf(原 5 commits squashed: 4 implementation + 1 verify-fix)。
  • Verify-stage findings:cross-model dissent caught accuracy issues Claude flat-passed(parser-behavior wording, scope claim narrowing, suppression description completeness)。
  • 2 Codex HIGH on ### Notes non-KAC rejected as repo-convention false positives。

Blocking

  • (none — issue CLOSED)

Commits

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions