fix(aidd-context): preserve project-memory files on write failure

オープン
#1,018 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
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)
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
主要言語
TypeScript
スター
481
フォーク
45
平均マージ
1日 13時間
マージ済み PR(30日)
91

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ai-driven-dev/framework のほかの issue

ai-driven-dev/framework の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。