Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

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

Ouverte
#8,825 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@cknitt y travaille déjà.

Depuis le 12/10/2026.

  • #8839 par @cknitt — ouverte

Évaluation

Difficulté
4/5
Temps estimé
1-2 jours
Accessibilité débutants
35/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
À l'abandon
Stack technique
ocaml
Domaine
devtools

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
OCaml
Étoiles
7.5k
Forks
484
Merge moyen
18 h 19 min
PR mergées (30 j)
116

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de rescript-lang/rescript

Toutes les issues de rescript-lang/rescript

Issues similaires

Plus d'issues DevTools

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.