chore(ci): exclude .claude/worktrees from pyright + gitignore#590
chore(ci): exclude .claude/worktrees from pyright + gitignore#590helmut-hoffer-von-ankershoffen wants to merge 1 commit intomainfrom
Conversation
Pyright was recursing into local Claude Code agent worktree dirs at `.claude/worktrees/<random-name>/` and reporting type errors from the nested codegen output, causing `make lint` to fail in working trees that have an in-flight Claude Code background session. Worktrees are per-developer ephemeral state, not source code. Two-line fix: - pyrightconfig.json: add `**/.claude/worktrees/**` to exclude - .gitignore: add `.claude/worktrees/` (belt-and-braces; without this a `git add -A` could accidentally scoop the worktree dir into a commit) Note: .claude/settings.json is intentionally tracked (it pins the aignostics/claude-plugins qms plugin per PYSDK-96 #582); the gitignore entry is narrow and does not affect that file. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
There was a problem hiding this comment.
Pull request overview
Fixes local make lint failures caused by Pyright recursively analyzing Claude Code session worktrees under .claude/worktrees/, which can contain generated code unrelated to the repo’s source.
Changes:
- Exclude
**/.claude/worktrees/**from Pyright’s file discovery. - Ignore
.claude/worktrees/in git to prevent accidental commits of agent worktrees.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
pyrightconfig.json |
Adds .claude/worktrees to Pyright’s exclude list to avoid analyzing nested worktrees. |
.gitignore |
Ignores .claude/worktrees/ while explicitly noting that .claude/settings.json remains tracked. |
|
Closing without merging. This PR was opened without the CC-SOP-01 process: no Jira CR opened first, no PYSDK-N key in the branch name, no key in the commit message. Re-doing on a properly-named branch with a CR opened up-front. The two-line change (pyrightconfig.json exclude + .gitignore for .claude/worktrees) will be re-submitted as a new PR. |
…103] (#591) Pyright was recursing into local Claude Code agent worktree dirs at `.claude/worktrees/<random-name>/` and reporting type errors from the nested codegen output, causing `make lint` to fail in working trees that have an in-flight Claude Code background session. Worktrees are per-developer ephemeral state, not source code. Two-line fix: - pyrightconfig.json: add `**/.claude/worktrees/**` to exclude - .gitignore: add `.claude/worktrees/` (belt-and-braces; without this a `git add -A` could accidentally scoop the worktree dir into a commit) Note: .claude/settings.json is intentionally tracked (it carries the aignostics/claude-plugins qms plugin pin from PYSDK-96 / #582); the gitignore entry is narrow (`/worktrees/` only) and does not affect that file. Supersedes PYSDK-102, which was a retroactive CR opened on PR #590 (closed unmerged). #590's branch and commit message did not contain the PYSDK key — CC-SOP-01 requires the key in both for the Jira GitHub App auto-link and smart-commit transitions to work. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. |



Why
make lintstarted failing locally for anyone with an in-flight Claude Code background session in this repo. Pyright recurses into.claude/worktrees/<session>/(a local agent worktree directory containing a full clone with codegen output) and reports type errors from nested generated code that isn't part of our source.Repro: any working tree where Claude Code has spawned an isolated worktree under
.claude/worktrees/. Pyright walks the filesystem (it doesn't honour.gitignoreor git-tracked status), sees the codegen.pyfiles, fails them.What
Two-line fix:
pyrightconfig.json— add**/.claude/worktrees/**to theexcludearray..gitignore— add.claude/worktrees/. Belt-and-braces. Without this, a contributor runninggit add -Acould scoop the worktree dir into a commit.What this does NOT change
.claude/settings.jsonis still tracked (it carries the project-wide plugin pin from chore: enable aignostics/claude-plugins qms plugin project-wide [PYSDK-96] #582 / PYSDK-96). The gitignore entry is narrow (/worktrees/only) and does not affect that file. Verified:git ls-files | grep .claudereturns.claude/settings.jsonas before.mypyandruffweren't affected.make auditandmake test_unitwere green either way.Test plan
make lint(ruff format + check + pyright + mypy) — green on this branchgit ls-files | grep '\.claude'still returns.claude/settings.json🤖 Generated with Claude Code