Skip to content

mds watch directory mode has no content-level backstop for cross-root dependencies #321

Description

@dean0x

Summary

In directory mode, liveness_probe_dir (crates/mds-cli/src/watch.rs:1558-1607) reconciles only appeared and removed files under the watched root, via collect_mds_files. A dependency living outside the watched root is never in that diff, so content changes to it are invisible to the self-heal probe. Combined with the fact that cross-root dependency directories cannot be armed until the first compile discovers them (watch.rs:1928-1936), an edit to such a dependency during startup is lost with no recovery path at all.

Why this is permanent loss, not delayed delivery

The content-level backstop (liveness_probe_dir) does not cover cross-root paths. Even if the edit fires a watcher event later, the probe cannot retroactively detect it because the file is outside the reconciliation scope. Measured on Linux: watch_dir_mode_cross_root_partial_edit_rebuilds_importer fails roughly 20% of runs (11/54) at a 2-second bound, and at a 10-second bound fails 4/15 — each failure consumes the full 10 seconds. The edit never arrives.

User impact

A user running mds watch on a directory, editing a template that lives outside that root but is imported by something inside it, silently loses that save. No error, no warning.

Relationship to other issues

This is the same defect class as #317, which fixed the in-root startup ordering race. The #317 fix explicitly named this as a known residual. It is also entangled with #319 — the self-heal probe that would otherwise serve as the backstop can be starved indefinitely by any steady irrelevant-event stream, so a content check alone may not be sufficient.

CI impact

This is the dominant remaining cause of red runs in Rust — fmt, clippy, test (a required status context) — roughly 6 of every 25 full-suite runs.

Status

A fix is in progress on branch fix/watch-startup-race.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcliCLI commands and optionsrustPull requests that update rust code

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions