fix: env doctor はリンク先のリポジトリで除外設定を判定する - #95
Merged
Merged
Conversation
`projects/<name>` がプラグイン経由で別リポジトリへのシンボリックリンクに なっている環境では、`git check-ignore --no-index -- projects/<name>/.env` が `fatal: pathspec ... is beyond a symbolic link` で 128 を返す。doctor はこれを 「git が無い、または Git リポジトリではありません」と報告し、そこで残りの 点検も打ち切っていた。実際には Git も devbase も正常で、診断だけが誤っていた。 リンクを解いた実体から所属リポジトリを引き直し、そのリポジトリからの相対パスで 判定する。問うている内容 (この平文はコミットされうるか) は変えず、判定先だけを 実際にそのファイルを管理しているリポジトリへ移す。除外されていない場合は実体の 位置も報告に添え、どちらの .gitignore を直せばよいか分かるようにした。 あわせて、1 件でも判定できなかった時点で打ち切る挙動をやめ、確かめられなかった パスをまとめて注意として報告するようにした。打ち切ると、確かめられるはずの パスの漏れまで見逃す。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
背景
PLAN35 (#90) で追加した
devbase env doctorの除外設定チェックが、プラグイン経由でプロジェクトを取り込んでいる環境で常に誤報していた。実際には git も入っており、
DEVBASE_ROOTも Git リポジトリである。原因
projects/<name>がプラグイン経由で別リポジトリへのシンボリックリンクになっている場合、DEVBASE_ROOTを作業ディレクトリにしたgit check-ignoreはリンクを越えたパスを拒む。_git_check_ignoreは 0/1 以外を「判定できない」としてNoneを返し、_check_gitignoreは最初のNoneで警告を出してreturnしていたため、の 2 点が起きていた。
変更
check-ignoreを実行する (_probe_location)。リンク先の平文を除外できているかを決めるのはリンク先リポジトリの.gitignoreなので、判定先を移すのが正しい。問うている内容 (この平文はコミットされうるか) は変えていないprojects/x/.env → /path/to/other-repo/projects/x/.envの形で実体の位置も報告し、どちらの.gitignoreを直すべきか分かるようにした_MAX_LISTEDとして既存箇所と共有テスト
追加 3 件:
test_doctor_checks_symlinked_projects_in_their_own_repository.envを除外していれば警告なしで通るtest_doctor_reports_linked_projects_that_are_not_ignoredtest_doctor_keeps_checking_after_an_undeterminable_pathuv run pytest— 1229 passeduvx ruff check --select=E9,F63,F7,F82 lib tests— pass (CI と同条件)実環境での確認
42 プロジェクトすべてが symlink の環境で、修正前は注意 3 件(うち 1 件が本誤報)→ 修正後は誤報が消えて注意 2 件(退避平文と旧控えファイルの案内のみ)になることを確認済み。
🤖 Generated with Claude Code