Skip to content

fix(workspaceindex): skip common build-cache dirs (target, __pycache__, .venv, ...) - #6

Merged
FabioLeitao merged 3 commits into
mainfrom
fix/workspaceindex-skip-common-build-cache-dirs
Oct 2, 2026
Merged

FabioLeitao merged 3 commits into
mainfrom
fix/workspaceindex-skip-common-build-cache-dirs

Conversation

@FabioLeitao

Copy link
Copy Markdown
Owner

What

ShouldSkipDir's denylist was missing several directory names that are build
output or cache in virtually every ecosystem (target, __pycache__,
.venv/venv, .pytest_cache, .terraform, .mypy_cache, .ruff_cache),
so the fixed MaxFiles scan budget could be burned on them before reaching
real source.

Why / evidence

Against a real multi-crate Rust repo, rust/*/target/debug/.fingerprint/*
alone produced 308 .d/.rlib/.rmeta/.timestamp files. Concretely:

$ zero repo-map --query "otel stdout stderr" --max-files 15   # before fix
# 15/15 results: target/debug/.fingerprint/* build-cache noise, zero real source

$ zero repo-map --query "otel stdout stderr" --max-files 15   # after fix
# 11/15 results: real source (rust/kp-otel/src/lib.rs, bin/kp-otel, docs/man/kp-otel.1, ...)

Tests

  • ShouldSkipDir unit coverage for the new names (incl. case/whitespace-insensitivity)
  • End-to-end Scan() case reproducing the target/debug/.fingerprint/* scenario
  • Confirmed the new test fails without the fix, for the claimed reason (ShouldSkipDir("target")=false want true)

Verification (AGENTS.md §3)

  • make fmt-check
  • make vet
  • go test ./internal/workspaceindex/... (and full regression-proof cycle)
  • go run ./cmd/zero-release build
  • go run ./cmd/zero-release smoke
  • gosec ./internal/workspaceindex/... — 0 issues
  • govulncheck ./internal/workspaceindex/... — no vulnerabilities
  • gitleaks detect --no-git — no leaks
  • git diff HEAD --check — clean
  • make lint-static — reports 4 pre-existing staticcheck findings in internal/proxydial and internal/tools, both untouched by this change. Left alone per AGENTS.md §3/§4 ("unrelated pre-existing advisory findings do not justify expanding a focused pull request").

Upstream

Reported as Twigpine#1108 (repo renamed from
Gitlawb/zero — confirmed via gh api, not just the redirect). This PR
targets my own fork for now; I'll open the upstream PR once/if that issue
gets the issue-approved label, per CONTRIBUTING.md's community-PR process.

🤖 Generated with Claude Code

https://claude.ai/code/session_012f6peupAXjUTeqdEZKFh7e

…_, .venv, ...)

ShouldSkipDir's denylist was missing several directory names that are build
output or cache in virtually every ecosystem, so the fixed MaxFiles scan
budget was burned on them before reaching real source. Against a real
multi-crate Rust repo, rust/*/target/debug/.fingerprint/* alone produced 308
.d/.rlib/.rmeta/.timestamp files that outranked the actual source file a
repo-map query was looking for (15/15 top results were build-cache noise,
zero real source).

Adds: target, __pycache__, .venv, venv, .pytest_cache, .terraform,
.mypy_cache, .ruff_cache.

Regression tests: ShouldSkipDir unit coverage for the new names (incl.
case/whitespace-insensitivity) plus an end-to-end Scan() case reproducing
the target/debug/.fingerprint/* scenario.

Verified locally: go test (fails without the fix, for the claimed reason;
passes with it), go vet, gosec (0 issues), govulncheck (no vulnerabilities),
gitleaks (no leaks), go run ./cmd/zero-release build + smoke (pass), git diff
--check. golangci-lint lint-static reports 4 pre-existing staticcheck findings
in internal/proxydial and internal/tools, both untouched by this change --
left alone per AGENTS.md ('unrelated pre-existing advisory findings do not
justify expanding a focused pull request').

Reported upstream as Twigpine#1108 (repo
renamed from Gitlawb/zero). Will follow CONTRIBUTING.md's community-PR
process (parent issue + issue-approved label) before opening a PR against
upstream; this commit lands on the fork in the meantime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012f6peupAXjUTeqdEZKFh7e
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Zero automated PR review

Verdict: No blockers found

Blockers

  • None found.

Validation

  • [pass] Diff hygiene: git diff --check
  • [pass] Tests: go test ./...
  • [pass] Build: go run ./cmd/zero-release build
  • [pass] Smoke build: go run ./cmd/zero-release smoke

Scope

Head: c4809b12cf59
Changed files (3): internal/repomap/repomap_test.go, internal/workspaceindex/workspaceindex.go, internal/workspaceindex/workspaceindex_test.go

This deterministic review checks validation status and basic diff hygiene. A human reviewer still owns product judgment and design quality.

FabioLeitao and others added 2 commits October 2, 2026 00:25
TestScanDoesNotFollowSymlinkedDirectories used a real directory called 'target'
as the symlink destination. workspaceindex.ShouldSkipDir now (correctly) skips
'target' (Cargo build output), so the real directory was skipped and the test
failed on 'want [main.go target/hidden.go]'. The directory name is incidental to
what the test checks (a symlink must not be followed; the real dir must be
scanned), so rename it to 'real-dir'.

Caught by comparing 'go test ./...' on main against this branch: no new
failures remain; the other six failures are identical on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012f6peupAXjUTeqdEZKFh7e
@FabioLeitao
FabioLeitao merged commit 816846e into main Oct 2, 2026
9 checks passed
FabioLeitao added a commit that referenced this pull request Oct 5, 2026
… ShouldSkipDir untouched

Replaces fork PRs #6/#7 with fix/1108-scan-ignored-dirs, the shape the
maintainer approved on Twigpine#1108: git's ignored set inside a
work tree, a fixed build/cache list only outside one, both confined to
workspaceindex.Scan so glob, grep, list_directory and autocomplete keep
seeing target/, .venv/ and friends. Conflicts resolved to the rework;
workspaceindex, repomap test and workspaceseed now match that branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant