Skip to content

fix: match changed files only under a stack path directory - #337

Merged
panicboat merged 1 commit into
mainfrom
fix/dispatcher-match-files-under-stack-path
Oct 9, 2026
Merged

panicboat merged 1 commit into
mainfrom
fix/dispatcher-match-files-under-stack-path

Conversation

@panicboat

Copy link
Copy Markdown
Owner

Why

stack のパス(例: dystopia/{service})はディレクトリを指しますが、label-dispatcher は変更ファイル自身のパスが解決後のパスと等しい場合も一致として扱っていました。panicboat/monorepo#1451 では dystopia/README.md がサービス README.md として抽出され、deploy:README.md ラベルが付与されました。label-resolver は実ディレクトリだけを対象にするため、このラベルは deployment target になりません。

Behavior

  • PatternMatcher.extract_prefix は、パターンの後ろに 1 セグメント以上続くパスだけに一致します。パターンと完全に一致するパス、および末尾が / で終わるパスは nil を返します。
  • {service} の位置にあるファイル(dystopia/README.md)と、{environment} の位置にあるファイル(dystopia/web/kubernetes/overlays/README.md)は変更検出の対象外です。
  • 照合はパス文字列だけで行い、ファイルシステムを参照しません。削除済みファイルの検出は従来通りです。
  • submodule(gitlink)のパス自体が stack のパスと完全に一致する場合も対象外になります。

Verification

VERIFIED:

  • RED: 修正前に追加した 4 件が失敗(expected: ["api"] got: ["README.md", "api"] ほか)
  • bundle exec rspec: 373 examples, 0 failures
  • panicboat/monorepo の workflow-config.yaml と #1451 の変更ファイル一覧を DetectChangedServices に入力: ["deploy:frontend", "deploy:monolith"](修正前は deploy:README.md を含む)

🤖 Generated with Claude Code

https://claude.ai/code/session_01W3CmNyPA4mB5efonYJRPij

A stack path such as `dystopia/{service}` resolves to a directory, but
the dispatcher also matched a changed file whose own path equals the
resolved path. `dystopia/README.md` was captured as the service
`README.md` and produced a `deploy:README.md` label that the resolver
can never turn into a deployment target, because the resolver only
walks real directories.

Require at least one path segment after the pattern so that only files
located under the resolved directory are detected. The match stays
path-based so that deleted files keep being detected.

Claude-Session: https://claude.ai/code/session_01W3CmNyPA4mB5efonYJRPij
Signed-off-by: panicboat <panicboat@gmail.com>
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 550e0007-e6d3-4380-b9c8-9c6c6e2ffd59

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@panicboat
panicboat marked this pull request as ready for review October 9, 2026 18:45
@panicboat
panicboat merged commit 0dcbf5a into main Oct 9, 2026
6 checks passed
@panicboat
panicboat deleted the fix/dispatcher-match-files-under-stack-path branch October 9, 2026 18:45
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.

1 participant