Skip to content

Keep listed identities through traversal (#1381 step 1) #1401

Closed

Description

@laughingman7743

Part of #1381 (step 1 of 4). See the plan on #1381.

Current state (758adee)

With the key a/dir?versionId=v1/z:

  • find("bucket/a", maxdepth=2) lists nothing. _find_levels (s3.py:1240) recurses with the directory's name, and _ls_dirs parses it into the prefix a/dir/.
  • walk("bucket/a") looks up a/dir version v1, so it stops at dir?versionId=v1 without listing it.
  • tree("bucket/a") raises FileNotFoundError.

fsspec's walk, _walk and tree recurse through ls() with the names of the directories. walk also strips their slashes, so a directory with an empty segment, such as dir/ (prefix dir//), is listed as dir (prefix dir/).

The directory synthesis of flat listings (_extract_parent_directories) strips the slashes of its base key. This drops an empty segment of the prefix argument.

S3Path(bucket, "") prints bucket, but it keeps the key "", which re-parses to None.

Scope

  1. Traversal lists the literal prefix of each listed directory, as its common prefix was listed: "", /, dir// or a/dir?versionId=v1/. It never re-parses a listed name. This covers:
    • _ls_dirs and _find_levels;
    • the directory synthesis of flat listings;
    • walk/_walk and tree, on both filesystems.
  2. S3Path(bucket, "") normalizes the key to None.

find(), ls(), walk() and tree() keep their output formats.

Activity

  1. changed the title [-]Keep listed identities through traversal, lookups and invalidation (#1381 step 1)[/-] [+]Keep listed identities through traversal (#1381 step 1)[/+] on Nov 13, 2026
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions