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

Ouverte
#1,018 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
35/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
javascript, node.js
Domaine
tooling

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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
Langage dominant
TypeScript
Étoiles
481
Forks
45
Merge moyen
1 j 13 h
PR mergées (30 j)
91

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de ai-driven-dev/framework

Toutes les issues de ai-driven-dev/framework

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.