Repository navigation
Description
Overview
heart/checks/worktree_drift.py::scan treats every directory under the worktree root (~/Code/PyAutoLabs-wt/) as a task worktree. The user's JetBrains project directory ~/Code/PyAutoLabs-wt/.idea is a directory, is claimed by neither active.md nor parked.md, and is therefore reported as an ORPHAN — a permanent, unfixable drift line for something that is not a worktree and never will be. It degrades the Heart worktree-drift surface with pure noise.
Plan
- Skip hidden entries (
namestarting with.) in the wt-root discovery sweep only. - Leave the claimed-path leg untouched: a task whose
worktree:claim genuinely points at a dotted path is still tracked and never reported missing. The filter is about what the sweep discovers, not about what the Mind claims. - Extend
tests/test_worktree_drift.pywith a case placing a.ideadirectory under the wt root beside a genuine unclaimed worktree, asserting only the genuine one is reported as an orphan. - Run
pytest tests/ -qin the task worktree.
Detailed implementation plan
Affected Repositories
- PyAutoHeart (primary)
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./PyAutoHeart | main | clean |
Suggested branch: feature/heart-worktree-drift-hidden-dirs
Implementation Steps
-
heart/checks/worktree_drift.py— inscan(), the wt-root sweepif wt_root.is_dir(): for entry in sorted(wt_root.iterdir()): if entry.is_dir(): note(entry, entry.name)
gains a hidden-name guard so dot-directories are not noted as discovered worktrees. The
for c in active_claims + parked_claims: note(...)loop below it is deliberately left alone. -
Module docstring — record that the wt-root sweep skips hidden dirs and why the claims leg does not.
-
tests/test_worktree_drift.py— addtest_hidden_dirs_under_wt_root_are_not_orphans: a.ideadirectory (with a plausible child) beside a real unclaimed worktree under the wt root; assertorphansnames exactly the real one, and thaton_disk_countcounts one.
Key Files
heart/checks/worktree_drift.py—scan()wt-root enumeration (~line 107)tests/test_worktree_drift.py— existing categorisation tests over synthetic trees
Original Prompt
Click to expand starting prompt
heart/checks/worktree_drift.py (line 107, /Code/PyAutoLabs-wt/) as a task worktree, so the user's JetBrains for entry in sorted(wt_root.iterdir()): if entry.is_dir(): note(entry, entry.name)) treats every directory under the worktree root (.idea project dir is reported as an orphan and degrades Heart readiness. Fix: skip hidden directories (name starts with "."). Extend the existing worktree_drift test in PyAutoHeart/tests/ (find it) with a case where a .idea dir sits under the wt root beside a real orphan and assert only the real one is reported.
Activity
Jammy2211 commentedon Sep 4, 2026
Library PR Created
PR: #200 (
feature/heart-worktree-drift-hidden-dirs, labelpending-release)Discovery under the wt root now skips hidden names; the claims leg is untouched so
.codex-worktrees/<task>claims still track.pytest tests/ -qin the task worktree: 681 passed in 60.09s1 failed, 9 passed,'.idea' != 'mystery')orphans: [](was['.idea'])Workspace impact: (iii) none.
heart/checks/worktree_drift.pyis Heart-internal, monitoring-only, and imported by nothing outside PyAutoHeart;scan()'s signature and return shape are unchanged. No workspace script or downstream library reads it.Heart readiness at ship time was RED on
release validation FAILED (stage integrate)— pre-existing, unrelated to this branch, and already owned byprofiles-jit-powerlaw-exact-zero-atol. The run ends at PR-open; merge stays human.Jammy2211 commentedon Sep 4, 2026
Shipped
Merged in #200 (merge commit
911d7740).heart/checks/worktree_drift.py::scannow skips hidden directory names when itdiscovers worktrees under the wt root, so
~/Code/PyAutoLabs-wt/.idea(and anyother tool's dotted dir) stops being reported as a permanent ORPHAN.
The claims leg is deliberately untouched:
active.md/parked.mdclaims still gothrough
note()unconditionally, so a task whoseworktree:genuinely points at adotted path (
PyAutoLabs/.codex-worktrees/<task>) is still tracked and neverreported MISSING. The filter governs what the sweep discovers, not what the Mind
claims.
Two tests added to
tests/test_worktree_drift.py:test_hidden_dirs_under_wt_root_are_not_orphans— a.ideadir beside a genuineunclaimed worktree; only the genuine one is an orphan.
test_hidden_dir_that_is_explicitly_claimed_is_still_tracked— the regressionguard for the leg that was not filtered.
CI green on both pytest legs for
c9d3c89f;pytest tests/ -qwas681 passedin the task worktree, and the new test fails without the guard.