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

Aperta
#1,018 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript, node.js
Ambito
tooling

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
TypeScript
Stelle
481
Fork
45
Merge medio
1g 13h
PR unite (30g)
91

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ai-driven-dev/framework

Tutte le issue di ai-driven-dev/framework

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.