Skip to content

chore(ci): exclude .claude/worktrees from pyright + gitignore [PYSDK-103]#591

Merged
helmut-hoffer-von-ankershoffen merged 1 commit intomainfrom
chore/PYSDK-103-exclude-claude-worktrees-from-pyright
Apr 25, 2026
Merged

chore(ci): exclude .claude/worktrees from pyright + gitignore [PYSDK-103]#591
helmut-hoffer-von-ankershoffen merged 1 commit intomainfrom
chore/PYSDK-103-exclude-claude-worktrees-from-pyright

Conversation

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

@helmut-hoffer-von-ankershoffen helmut-hoffer-von-ankershoffen commented Apr 25, 2026

🛡️ Implements PYSDK-103 following CC-SOP-01 Change Control, part of our ISO 13485-certified QMS | Ketryx Project.

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 still returns .claude/settings.json.
  • No source-code changes; mypy and ruff weren't affected.
  • make audit and make test_unit were 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 branch
  • git ls-files | grep '\.claude' still returns .claude/settings.json
  • CI green

🤖 Generated with Claude Code

…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>
Copilot AI review requested due to automatic review settings April 25, 2026 09:02
@helmut-hoffer-von-ankershoffen helmut-hoffer-von-ankershoffen requested a review from a team as a code owner April 25, 2026 09:02
@helmut-hoffer-von-ankershoffen helmut-hoffer-von-ankershoffen added skip:test:long_running Skip long-running tests (≥5min) sop:cc-sop-01 CC-SOP-01 Change Control (feature / planned change) 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
@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

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.

@helmut-hoffer-von-ankershoffen helmut-hoffer-von-ankershoffen merged commit 206adde into main Apr 25, 2026
33 of 34 checks passed
@helmut-hoffer-von-ankershoffen helmut-hoffer-von-ankershoffen deleted the chore/PYSDK-103-exclude-claude-worktrees-from-pyright branch April 25, 2026 09:04
@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.

❌ 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.
see 20 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) sop:cc-sop-01 CC-SOP-01 Change Control (feature / planned change) type:ci CI/CD change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants