Repository navigation
fix: skip hidden dirs when discovering task worktrees - #200
Merged
Merged
Conversation
`worktree_drift.scan` enumerated every directory under the wt root as a task worktree. `~/Code/PyAutoLabs-wt/.idea` — the user's JetBrains project dir — is a directory, is claimed by neither active.md nor parked.md, and was therefore reported as an ORPHAN on every tick: drift no one can ever clear, for something that is not a worktree and never will be. Discovery now skips hidden names. The claims leg is deliberately untouched: an explicit `worktree:` claim on a dotted path (`.codex-worktrees/<task>`) is still noted, so it is neither dropped from `on_disk` nor reported missing. The filter is about what the sweep *discovers*, not what the Mind *claims*. Two tests: the `.idea`-beside-a-real-orphan case (fails without the guard — `orphans` came back `['.idea', 'mystery']`), and a regression guard proving a claimed dotted path still tracks. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GnXNPigN6qWxLZy2cqhDBX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #198.
heart/checks/worktree_drift.py::scanenumerated every directory under the worktree root as a task worktree:The wt root is an ordinary directory that the user's other tools also write into — JetBrains puts its project dir at
~/Code/PyAutoLabs-wt/.idea. That directory is claimed by neitheractive.mdnorparked.md, so it was reported as an ORPHAN on every tick: permanent drift no one can ever clear, for something that is not a worktree and never will be.Discovery now skips hidden names (
entry.name.startswith(".")).The claims leg is deliberately untouched.
for c in active_claims + parked_claims: note(...)still runs unconditionally, so a task whoseworktree:genuinely points at a dotted path —PyAutoLabs/.codex-worktrees/<task>, the case the path-test in #123 exists for — is still noted, still counted inon_disk, and still never reported MISSING. The filter governs what the sweep discovers, not what the Mind claims.API Changes
None.
scan()'s signature and return shape are unchanged; only which directories it discovers under the wt root. The check is monitoring-only (heart/checks/worktree_drift.pydocstring) and never a readiness reason, so the readiness verdict is untouched either way.Test Plan
pytest tests/ -qin the task worktree —681 passed in 60.09sstartswith(".")guard and re-runningtests/test_worktree_drift.py:1 failed, 9 passed, withAt index 0 diff: '.idea' != 'mystery'— i.e. the guard is what the assertion is measuring, not incidental..idea:orphans: [],on_disk_count: 7(before:.ideawas in the orphan list).Two tests added to
tests/test_worktree_drift.py:test_hidden_dirs_under_wt_root_are_not_orphans— a.ideadir (with aworkspace.xmlchild) beside a genuine unclaimed worktree; assertsorphansnames only the genuine one andon_disk_count == 1.test_hidden_dir_that_is_explicitly_claimed_is_still_tracked— a claimed.codex-worktrees/some-task; assertsmissing == [],orphans == [],on_disk_count == 1. This is the regression guard for the leg that was not filtered.Heart gate
pyauto-heart readiness --jsonat ship time was RED for a reason unrelated to this branch and pre-dating it:release validation FAILED (stage integrate)(red) — already owned by the active taskprofiles-jit-powerlaw-exact-zero-atol(autolens_workspace_test#291/docs: list autofit_inference + autofit_profiling as excluded (search-extensibility B1) #292)PyAutoArray: open PR 12d old(yellow)This PR is opened, not merged. Merge stays a human decision and should wait on that RED clearing or an explicit human call.
🤖 Generated with Claude Code
https://claude.ai/code/session_01GnXNPigN6qWxLZy2cqhDBX