rewatch watch on Linux stops watching a source folder when an overlapping recursive source folder is removed from rescript.json
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Estagnada
- Stack de tecnologia
- ocaml
- Domínio
- devtools
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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_pathsgivessrc(recursive) andsrc/retained(non-recursive) separate entries.- On a config change,
update_watches(called at L599) does three things:- it keeps
src/retainedas unchanged; - it calls
unwatchon the stalesrc; - it registers only the paths that are not kept.
- it keeps
- On Linux,
RecommendedWatcheris notify'sINotifyWatcher. In notify 5.2.0 (the version locked inrewatch/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 registeredsrc/retained. update_watchesstill listssrc/retainedas registered, so it is never re-registered. The package root watch is non-recursive and does not seesrc/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.
- Linguagem predominante
- OCaml
- Estrelas
- 7.5k
- Forks
- 484
- Merge médio
- 20h 27min
- PRs com merge (30d)
- 120
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de rescript-lang/rescript
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
rescript-lang/rescript#8833 · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
rescript-lang/rescript#8806 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
rescript-lang/rescript#8798 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 Meio dia Facilidade para iniciantes 58/100
rescript-lang/rescript#8757 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 40/100
rescript-lang/rescript#8753 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de rescript-lang/rescript
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
PerlDancer/Dancer2#1854 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
NationalSecurityAgency/ghidra#9883 ·
Mantenedores costumam responder em até 2 dias
-
Add pre-commit with lintingAbertagood first issue No-AI
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
-
Frontmatter next to `src:` is applied to every imported slide, not only the first (undocumented)Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia