Exclude .claude worktrees from the incumbent-reference live-tree sweep#363
Conversation
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
left a comment
There was a problem hiding this comment.
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 onlyworktrees/— ephemeral agent worktree copies, untracked, never part of the shipped package. No live-tree source lives there.".claude" in path.partsmatches only the literal.claudedirectory component; real source (packages/…,tools/…,docs/…) has no such component and is still fully walked. It cannot accidentally match a file likeclaude.py.- The exclusion is consistent with the existing
.git/.venv/outskips (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.
One-line test fix: the live-tree sweep added in the recent test skips
.git/.venv/outbut 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 allowlistedtest_us_parity_reference.pymentioning 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