This repository was archived by the owner on Sep 28, 2026. It is now read-only.
Repository navigation
修复 doctor 对嵌套源 Git 生效门禁的假阴性 - #14
Merged
Merged
Conversation
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
问题与范围
注册源可以是 Git 仓内的嵌套知识目录。此前 doctor 只看 source 根的 lefthook/precommit 配置,即使父仓实际生效的 pre-commit 已执行
rhizome check,gate-present 仍失败。本 PR 仅修改 README、src/rhizome/doctor.py、tests/test_doctor.py;不改 registry、hook 安装、PATH、uv 环境或依赖。
实现与静态边界
git -C <source> rev-parse --path-format=absolute --git-path hooks/pre-commit获取唯一生效路径,不猜 .githooks 或 source/.git。支持嵌套源、linked worktree、相对/绝对 core.hooksPath;被覆盖的 .git/hooks 不得提供假证据。rhizome check或exec rhizome check,支持引号参数及行尾注释。注释/echo/近似命令不算;heredoc、跨行引号保守失败。不追踪任意 shell wrapper,不证明条件可达性,也不升级为全面 hook enforcement 审计。已实际验证
python -m rhizome.cli doctor --sources --json,临时 registry + 嵌套 Git source + INDEX:旧 base exit 1 / gate FAIL,修后 exit 0 / gate PASS;切换 hooksPath 至不存在目录后 exit 1 / gate FAIL。未执行 fixture hook;临时目录已清理。Windows 完整测试的真实限制(未删失败项)
C:\Users\...原样插入 TOML 双引号字符串,触发tomllib.TOMLDecodeError: Invalid hex value (at line 1, column 23),派生 CLI exit 2 断言失败。.git/hooks/pre-commit: line 4: C:Workspacerhizome.venvScriptspython.exe: command not found;另有冻结 HEAD 判定失败。_wrapper_rhizome_check的 C901 (11 > 10) 失败:实际 job 日志。单独 commit4e90ce7仅删除两行重复注释过滤分支;已有锚定run:的正则本就排除注释,不改变旧 wrapper 语义。真实 wrapper throwaway 验证 active 命中、普通/缩进注释均不命中。本地 canonical Ruff 全仓通过,format 检查 29 文件全部通过;未添加 noqa 或改规则。合入与部署验收
只在最终 head 的真实 Linux CI 等适用检查全部成功后,按匹配 head SHA 合入。正常 PATH rhizome 已确认 editable 指向 C:/Workspace/rhizome;合后仅在该主目录 clean 且可 fast-forward 时同步 merge SHA,再用正常 PATH 命令对当前 desk/knowledge 做只读 post gate-present 验收。不重跑已知生产 pre 假阴性,不把隔离 CLI 结果当作日用命令已修复。
最终验收
4e90ce79b800500a20233bf2ca1f4dc896ff9864:10 项检查 SUCCESS,3 项 Release 条件检查 SKIPPED(build-library、publish、fleet-e2e);无失败或待运行检查。--match-head-commit 4e90ce79b800500a20233bf2ca1f4dc896ff9864合入,回读状态 MERGED,merge SHAc2df9d7bb2121646f9aa7ef1cc21cc0e4b55209b。--ff-only至 merge SHA,未更换安装、PATH 或 uv 环境。rhizome doctor --sources --json(无 PYTHONPATH、registry 覆盖)只读验收:exit 0,knowledge.ok=true;gate-present=pass,证据路径为 C:/Workspace/desk/.githooks/pre-commit;gate-resolvable、index-present 均 pass。原有 notes 39 篇的 domain-capacity WARN 仍如实保留。仅在此次调用关闭 telemetry/bytecode 写入,未改全局环境。