DOC-FULL-019A P1 | NoteAnchor 完整性验收 + from_search_result 【status:todo】 #87

Closed
opened 2026-06-07 11:45:18 +08:00 by wangdl · 2 comments
Owner

补 from_search_result():Markdown→MarkdownBlock, Text→TextLine, PDF→PdfPage, EPUB→EpubChapter。测试 6 种 position 转换 + 4 种 search result 转换。Unknown 兜底 Material anchor。

M-DOC-FULL v2 里程碑 issue。

## 补 from_search_result():Markdown→MarkdownBlock, Text→TextLine, PDF→PdfPage, EPUB→EpubChapter。测试 6 种 position 转换 + 4 种 search result 转换。Unknown 兜底 Material anchor。 M-DOC-FULL v2 里程碑 issue。
wangdl added this to the M-DOC-FULL:Document Runtime 完整阅读内核与学习事件协议 milestone 2026-06-07 11:45:18 +08:00
wangdl changed title from DOC-FULL-019A P1 | NoteAnchor 完整性验收 + from_search_result to DOC-FULL-019A P1 | NoteAnchor 完整性验收 + from_search_result 【status:todo】 2026-06-07 19:15:10 +08:00
Author
Owner

审查结论:document runtime 当前有文件类型识别/MaterialType/PreviewMode/DocumentInfo(基本)/Markdown解析/Text解析/ImageMeta/Search(V1 Markdown+Text)/NoteAnchor(V1)/ReadingEvent(V1)/ReadingPosition(V1)/EventBuffer(V1基础)/iOS构建/UniFFI绑定/docs。但 V2 核心模型(ReadingSession/EventV2/ActiveTimeTracker)不存在,EventBuffer 缺 ack/failed,Position 缺 camelCase+clamp,PDF/EPUB/Office 为 stub,测试覆盖不足 V2。

本 Issue: from_search_result() 不存在。

状态: status:todo
工作类型: work:extend-existing

## 审查结论:document runtime 当前有文件类型识别/MaterialType/PreviewMode/DocumentInfo(基本)/Markdown解析/Text解析/ImageMeta/Search(V1 Markdown+Text)/NoteAnchor(V1)/ReadingEvent(V1)/ReadingPosition(V1)/EventBuffer(V1基础)/iOS构建/UniFFI绑定/docs。但 V2 核心模型(ReadingSession/EventV2/ActiveTimeTracker)不存在,EventBuffer 缺 ack/failed,Position 缺 camelCase+clamp,PDF/EPUB/Office 为 stub,测试覆盖不足 V2。 **本 Issue**: from_search_result() 不存在。 **状态**: status:todo **工作类型**: work:extend-existing
Author
Owner

验收完成(已于 #68 + #69 实现)

验收内容

  • from_position(): 6 种 ReadingPosition→NoteAnchor(Markdown/Text/Pdf/Image/Epub/Unknown→Material)(#68 anchors.rs:60)
  • from_search_result(): 4 种 SearchResult→SearchResultAnchor(#68 anchors.rs:101)
  • to_position(): NoteAnchor→ReadingPosition 反向转换,含 snapshot 优先 + 智能分发(#69 anchors.rs:115)
  • restore_position_from_anchor FFI 导出(#69)

测试覆盖(18 tests)

  • 6 种 position→anchor 转换 + 4 种 search_result→anchor
  • roundtrip: test_roundtrip_position_anchor_position(from_position→to_position 无损)
  • 向后兼容: test_backward_compat_no_snapshot(旧 JSON 无 snapshot 正确反序列化)
  • position_snapshot 序列化: test_anchor_serde_with_snapshot

验证

cargo test anchors — 18 passed
## 验收完成(已于 #68 + #69 实现) ### 验收内容 - [x] `from_position()`: 6 种 ReadingPosition→NoteAnchor(Markdown/Text/Pdf/Image/Epub/Unknown→Material)(#68 anchors.rs:60) - [x] `from_search_result()`: 4 种 SearchResult→SearchResultAnchor(#68 anchors.rs:101) - [x] `to_position()`: NoteAnchor→ReadingPosition 反向转换,含 snapshot 优先 + 智能分发(#69 anchors.rs:115) - [x] `restore_position_from_anchor` FFI 导出(#69) ### 测试覆盖(18 tests) - 6 种 position→anchor 转换 + 4 种 search_result→anchor - roundtrip: `test_roundtrip_position_anchor_position`(from_position→to_position 无损) - 向后兼容: `test_backward_compat_no_snapshot`(旧 JSON 无 snapshot 正确反序列化) - position_snapshot 序列化: `test_anchor_serde_with_snapshot` ### 验证 ``` cargo test anchors — 18 passed ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wangdl/zhixi-document-runtime#87
No description provided.