Skip to content

Track allowed directory symlinks in the polling watch backend #5124

Description

@Widthdom

Summary

When index --watch --follow-symlinks internal|all uses the polling backend, changes beneath an allowed directory symlink can be missed indefinitely.

The polling snapshot prunes every child directory with FileAttributes.ReparsePoint before consulting the configured symlink policy. As a result, an internal directory symlink is not traversed under internal, and an external directory symlink is not traversed under all. This is especially visible when the target is otherwise excluded from the normal lexical traversal, such as an allowed link into a dependency directory.

The baseline/full scan can index these paths, so later polling can leave their indexed rows and symbols stale without emitting an update event.

Expected behavior

The polling backend should apply the same --follow-symlinks none|internal|all contract as the baseline scan and filesystem-event backend. Allowed directory links should be observed, while disallowed targets, cycles, and duplicate traversal remain bounded and safe.

Suggested regression coverage

  1. Under internal, index an in-workspace directory symlink and modify a source file through its target.
  2. Under all, repeat with an allowed external directory target.
  3. Verify polling enqueues the indexed symlink-relative path and refreshes the database.
  4. Preserve none rejection, outside-target rejection under internal, cycle handling, and duplicate-path bounds.

Scope note

This pre-existing polling gap was identified while auditing #5091. That issue's watch changes preserve valid file-symlink events and recover strict partial-update usage errors, but do not change directory-link traversal semantics.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions