--changed scans never use the map cache, so each one remaps the whole tree
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
- 50/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- go
- Lĩnh vực
- cli, performance
Hướng nghiên cứu
Start in internal/mapper/mapper.go: the cache check around lines 103-120 and the full build at 127-153, which calls scanFile per file. Then look at internal/engine/run.go around lines 158-170, where the changed set is already known before mapper.Build runs. Done means a --changed scan with a cached HEAD map rescans only the changed files, its result equals a full build of the same dirty tree (added, modified and deleted cases), and no cache entry is written for a dirty tree. Verify with go test ./internal/mapper ./internal/engine.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
A --changed scan only has work to do when the working tree is dirty, and the map cache is only used when the tree is clean. So every --changed scan rebuilds the whole repository map, even when one file changed and HEAD's map is already cached.
Where
internal/mapper/mapper.go:103-120(cache used only whenIsCleanExceptis true)internal/mapper/mapper.go:127-153(full single-goroutine build)internal/engine/run.go:158-170(the changed set is known beforemapper.Build)internal/mcp/tools.go:373-380(MCPscanwithchanged)
Details
if clean, cerr := gitx.IsCleanExcept(ctx, root, stateDirName); cerr == nil && clean {
commit = sha
}
...
if commit != "" && opts.CacheDir != "" {
if m, ok := loadCache(opts.CacheDir, commit); ok {
With a dirty tree, commit stays "", so loadCache is skipped and Build reads and regex-scans every supported file. run.go already has the changed-file list before it calls the mapper, but the mapper does not use it.
Impact
--changed is the mode meant to run repeatedly while editing, from the CLI, a pre-commit hook or an MCP client's edit loop. Each run pays the full mapper pass that #90 estimates at minutes on a 100k-file repository. If #88 (seed only the changed files) is fixed, this pass becomes the main fixed cost of a --changed scan. A --since scan on a dirty CI checkout has the same cost.
Steps to reproduce
- On a clean tree, run
spackle scan .once (writes.spackle/cache/map-<sha>.json). - Edit one file and run
spackle scan --changed .. - The cache is not read, the map step takes as long as a cold scan, and no cache file is written.
Suggested fix
In a diff scan (changed != nil), pass the changed set into mapper.Build. Load HEAD's cached map even though the tree is dirty, then rescan only the changed files with scanFile: drop their old Entry and Boundaries rows, add the new ones, and recount languages and infra files from the current listing. If HEAD has no cached map, fall back to the full build. Keep refusing to save a cache entry for a dirty tree.
Acceptance criteria
- A
--changedscan with a cached map for HEAD rescans only the changed files. - The resulting map equals a full build of the same dirty tree (test with an added, a modified and a deleted file).
- No cache entry is written for a dirty tree.
Getting started
- Relevant files:
internal/mapper/mapper.go,internal/engine/run.go - How to run tests:
go test ./internal/mapper ./internal/engine
Related: #88, #90
Filed by repo-audit/full-audit at fffef43. Severity: medium. Effort: M. audit-key: performance|internal/mapper/mapper.go|Build dirty-tree cache
- Ngôn ngữ chính
- Go
- Star
- 0
- Fork
- 1
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc 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 TMHSDigital/Spackle
-
enhancement good first issue severity: low
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 72/100
TMHSDigital/Spackle#139 ·
-
enhancement good first issue severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
TMHSDigital/Spackle#138 ·
-
documentation good first issue severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
TMHSDigital/Spackle#135 ·
-
bug good first issue severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
TMHSDigital/Spackle#131 ·
-
runs and runs compare print target text without the control-character cleaning the reports useĐang mởbug good first issue severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
TMHSDigital/Spackle#129 ·
Tất cả issue của TMHSDigital/Spackle
Issue tương tự
-
bug raised-by:reviewer
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
medici-finance/assay#7655 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
helm chart: make DaemonSet pod affinity configurable via values.yamlCó thể đã có người làm @Young-Zen đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
flannel-io/flannel#2632 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
go-vulnerability security-scan
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
teslashibe/agent-go#36 ·
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nwverse/persona#15194 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug flaky-test
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
rosskukulinski/tailworks#411 ·
Maintainer thường phản hồi trong vòng 1 ngày