Skip to content

docs: help agents unblock golangci-lint cross-worktree cache contamination - #6584

Open
janniklasrose wants to merge 2 commits into
mainfrom
janniklasrose/lint-cache-agent-doc
Open

docs: help agents unblock golangci-lint cross-worktree cache contamination#6584
janniklasrose wants to merge 2 commits into
mainfrom
janniklasrose/lint-cache-agent-doc

Conversation

@janniklasrose

Copy link
Copy Markdown
Member

What

Adds a note to AGENTS.md (Development Tips) describing golangci-lint's cross-worktree results-cache contamination: the symptom (phantom task lint failures pointing at files in another/deleted *.worktrees/* path, plus no such file or directory warnings), the cause, and the one-line fix (golangci-lint cache clean).

Why

golangci-lint's results cache is machine-global and shared across worktrees. It keys entries on file contents but stores each issue's absolute path, so a worktree with byte-identical packages (usually the near-static tools/ module) gets a cross-worktree cache hit and inherits another worktree's paths. If that worktree was deleted, the //nolint post-processor can't reopen the paths to apply suppressions, so suppressed issues leak through as phantom failures. This is golangci/golangci-lint#6656, closed as an accepted trade-off (won't-fix).

This is a rare, known upstream issue. Rather than work around it in the Taskfile (superseding #5925, which is being closed), this simply documents the symptom and fix so an agent that hits it recognizes it immediately instead of investigating the phantom issues as a real problem.

This pull request and its description were written by Isaac.

…ontamination

golangci-lint's results cache is machine-global and shared across worktrees.
It keys entries on file contents but stores each issue's absolute path, so a
worktree with byte-identical packages (usually the near-static tools/ module)
gets a cross-worktree cache hit and inherits another worktree's paths. When
that worktree was deleted, the //nolint post-processor can't reopen the paths
to apply suppressions, so suppressed issues leak through as phantom lint
failures pointing at a gone path.

This is a rare, known upstream trade-off (golangci/golangci-lint#6656,
won't-fix). Rather than working around it in the Taskfile, document the
symptom and the one-line fix (`golangci-lint cache clean`) in AGENTS.md so an
agent that hits it recognizes it immediately instead of investigating the
phantom issues as a real problem.

Co-authored-by: Isaac <no-reply@databricks.com>
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 643e121

Run: 34347537388

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux 1 275 15 5:43
💚​ aws windows 1 277 13 5:12
💚​ azure linux 1 274 15 7:03
💚​ azure windows 1 276 13 8:41
💚​ gcp linux 1 275 15 5:37
💚​ gcp windows 1 277 13 5:38
Test Name aws linux aws windows azure linux azure windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 6 slowest tests (at least 2 minutes):
duration env testname
5:35 gcp windows TestAccept
3:49 aws windows TestAccept
3:44 azure windows TestAccept
2:14 aws linux TestAccept
2:13 gcp linux TestAccept
2:08 azure linux TestAccept

Comment thread AGENTS.md Outdated
- Use `./task test-update` to regenerate acceptance test outputs after changes.
- The CLI binary supports both `databricks` and `pipelines` command modes based on executable name.

**If `task lint` reports issues in files from a *different* worktree — paths under another `*.worktrees/*` directory, often one that no longer exists, typically alongside `no such file or directory` warnings — it is stale-cache contamination, not a real problem with your code. Clear the cache and re-run; do not investigate the reported issues.** golangci-lint's results cache is machine-global (`~/.cache/golangci-lint` on Linux, `~/Library/Caches/golangci-lint` on macOS) and shared across every worktree. It keys entries on file *contents* but stores each cached issue's *absolute* path, so a worktree whose packages are byte-identical to another's (usually the near-static `tools/` module) gets a cross-worktree cache hit and inherits the other worktree's paths. When that worktree was deleted, the `//nolint` post-processor can't reopen those paths to apply suppressions, so suppressed issues (e.g. `dupword`) leak through as phantom failures. This is [golangci/golangci-lint#6656](https://github.com/golangci/golangci-lint/issues/6656), closed as an accepted trade-off (won't-fix) of the shared-cache work in #6445. To unblock yourself:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move the analysis of the problem to a separate file for posterity?

These are expensive tokens.

@janniklasrose janniklasrose Sep 9, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably sufficient to keep it in the PR descriptions (this and linked #5925), which is git blame-able. Slimmed down now

AGENTS.md is always in context, so drop the background (cause, upstream
issue link) and keep just what an agent needs: what surfaces the phantom
failures and the one-line command to clear the cache.

Co-authored-by: Isaac <no-reply@databricks.com>
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.

3 participants