Skip to content

serve コマンドで ls 実行時の誤検知を修正#46

Merged
zztkm merged 2 commits intomainfrom
fix/serve-ls-false-trigger
Jan 31, 2026
Merged

serve コマンドで ls 実行時の誤検知を修正#46
zztkm merged 2 commits intomainfrom
fix/serve-ls-false-trigger

Conversation

@zztkm
Copy link
Member

@zztkm zztkm commented Jan 31, 2026

Summary

  • notify-debouncer-mini から notify-debouncer-full に移行
  • EventKind::Access イベントを除外することで、ls コマンドによる atime 更新をファイル変更と誤検知しないように修正

問題

serve コマンド実行中に ls を実行すると、ファイル変更と誤検知されてビルドが走っていた。

原因

notify-debouncer-miniEventKind を提供せず(Any のみ)、ls コマンドがディレクトリの atime を更新すると、これが notify のイベントとして検知され、EventKind::AccessEventKind::Modify を区別できなかった。

Test plan

  • cargo build --release でビルド
  • ./target/release/vss serve を実行
  • 別ターミナルで ls を実行 → ビルドが走らないことを確認
  • ファイルを編集 → ビルドが正しく走ることを確認

🤖 Generated with Claude Code

notify-debouncer-mini から notify-debouncer-full に移行し、
EventKind::Access を除外することで、ls コマンドによる atime 更新を
ファイル変更と誤検知しないようにした。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @zztkm, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

このプルリクエストは、serve コマンド実行中に ls コマンドがファイル変更として誤検知され、不要なビルドがトリガーされる問題を解決します。ファイル監視ライブラリを notify-debouncer-mini から notify-debouncer-full にアップグレードし、ファイルアクセスイベントを明示的に無視することで、この誤検知を防ぎます。これにより、開発時のビルド体験が向上し、より正確なファイル変更監視が可能になります。

Highlights

  • デバウンサーライブラリの移行: notify-debouncer-mini から notify-debouncer-full へとファイル監視デバウンサーライブラリを移行しました。
  • 誤検知の修正: ls コマンドによる atime 更新がビルドをトリガーしないように、EventKind::Access イベントを明示的に除外するロジックを追加しました。
  • 依存関係の更新: notify クレートをバージョン 6.x から 8.x へ、および関連する依存関係(inotify, mio, windows-sys など)を更新しました。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

このプルリクエストは、serve コマンド実行中に ls を実行するとビルドが走ってしまう問題を修正するもので、notify-debouncer-full への移行と EventKind::Access イベントの除外という的確なアプローチで対応されています。依存関係の更新とコードの変更は適切です。
1点、ファイル変更の検知ロジックをより堅牢にするための改善提案をさせていただきました。全体として、問題解決のための良い変更だと思います。

Comment on lines +137 to +150
let should_rebuild = events.iter().any(|debounced_event| {
let path = match debounced_event.paths.first() {
Some(p) => p,
None => return false,
};

// dist ディレクトリ以下は無視
if path.starts_with(&dist_path) {
return false;
}

// Access イベント(ls による atime 更新など)は無視
!matches!(debounced_event.kind, EventKind::Access(_))
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

現在の実装では、debounced_event.paths に複数のパスが含まれている場合、最初のパスしかチェックしていません。
DebouncedEventdist ディレクトリ内外両方のパスを含む場合、パスの順序によっては意図しない動作(再ビルドされない)を引き起こす可能性があります。

より堅牢にするために、debounced_event.paths 内のすべてのパスをチェックするように修正することを推奨します。

                let should_rebuild = events.iter().any(|event| {
                    // Access イベントは無視
                    if matches!(event.kind, EventKind::Access(_)) {
                        return false;
                    }
                    // いずれかのパスが dist ディレクトリ外であれば再ビルド
                    event
                        .paths
                        .iter()
                        .any(|path| !path.starts_with(&dist_path))
                });

- import の順序を cargo fmt に合わせる
- paths 内のすべてのパスをチェックするように修正

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@zztkm zztkm merged commit c1831d2 into main Jan 31, 2026
2 checks passed
@zztkm zztkm deleted the fix/serve-ls-false-trigger branch January 31, 2026 02:49
zztkm added a commit that referenced this pull request Jan 31, 2026
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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