memory: README does not say that unreadable lines are skipped, kept on every write, and fixable only by hand

未關閉 適合新手
#5,609 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
1/5
預估耗時
1 小時以內
新手友好度
90/100
Issue 類型
文件
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
typescript
領域
documentation

研究方向

搭配閱讀 src/memory/README.md、src/memory/index.ts 中的 loadGraphWithUnreadable 和 saveGraph,以確認文件所述行為。在儲存或疑難排解部分附近新增一段簡短說明,涵蓋遭略過並記錄的行、寫入時的保留行為和位元組限制、工具的限制,以及手動修復。README 說明了所述行為和復原步驟後,即為完成。

由索引模型根據 Issue 內容生成。

描述

documentation server-memory v2
Which server?

memory (@modelcontextprotocol/server-memory), src/memory/README.md.

The problem

The README does not say what the server does with a line of the memory file it cannot read, or how to fix one. The only mention is in passing, under the write limits ("MEMORY_MAX_FILE_BYTES counts the bytes of the file as it would be saved, unreadable lines included").

What the server does today (loadGraphWithUnreadable and saveGraph in src/memory/index.ts, from #4885):

  • A line that is not JSON, is not an object, has an unknown type, or fails the entity or relation schema (an entity with no entityType, an observation that is not a string, a relation with no relationType) is left out of the graph. Each skipped line is logged to stderr ("Skipping invalid entity in memory file: …").
  • Every save writes those lines back unchanged, after the graph's own lines, so a write never drops data it could not read.
  • No tool can then remove or repair such a line. read_graph, search_nodes and open_nodes do not show it; delete_entities and delete_observations report its name as not found; add_observations and create_relations fail with "Entity with name … not found"; create_entities under the same name stores a second record beside the invalid line; an invalid relation matches no delete_relations call and stays after the entities it names are deleted. #5541 pins this in src/memory/__tests__/invalid-record-removal.test.ts.

So the only remedy is to edit the file by hand, and a user who sees the stderr line, or a Not found for an entity they can see in the file, has nowhere to read that.

Expected

A short passage in the README (near the storage or troubleshooting sections) stating: which lines are skipped, that they are logged to stderr, that they are kept in the file on every write and count toward MEMORY_MAX_FILE_BYTES, that no tool reaches them, and that the fix is to stop the clients using the file and correct or delete the line in a text editor.

Scope

Documentation only. Whether a remediation tool should exist is a separate question this issue does not ask.

Found while verifying #5541.

主要語言
TypeScript
星號
92k
分支
12k
平均合併
3 小時 46 分鐘
30 天內合併 PR
206

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

modelcontextprotocol/servers 的其他 Issue

查看 modelcontextprotocol/servers 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。