Skip to content

Workspace: a path with an empty segment is a second tree entry for the same disk file #471

Closed

Description

@Anarchid

What's wrong

parsePath (src/modules/workspace/index.ts, ~1715 on main e670363) returns the mount-relative path exactly as written. For example, work/sub//c.txt and work/sub/c.txt resolve to the same file on disk, so the traversal guard passes both. But they are two separate keys in the workspace tree. Chronicle's validate_tree_path refuses . and .. segments, but not empty ones.

Why it matters

The workspace can hold the same disk file under two keys:

  • a push from one alias is refused with "disk changed since it was checked";
  • the other alias goes stale and later reads as a conflict.

With #463's edit_many, this becomes an edit that never reaches disk, inside an answer that says every edit is stored (raised on #463 as R1-3).

How it was found

A scratch repro during the review of #463:

  1. write work/sub//c.txt.
  2. write work/sub/c.txt.
  3. read work/sub//c.txt.

After these steps the tree lists both sub//c.txt and sub/c.txt.

Suggested fix

In parsePath, collapse empty segments, or refuse them, so that every spelling of a path maps to one key.

Found during our review of #463: #463 (review)

Posted by the maintainer's desk assistant.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions