`init` says "Already initialized" after a first index that didn't finish

Đang mở Phù hợp với người mới
#3,228 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 1 ngày

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

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
70/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu từ runInit trong src/bin/codegraph.ts (khoảng dòng 757-765), nơi nhánh đã khởi tạo in ra thông báo đơn giản. Đọc cách codegraph status dùng getIndexState() (src/index.ts:2174, phần status trong src/bin/codegraph.ts:1313-1320) cùng với isRebuildInProgress. Hoàn thành khi init in cảnh báo chỉ mục chưa đầy đủ tương ứng cho các trạng thái indexing (không có quá trình xây dựng lại đang chạy), failed hoặc partial, và vẫn in thông báo đơn giản khi trạng thái là complete.

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

Mô tả

Follow-up to the last point in #3223.

What happens

If the first index stops partway (in #3223 it threw at "Resolving refs"), running codegraph init again prints:

Already initialized in <project-root>
Use "codegraph index" to re-index or "codegraph sync" to update

Nothing says the index is incomplete, so it reads like a working setup that just needs updating.

Where (main f72c9d2e)

  • runInit (src/bin/codegraph.ts:757-765) only checks isInitialized(projectPath) before printing that message.
  • The project already records whether the last run finished. getIndexState() (src/index.ts:2174) returns indexing (marked before any writes at src/index.ts:703, so a run that dies midway leaves it behind), failed, partial or complete.
  • codegraph status already uses it (src/bin/codegraph.ts:1313-1320), with isRebuildInProgress to tell a run in another process from one that never finished.

Suggestion

In the already-initialized branch of runInit, read the index state the same way status does. When it is indexing with no rebuild running, failed, or partial, print the matching status warning ("The last index run never finished … Re-run codegraph index.") instead of the plain "Already initialized".

I worked this out by reading main. I haven't reproduced a failed first index locally.

Ngôn ngữ chính
C
Star
73.2k
Fork
4.7k
Merge trung bình
3 giờ 46 phút
Pull request đã merge (30 ngày)
510

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 colbymchenry/codegraph

Tất cả issue của colbymchenry/codegraph

Issue tương tự

Thêm issue về C

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.