Skip to content

Exclude .claude worktrees from the incumbent-reference live-tree sweep#363

Merged
MaxGhenis merged 1 commit into
mainfrom
claude-dir-test-exclusion
Jul 9, 2026
Merged

Exclude .claude worktrees from the incumbent-reference live-tree sweep#363
MaxGhenis merged 1 commit into
mainfrom
claude-dir-test-exclusion

Conversation

@daphnehanse11

Copy link
Copy Markdown
Collaborator

One-line test fix: the live-tree sweep added in the recent test skips .git/.venv/out but not .claude, so local runs with Claude Code worktrees under .claude/worktrees/ (checkouts of sibling branches) fail on files those branches legitimately carry — e.g. the allowlisted test_us_parity_reference.py mentioning the retired data package, at a worktree-relative path the allowlist can't match. CI checks out a clean tree and never hits this; only local development breaks.

🤖 Generated with Claude Code

The sweep walks ROOT.rglob and skips .git/.venv/out but not .claude, so
any contributor running Claude Code worktrees (checkouts of sibling
branches under .claude/worktrees/) fails the test on files those
branches are allowed to have — e.g. the allowed parity-reference test
mentioning policyengine-us-data, at a relative path the allowlist
cannot match. CI never sees the directory; only local runs break.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@MaxGhenis MaxGhenis left a comment

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.

Approve

Verified the exclusion is correctly scoped and does not blind the check to any live-tree content.

Root cause confirmed. test_no_incumbent_data_package_references_in_live_tree walks ROOT.rglob("*"), which descends into .claude/worktrees/<agent>/ — the conductor's worktree snapshots. That snapshot carries a stale tools/modal_rebuild_us_sparse.py containing policyengine-us-data, at a path (.claude/worktrees/.../tools/modal_rebuild_us_sparse.py) that is not in allowed_incumbent_references, so it was flagged as an offender. The live tree has no such file at root, which is why CI stays green (no .claude/worktrees/ in a clean checkout) while the test fails locally under conductor worktrees.

Exclusion is scoped, not blinding.

  • .claude/ on disk contains only worktrees/ — ephemeral agent worktree copies, untracked, never part of the shipped package. No live-tree source lives there.
  • ".claude" in path.parts matches only the literal .claude directory component; real source (packages/…, tools/…, docs/…) has no such component and is still fully walked. It cannot accidentally match a file like claude.py.
  • The exclusion is consistent with the existing .git / .venv / out skips (all non-source dirs) and mirrors the same intent.

Reformat is a no-op. Collapsing the two split string literals in allowed_incumbent_references onto single lines is implicit-concatenation-preserving — the resulting paths are byte-for-byte identical, both lines are ≤88 chars, and they still exactly match the three real reference files on disk.

CI: test (3.13/3.14) and wheels (3.13/3.14) all pass; MERGEABLE / CLEAN.

Non-blocking suggestion for a future pass: walking git ls-files instead of rglob + a hand-maintained skip list would auto-exclude every untracked scratch dir (worktrees, caches, build output) and remove the need to grow this list. Not needed for this PR — the current fix matches the file's established pattern.

@MaxGhenis MaxGhenis merged commit aa79f03 into main Jul 9, 2026
4 checks passed
@MaxGhenis MaxGhenis deleted the claude-dir-test-exclusion branch July 9, 2026 12:44
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.

2 participants