Skip to content

fix: isAncestor判定でパス境界を考慮していない問題を修正#867

Merged
YusukeHirao merged 5 commits intodevfrom
claude/fix-pathlisttotree-ancestor-02h1o
Mar 24, 2026
Merged

fix: isAncestor判定でパス境界を考慮していない問題を修正#867
YusukeHirao merged 5 commits intodevfrom
claude/fix-pathlisttotree-ancestor-02h1o

Conversation

@YusukeHirao
Copy link
Copy Markdown
Member

Summary

  • pathListToTreeisAncestor 判定で、startsWith のみの判定だったため /foo/bar.html/foo/bar_baz.html の祖先と誤判定される問題を修正
  • 祖先になり得るのはディレクトリ(stemが / で終わるノード)のみであるため、url.stem.endsWith('/') チェックを追加
  • イシューの再現ケースをテストに追加

Closes #866

Test plan

  • 既存テスト19件すべて合格
  • 新規テスト(兄弟プレフィックスで誤判定しないこと)を追加し合格
  • lint クリア

https://claude.ai/code/session_01KTVELzSgVqvC97KB73S6RF

claude added 2 commits March 24, 2026 04:33
祖先になり得るのはディレクトリ(stemが'/'で終わるノード)のみであるため、
startsWith判定の前にurl.stem.endsWith('/')を追加。
これにより /foo/bar.html が /foo/bar_baz.html の祖先と誤判定される問題を修正。

Closes #866

https://claude.ai/code/session_01KTVELzSgVqvC97KB73S6RF
@YusukeHirao YusukeHirao changed the base branch from main to dev March 24, 2026 04:37
claude added 3 commits March 24, 2026 04:39
- 同名プレフィックスのディレクトリとファイルが共存するケース
- currentPathがルートの場合
- 深いネストでの祖先チェーン検証

https://claude.ai/code/session_01KTVELzSgVqvC97KB73S6RF
hasConfigFileガード内ではlistfileは必ず存在するため
非nullアサーション(!)が正しい。削除するとTS2345エラーになる。

https://claude.ai/code/session_01KTVELzSgVqvC97KB73S6RF
@YusukeHirao YusukeHirao merged commit 28b0e81 into dev Mar 24, 2026
2 checks passed
@YusukeHirao YusukeHirao deleted the claude/fix-pathlisttotree-ancestor-02h1o branch March 24, 2026 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pathListToTree: isAncestor の startsWith 判定がパス境界を考慮していない

2 participants