fix(tests): derive the retired-invocation guard's file list from git - #119
Merged
Merged
Conversation
The guard walked the filesystem with rglob, so on the main checkout it read gitignored working material: tmp/context/** holds `git archive` exports of pre-retirement revisions, every one of which names the retired tools legitimately. Fourteen such lines made `pytest` fail on main while passing in every worktree. That asymmetry is the part worth recording. A worktree structurally lacks both of the directories that break this guard - it has no tmp/, and the nested .claude/worktrees/ only exists under the main checkout - and every gate run for C6, D5 and D6a was made inside a worktree. The guard could not see the thing that breaks it from the place we always ran it. Derive the list from git instead: tracked plus untracked-not-ignored. Untracked-not-ignored is included deliberately, because a newly written file is exactly the case this guard exists for and it is usually not staged yet. Gitignored files become invisible, which is the intent - they are not the codebase - and that limit is now stated in the docstring alongside the other one it already cannot see, invocation strings composed at runtime. The precedent is in the repo: the caller census added in D6a derives from git for these same two reasons, and its docstring names both. This guard predates it and had not learned the lesson. Teeth verified rather than assumed: a new untracked-not-ignored file naming a retired invocation turns it red, removing it turns it green, and a gitignored file leaves it green as documented. Gates on the main checkout: 2705 passed / 1 skipped (was 1 failed), ruff clean, phase0 anchor ic 0.9600 / annual 0.8408, 32/32 configs, frozen baseline 77/77.
This was referenced Jul 31, 2026
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.
main上pytest是红的(1 failed),而每个 worktree 里都是绿的。本 PR 修根因。症状与机制
test_no_new_file_starts_instructing_people_to_run_a_retired_tool用repo.rglob("*")走文件系统,排除表只有("docs/progress/", ".git/", "tests/")。于是它读进了 gitignored 的工作材料:tmp/context/**里存着评审用git archive导出的退役之前的仓库副本——其中每一处命名退役工具都是合法的。14 行这样的命中让pytest在主 checkout 上失败。值得记的是那个不对称
worktree 结构性地缺少两个会打破这个守卫的目录:它没有
tmp/,而嵌套的.claude/worktrees/只存在于主 checkout 之下。而 C6、D5、D6a 的每一次 gate 都跑在 worktree 里。修法
文件清单从 git 派生:tracked ∪ untracked-not-ignored。
先例就在仓库里:D6a 新加的 caller census 正是为同样两条理由从 git 派生,其 docstring 两条都写了。这个守卫比它早,还没学到那一课。
牙是验过的,不是假定的
Gates(主 checkout,就是此前会红的那个地方)
pytest -p no:warnings2705 passed / 1 skipped(此前1 failed)·ruffclean · phase0 锚 ic 0.9600 / annual 0.8408 ·validate-config32/32 ·exec_baseline_freeze --verify77/77 @ 45c14aa · 改动仅tests/test_hand_anchor_record.py(+25/−3)