chore(ci): exclude .claude/worktrees from pyright + gitignore [PYSDK-103]#591
Conversation
…103] 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>
|
There was a problem hiding this comment.
Pull request overview
This PR updates repository tooling configuration to prevent Pyright (and contributors) from picking up Claude Code’s per-session worktrees under .claude/worktrees/, which can contain generated/isolated clones that should not be type-checked or accidentally committed.
Changes:
- Exclude
**/.claude/worktrees/**from Pyright’s filesystem traversal. - 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 exclude to stop type-checking nested agent worktrees. |
.gitignore |
Ignores .claude/worktrees/ while documenting that .claude/settings.json remains intentionally tracked. |
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (63.82%) is below the target coverage (70.00%). You can increase the head coverage or adjust the target coverage. |



🛡️ Implements PYSDK-103 following CC-SOP-01 Change Control, part of our ISO 13485-certified QMS | Ketryx Project.
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 .claudestill returns.claude/settings.json.mypyandruffweren't affected.make auditandmake test_unitwere green either way.Supersedes
This PR replaces #590 (closed unmerged). #590 was opened without going through CC-SOP-01 first — no Jira CR before the branch, no PYSDK key in the branch name, no key in the commit message. Without those, the Jira GitHub App auto-link and smart-commit transitions don't fire. Re-doing here with the proper sequence: ticket-first, PYSDK-103 in branch + commit + PR title.
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