Map cache is reused when only gitignored files changed at the same commit
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
Read internal/mapper/mapper.go around Build and the adjacent TestCacheIsKeyedByCleanCommit test, then trace the file listing through internal/walk/walk.go and cleanliness checks in internal/gitx/gitx.go. Add tests for ignored files and untracked files with status.showUntrackedFiles=no, while confirming a clean tree still hits the cache. Done when each changed listing produces a fresh map and the clean-tree cache test passes.
由索引模型根據 Issue 內容生成。
描述
Summary
The map cache is keyed on the commit plus a git status cleanliness check, but the walk also lists gitignored files, which git status never reports. A second scan of the same commit can therefore report coverage and a map that describe the earlier tree.
Where
internal/mapper/mapper.go:115-131(Build: cache hit refreshes onlyFiles)internal/gitx/gitx.go:456(IsCleanExcept:git status --porcelain)internal/walk/walk.go:236(the walk does not consult.gitignore)internal/engine/run.go:530-537(recordMapAndLeadswrites the cached summary and "Not read" notes)
Details
Build treats the cache entry for HEAD as valid when gitx.IsCleanExcept says the tree is clean. That command does not list ignored files, and lists no untracked files at all when the operator has status.showUntrackedFiles=no (the base arguments do not pin it). The walk lists ignored files, maps them and writes them into the cache. On a hit only Files is refreshed; FileCount, Languages, Entry, Boundaries, Frameworks, InfraFiles, Tests and Skipped come from the earlier state. The same holds for the --changed path: an ignored file is never in the changed set, so its cached per-file result is reused.
Impact
In agentic mode the planner and investigators start from a stale map (missing or dead entry points and trust boundaries). In every mode the report's coverage numbers and "Not read" notes describe the first scan, while the seeders run on the fresh listing, so the map and the leads disagree. Typical ignored-but-scanned files: generated sources, local config, .env.*, *.tfvars.
Steps to reproduce
- In a git repository at a clean commit with
.gitignorecontaininglocal/, createlocal/big.pylarger than 1 MiB and runspackle scan .. - Replace
local/big.pywith a small web app and addlocal/extra.py.git statusis still clean. - Run
spackle scan .again: the map summary has the old file count, the note still sayslocal/big.pywas not read although the seeders read it, and its route is not an entry point.
Suggested fix
Make the cache key cover what the walk lists, not only the commit. Either ask git for ignored and untracked files too (git status --porcelain --ignored --untracked-files=all, with -c status.showUntrackedFiles=all) and skip the cache when any exist under the root, or store a digest of the listing (relative path, size, mtime of every listed and skipped entry) in the cache file and reject the entry when it differs.
Acceptance criteria
- A test beside
TestCacheIsKeyedByCleanCommitchanges an ignored file between two builds and gets a fresh map - The same with an untracked file and
status.showUntrackedFiles=no - A clean tree with no ignored files still hits the cache
Related: #110, #121
Getting started
- Relevant files: internal/engine/run.go, internal/gitx/gitx.go, internal/mapper/mapper.go, internal/walk/walk.go
- How to run tests:
make test-short(Unix) or.\make.ps1 test-short(Windows PowerShell);make lintbefore you call it done - Related docs: CONTRIBUTING.md, docs/ARCHITECTURE.md
Filed by repo-audit/full-audit at 50e92ec. Severity: medium. Effort: M. audit-key: bug|internal/mapper/mapper.go|Build-cache-ignored
- 主要語言
- Go
- 星號
- 0
- 分支
- 1
- 平均合併
- 8 小時 14 分鐘
- 30 天內合併 PR
- 3
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 提供 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
TMHSDigital/Spackle 的其他 Issue
-
ci good first issue severity: low
難度 2/5 1-3 小時 新手友好度 77/100
TMHSDigital/Spackle#206 ·
維護者通常 1 天內回覆
-
ci severity: low
難度 2/5 1-3 小時 新手友好度 78/100
TMHSDigital/Spackle#205 ·
維護者通常 1 天內回覆
-
bug good first issue severity: low
難度 2/5 1-3 小時 新手友好度 82/100
TMHSDigital/Spackle#199 ·
維護者通常 1 天內回覆
-
bug good first issue severity: low
難度 2/5 1-3 小時 新手友好度 87/100
TMHSDigital/Spackle#195 ·
維護者通常 1 天內回覆
-
documentation good first issue severity: medium
難度 1/5 1 小時以內 新手友好度 90/100
TMHSDigital/Spackle#188 ·
維護者通常 1 天內回覆
查看 TMHSDigital/Spackle 的全部 Issue
相似的 Issue
-
bug effort:s impact:med raised-by:worker risk:low to:worker
難度 2/5 1-3 小時 新手友好度 78/100
medici-finance/assay#8120 · 1 則留言 ·
維護者通常 1 天內回覆
-
factory:subtask
難度 1/5 1 小時以內 新手友好度 72/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 77/100
agent-substrate/substrate#4308 ·
維護者通常 2 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
celestiaorg/celestia-app#8877 ·
維護者通常 1 天內回覆
-
sweep
難度 1/5 1 小時以內 新手友好度 84/100
bketelsen/truenas-mcp#112 ·
維護者通常 1 天內回覆