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

Đang mở
#2,706 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
22/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
git, typescript
Lĩnh vực
backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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).

Ngôn ngữ chính
TypeScript
Star
2k
Fork
301
Merge trung bình
3 ngày 14 giờ
Pull request đã merge (30 ngày)
103

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Zoo-Code-Org/Zoo-Code

Tất cả issue của Zoo-Code-Org/Zoo-Code

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.