fix: stop the scratch-name match from pruning user directories
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
- 82/100
Hướng nghiên cứu
Bắt đầu tại internal/indexdir/filter.go (besideStore, khoảng dòng 109–114), nơi có phép so khớp chỉ dựa trên tên bằng strings.HasPrefix, rồi kiểm tra scratchdir.LockName để thay bằng kiểm tra nội dung. Tiếp theo, theo dõi pruning trong internal/indexer/discover/discoverexclusion.go:162-172 để xem bản ghi loại trừ được tạo ở đâu. Tái hiện bằng các bước mkdir/symlink trong issue; hoàn thành khi thư mục người dùng được lập chỉ mục (hoặc được ghi nhận kèm lý do), trong khi các thư mục scratch thực sự có chứa .lock vẫn bị pruning, và có một bài kiểm thử trong internal/indexdir.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happens
The index skips any directory whose name starts with the store name followed by .scratch-. A user directory with such a name is skipped too. Discovery prunes it with no exclusion record, so its files are missing from the index and no reason is reported. This follows PR #384, which introduces the name match in internal/indexdir/filter.go.
Reproduced on commit 375d8be6 of branch fix/index-path-links, built from source:
$ codegraph index --force repo
files=1 nodes=2 edges=1 duration=82ms
Only repo/main.go is indexed. repo/store-real.scratch-notes/a.go is absent.
The cause is besideStore in internal/indexdir/filter.go:109-114. It matches a scratch directory by strings.HasPrefix on the name alone. DiscoverAll then prunes the matching directory before it makes any record (internal/indexer/discover/discoverexclusion.go:162-172).
What you expected instead
A directory that codegraph did not create is indexed as source, or it gets an exclusion record with a reason. Only a real scratch directory is pruned.
The match must check the content of the directory, such as its lock file .lock (scratchdir.LockName), and not the name alone. A scratch name ends in a random suffix, so the name cannot tell a scratch directory from a user directory.
Steps to reproduce
- Run
mkdir -p repo/.codegraph repo/store-real repo/store-real.scratch-notes. - Run
ln -s ../store-real repo/.codegraph/store. - Write
package atorepo/store-real.scratch-notes/a.go, andpackage maintorepo/main.go. - Run
codegraph index --force repo. Only one file is indexed.
Version
codegraph dev (commit unknown, built unknown) go1.26.11 darwin/arm64, built from 375d8be6.
Platform
macOS 27.2.1 arm64
How did you install it?
Built from source
Languages in the affected repository
Go. The bug depends on directory names, not on the language.
Before submitting
- I searched existing issues and this is not a duplicate
- I checked the capability matrix and this is not a documented limitation
- This is not a security vulnerability
- Ngôn ngữ chính
- Go
- Star
- 0
- Fork
- 0
- Merge trung bình
- 5 giờ 16 phút
- Pull request đã merge (30 ngày)
- 107
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của seanb4t/codegraph-go
-
chore needs-triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
seanb4t/codegraph-go#380 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
chore needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
seanb4t/codegraph-go#379 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
chore needs-triage
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 84/100
seanb4t/codegraph-go#362 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:query bug priority:low spec-needed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
seanb4t/codegraph-go#355 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:ci chore priority:low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
seanb4t/codegraph-go#329 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của seanb4t/codegraph-go
Issue tương tự
-
enhancement exporter/awskinesis needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
open-telemetry/opentelemetry-collector-contrib#53334 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
erigontech/erigon#26523 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 83/100
SocialGouv/iterion#3376 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
seaweedfs/seaweedfs#12740 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày