Checkpoint ignore-semantics and restore-journaling follow-ups (#1410 threads wM68EMCO / wM68EMCv / wM68EMB_)

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

Les mainteneurs répondent en général sous 3 jours

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
22/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
git, typescript
Domaine
backend

Piste de recherche

Start with the checkpoint journaling in src/core/checkpoints/index.ts (the ignore skip near line 399, the early return near 404-408, and the restoreFile delete branch near 571-580), then isPathIgnored near line 625. Also read src/services/checkpoints/ShadowCheckpointService.ts (commit staging near 256-264) and preStepRestoreTarget in src/core/checkpoints/rollback.ts. The issue is a plan to be written before any code, with no PR allowed yet, so a newcomer should first help settle the design rather than patch.

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

Description

Tracking-issue draft: checkpoint metadata honesty (#1410 threads wM68EMCO, wM68EMCv, wM68EMB_) | draft for lead review; lead opens it

Title: Checkpoint ignore-semantics and restore-journaling follow-ups (#1410 threads wM68EMCO / wM68EMCv / wM68EMB_)

Two units in one issue, same family: the rollback metadata a checkpoint reports is not always the state the code acted on. Premises below were verified line by line against head bb9fe5fc528e124cd79442553ee4a3aecb06741d (sha1-40, the head published before today).

Unit A: ignore-semantics (threads wM68EMCO and wM68EMCv, one helper, one commit).

  • Premise 1: journaling skips an ignored write at src/core/checkpoints/index.ts:399 (continue) and returns early when every write in the step is excluded at 404-408, while the commit itself is stage-all based (src/services/checkpoints/ShadowCheckpointService.ts:256-264 uses git.add([".", "--ignore-errors"])). A path already tracked in the shadow repo and ignored only later is therefore committed while the journal skips it: isPathIgnored asks check-ignore with --no-index (625), which reports the rule and not the index membership.
  • Premise 2: isPathIgnored returns false for every git failure (catch at 627-630). In restoreFile the delete branch only refuses when the path is confirmed ignored (571-572) and otherwise removes the file (575-580), so a transient git error reads as not ignored and a live, never-tracked file is deleted unrecoverably.
  • Fix shape: decide tracked-ness from the index or tree before applying an ignore rule; add a throwing judgement used only inside the delete branch so unknown is not confused with confirmed-not-ignored; keep the permissive false for the write-side skip at index.ts:399. Tests: tracked-then-later-ignored; git failure during restore of an untracked file.
  • Cost: about ten executable lines plus two tests; rides the split track because this branches gate operand (781) already exceeds 500.

Unit B: restore journaling (thread wM68EMB_, major, heavy lift, registered here, not yet executed).

  • Premise: appendChanges has exactly one production call site, src/core/checkpoints/index.ts:448 (checkpoint save). Saves and restores are journaled, restores are not, so a save A, restore B-to-A, save C, restore C-to-previous sequence resolves the undone state from preStepRestoreTarget (src/core/checkpoints/rollback.ts:100, used at 167 and 220) which still points at the state the last restore undid.
  • Fix shape, two candidate designs to choose between in the unit: journal one entry per restore, or record the restored target explicitly and have preStepRestoreTarget consume that. Sequential-state test required, not a single-restore test.
  • Cost: new executable lines plus a sequencing test; queued next to the save-metadata unit already recorded under #1991.

Neither unit may open a PR until this issue carries the plan; both cite #1410 threads by id.

LEAD NOTE (issue owner): premise line citations carry frame bb9fe5fc528e124cd79442553ee4a3aecb06741d and were re-checked valid at current published head 17f224ef1900d9ae5226317824d7d06373f6de97 - the files cited (src/core/checkpoints/index.ts, src/services/checkpoints/ShadowCheckpointService.ts, src/core/checkpoints/rollback.ts) are byte-identical between the two heads (batch 11 touched only Task.ts, Task.spec.ts and the service spec). Neither unit opens a PR until this issue carries its plan (planned-and-issued).

Langage dominant
TypeScript
Étoiles
2k
Forks
301
Merge moyen
3 j 14 h
PR mergées (30 j)
103

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 Zoo-Code-Org/Zoo-Code

Toutes les issues de Zoo-Code-Org/Zoo-Code

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.