fix(aidd-context): preserve project-memory files on write failure
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- javascript, node.js
- 领域
- tooling
调研方向
Start with the write path in plugins/aidd-context/hooks/update_memory.js around lines 272 and 283, where existing files are written in place, and reproduce the truncation with the injected partial-write-then-EIO fault described in the issue. Read scripts/__tests__/update-memory.test.js to see the symlink, hard-link and path-substitution safeguards from PR #992 that must stay intact. Done means a partial write followed by an error restores or reports the original content for the affected file, with a deterministic test that fails on the current code.
由索引模型根据 Issue 内容生成。
描述
Description
At upstream/next commit b688e402, project-memory sync writes directly to existing files. A deterministic fault-injection reproduction makes CLAUDE.md truncate when a partial write is followed by EIO. The script exits with an error, but the file is already damaged.
The reproduction uses a temporary project fixture and a Node preload that writes 28 bytes to CLAUDE.md, then throws an injected EIO. The resulting file is USER PREFIX\n<!-- aidd_projec.
Affected file(s)
plugins/aidd-context/hooks/update_memory.js#L272plugins/aidd-context/hooks/update_memory.js#L283scripts/__tests__/update-memory.test.js
Expected behaviour
A failed sync must not silently leave an existing project-memory file corrupted. If original content cannot be preserved or restored, the failure must explicitly identify the affected file and recovery outcome.
- An I/O failure before the first write leaves every destination unchanged.
- Partial-write and truncation failures are covered by deterministic tests and return a failure; they are never reported as a successful sync.
- Tests and safeguards against symlinks, hard links, and path substitutions remain in place.
- Failures between multiple destinations have documented and tested outcomes. No global atomicity across files is claimed.
Observed behaviour
With the injected EIO, the process exits with code 1, but CLAUDE.md is truncated to USER PREFIX\n<!-- aidd_projec. The original content is not restored.
AI tool
Other — direct invocation of the aidd-context project-memory sync script
aidd-cli version
Not applicable — the reproduction invokes the project-memory script directly; framework next is at b688e402.
OS
Linux
Additional context
PR #992 adds descriptor-based writes and safeguards against symlinks, hard links, and path substitution. Its injected write-failure test fails before the first byte; it does not cover a partial write followed by an error or a truncation failure. The PR also states that it does not guarantee recovery from every filesystem failure or atomicity across multiple files.
Code of Conduct
- I agree to follow this project's Code of Conduct.
- 主要语言
- TypeScript
- 星标
- 481
- 派生
- 45
- 平均合并
- 1 天 13 小时
- 30 天内合并 PR
- 91
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ai-driven-dev/framework 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 86/100
ai-driven-dev/framework#1311 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 79/100
ai-driven-dev/framework#1244 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
ai-driven-dev/framework#1197 ·
维护者通常 1 天内回复
-
refactor(aidd-context): apply the new skill template to learn可能已有人在做 @blafourcade 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
ai-driven-dev/framework#1186 · 已指派 1 人 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
ai-driven-dev/framework#1163 · 1 条评论 ·
维护者通常 1 天内回复
查看 ai-driven-dev/framework 的全部 Issue
相似的 Issue
-
db-d1-sqlite: upsert is aliased to updateOne, so payload.kv.set never inserts new keys可能已有人在做 @pcbeingused333 今天认领。 未关闭Bug db: d1-sqlite Payload OSS
难度 2/5 1-3 小时 新手友好度 76/100
payloadcms/payload#19766 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
device-management-toolkit/sample-web-ui#3711 ·
维护者通常 1 天内回复
-
bug impact:low Team: SecuritySolution Team:Defend Workflows v9.6.0
难度 2/5 1-3 小时 新手友好度 72/100
elastic/kibana#306401 · 3 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
agentes-chat/agentes-chat#927 ·
维护者通常 1 天内回复
-
Closing a pinned tab jumps to the Tabs section instead of the next open pinned tab可能已有人在做 @seenimohamed 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 78/100
ardia-browser/ardia#2769 ·
维护者通常 1 天内回复