feat: use FSEvents for the UI live publisher on macOS

オープン
#233 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
30/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
go, macos
領域
tooling

調査の方向性

Start with armWatches in internal/uiserver/livepublish.go (around line 495) and newLivePublisher (around line 562), where the fsnotify watcher is created, then compare with the FSEvents backend in internal/watch/watcher_darwin.go. The main open question is the mapping from FSEvents flags to re-arm decisions, which the issue leaves undefined, so settle the design before coding. Done means the macOS publisher holds a fixed descriptor count regardless of files in .codegraph/store, and re-arming on Create, Remove and Rename still works.

索引モデルが issue の本文から書いたものです。

説明

area:ui enhancement priority:low
What exists today?

The UI live publisher in internal/uiserver/livepublish.go watches the store with fsnotify. newLivePublisher (line 562) creates the watcher at line 568. armWatches (line 495) adds the watches on the deepest existing path of the chain [repoRoot, .codegraph, .codegraph/store] and on its parent. In a normal index, those paths are .codegraph/store and .codegraph.

How does it behave now?

On macOS, fsnotify uses kqueue. kqueue holds one file descriptor for every file in each watched directory. Each codegraph ui process therefore holds one descriptor per file in .codegraph/store and one per file in .codegraph. On 2026-10-31, this repository's index had 10 store files, and a larger index had about 95 store files.

The publisher needs only the signal that the store changed. It re-runs its change detector on any event, so the per-file watches add cost without adding information.

PR #229 moved the indexing watcher in internal/watch to FSEvents on macOS. The live publisher does not use that backend. Related: #227 (closed, the FSEvents change for the indexing watcher).

How should it behave?

On macOS, the live publisher must hold a fixed number of descriptors, independent of the file count in .codegraph/store. One non-recursive FSEvents stream on .codegraph meets that requirement.

The arming state machine in armWatches must keep working. It re-arms on Create, Remove and Rename, so a store replaced by rename is still seen. FSEvents watches by path and survives a replaced directory, but the mapping from FSEvents flags to re-arm decisions is not defined yet.

Two options are open. The first option reuses the darwin backend in internal/watch/watcher_darwin.go. That backend runs one recursive stream over the repo root, so it needs a non-recursive or filtered variant for .codegraph. The second option adds a small FSEvents stream in internal/uiserver, behind the same build tag as the watch backend.

What kind of improvement?

Performance

Would this change existing behavior?

No. The UI output does not change. The publisher still reacts to store changes and runs the same change detector.

Before submitting
  • I searched existing issues and this is not a duplicate
  • I checked that the current behavior is not a deliberate decision in openspec/specs/
主要言語
Go
スター
0
フォーク
0
平均マージ
7時間 42分
マージ済み PR(30日)
111

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

seanb4t/codegraph-go のほかの issue

seanb4t/codegraph-go の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。