Skip to content

chore(ci): exclude .claude/worktrees from pyright + gitignore#590

Closed
helmut-hoffer-von-ankershoffen wants to merge 1 commit intomainfrom
chore/exclude-claude-worktrees-from-pyright
Closed

chore(ci): exclude .claude/worktrees from pyright + gitignore#590
helmut-hoffer-von-ankershoffen wants to merge 1 commit intomainfrom
chore/exclude-claude-worktrees-from-pyright

Conversation

@helmut-hoffer-von-ankershoffen
Copy link
Copy Markdown
Contributor

Why

make lint started 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 .gitignore or git-tracked status), sees the codegen .py files, fails them.

What

Two-line fix:

  • pyrightconfig.json — add **/.claude/worktrees/** to the exclude array.
  • .gitignore — add .claude/worktrees/. Belt-and-braces. Without this, a contributor running git add -A could scoop the worktree dir into a commit.

What this does NOT change

  • .claude/settings.json is 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 .claude returns .claude/settings.json as before.
  • No source-code changes; mypy and ruff weren't affected.
  • make audit and make test_unit were green either way.

Test plan

  • make lint (ruff format + check + pyright + mypy) — green on this branch
  • git ls-files | grep '\.claude' still returns .claude/settings.json
  • CI green

🤖 Generated with Claude Code

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>
@helmut-hoffer-von-ankershoffen helmut-hoffer-von-ankershoffen added skip:test:long_running Skip long-running tests (≥5min) type:ci CI/CD change scope:dev-only Affects only our dev/CI env; consumers unaffected auto-merge Eligible for auto-merge once CI is green labels Apr 25, 2026
Copilot AI review requested due to automatic review settings April 25, 2026 08:56
@helmut-hoffer-von-ankershoffen helmut-hoffer-von-ankershoffen requested a review from a team as a code owner April 25, 2026 08:56
@helmut-hoffer-von-ankershoffen helmut-hoffer-von-ankershoffen added scope:dev-only Affects only our dev/CI env; consumers unaffected auto-merge Eligible for auto-merge once CI is green labels Apr 25, 2026
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@helmut-hoffer-von-ankershoffen
Copy link
Copy Markdown
Contributor Author

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.

helmut-hoffer-von-ankershoffen added a commit that referenced this pull request Apr 25, 2026
…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
Copy link
Copy Markdown

codecov Bot commented Apr 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.
see 19 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge Eligible for auto-merge once CI is green scope:dev-only Affects only our dev/CI env; consumers unaffected skip:test:long_running Skip long-running tests (≥5min) type:ci CI/CD change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants