Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

rewatch watch on Linux stops watching a source folder when an overlapping recursive source folder is removed from rescript.json

未关闭
#8,825 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@cknitt 已经在做这个了。

开始于 2026年10月12日。

  • #8839 来自 @cknitt —— 未关闭

评估

难度
4/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
ocaml
领域
devtools

调研方向

Start in rewatch/src/watcher.rs, especially compute_watch_paths and update_watches, and trace how overlapping paths are handled when the config changes. Check notify 5.2.0's Linux INotifyWatcher removal behavior described in the issue, then reproduce with the supplied Linux steps. Done means edits under src/retained are picked up after narrowing the source folders without restarting the watcher.

由索引模型根据 Issue 内容生成。

描述

Found by adversarial experiments on semantic analysts.

What is broken

rescript watch registers each source folder as its own watch, and overlapping folders are allowed. Consider sources [{"dir": "src", "subdirs": true}, "src/retained"], which become ["src/retained"] after an edit to rescript.json. On Linux, edits under src/retained are no longer picked up afterwards.

  • compute_watch_paths gives src (recursive) and src/retained (non-recursive) separate entries.
  • On a config change, update_watches (called at L599) does three things:
    • it keeps src/retained as unchanged;
    • it calls unwatch on the stale src;
    • it registers only the paths that are not kept.
  • On Linux, RecommendedWatcher is notify's INotifyWatcher. In notify 5.2.0 (the version locked in rewatch/Cargo.lock), unwatching a recursive path removes every watched path that starts with it (src/inotify.rs, remove_watch, lines 518–541 of the crate). That includes the separately registered src/retained.
  • update_watches still lists src/retained as registered, so it is never re-registered. The package root watch is non-recursive and does not see src/retained/*.res.

macOS (FSEvents) keeps the child watch, and there the scenario below works. The Linux result follows from the notify code above; I have not run it on Linux.

Reproduction (Linux)

mkdir -p proj/src/retained && cd proj
echo '{"name":"proj","version":"0.0.0","dependencies":{"rescript":"13.0.0-alpha.7"}}' > package.json
cat > rescript.json <<'EOF'
{"name":"proj","sources":[{"dir":"src","subdirs":true},"src/retained"],
 "package-specs":{"module":"esmodule","in-source":true},"suffix":".mjs"}
EOF
echo 'let x = 1' > src/retained/Demo.res
npm install && (npx rescript watch &) && sleep 3
sed -i 's|"sources":.*"src/retained"\],|"sources":["src/retained"],|' rescript.json; sleep 3
echo 'let x = 2' > src/retained/Demo.res; sleep 3
grep 'let x' src/retained/Demo.mjs

Expected: let x = 2;. Per the code above, on Linux Demo.mjs keeps let x = 1; until the watcher restarts.

Introduced by

fb85e7bf8 (#8730). Before it, a full rebuild unregistered every path and registered the complete new list.

Impact

Linux users who narrow an overlapping source configuration while rescript watch runs get silently stale output for the retained folder. One fix is to treat a kept watch as stale when an ancestor recursive watch is removed. Another is to re-register every kept path below a removed recursive path.

主要语言
ReScript
星标
7.5k
派生
483
平均合并
1 天 1 小时
30 天内合并 PR
120

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

rescript-lang/rescript 的其他 Issue

查看 rescript-lang/rescript 的全部 Issue

相似的 Issue

更多 DevTools Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。