Skip to content

Keep the identity of listed keys through traversal, fan-outs, and invalidation #1381

Open
3 of 4 issues completed

Description

@laughingman7743

Part of #1341 (decisions 7, 8 and the key="" part of 10 of the audit). Defect 23 of #1327 and the items deferred from #1370.

Start after #1344 merges, since both rewrite the pairing and the fan-outs of rm, chmod and copy/mv.

Current state (29cc1d3)

  1. Listed names are re-parsed as paths. With the literal keys a/x and a/x?versionId=null in an unversioned bucket, find("bucket/a") names the second bucket/a/x?versionId=null, and:
    • chmod(recursive=True) updates a/x twice (once with VersionId=null) and never the literal key;
    • rm(recursive=True) deletes a/x and a/x version null, and leaves the literal key;
    • copy(recursive=True) raises ValueError: Cannot copy to a versioned file. after copying a/x;
    • mv(recursive=True) raises ValueError: Cannot move several paths to the same destination. before copying;
    • fsspec's du counts a/x once.
  2. Traversal and invalidation. With the key a/dir?versionId=v1/z, find("bucket/a") lists it but find("bucket/a", maxdepth=2) does not: _find_levels (s3.py:930) re-parses the directory name. _invalidate_path (s3.py:2594) can take part of such a key for a version and skip the parent's listing.
  3. bucket//. S3Path.parse("b//") is the key / with is_bucket True. find and recursive chmod list the bucket, and the recursive chmod sends no PutBucketAcl; rm_file("bucket//") deletes the key /.
  4. key="". S3Path("b", "") prints b and re-parses with key None.

Decision

  1. Filesystem operations carry the bucket, key and version ID of the listed entries through traversal, pairing, the fan-outs, lookups and invalidation, as a private sequence of typed paths; they never re-parse a listed name. Public find() and expand_path() still return strings.
  2. A key that looks like a version path cannot be addressed by a string path. This stays a documented limit, as in s3fs; S3Core with an explicit S3Path reaches it. No escape syntax.
  3. bucket// keeps its current meaning (the key / for single-object operations, the bucket for listings), documented, including that a recursive chmod of it does not change the bucket ACL.
  4. S3Path(bucket, "") normalizes the key to None.

Sub-issues

Sub-issues

3 of 4 Issues completed
Loading 4 sub-issues

Activity

  1. laughingman7743 commented on Nov 13, 2026

    @laughingman7743
    MemberAuthor

    Implementation plan: four staged PRs

    I reproduced the current state on 758adee. The decision holds, but more consumers re-parse listed names than this issue lists. Besides rm, chmod, copy, mv and du, these also do:

    • get and cat. get_file opens the path, and S3FileTarget.resolve parses it again.
    • walk, tree, and the directory synthesis of flat listings.
    • The directory checks and conflict lookups of copy.
    • info, exists and the lookup cache. Version lookups share their string keys with keys that end in a literal ?versionId=.
    • Invalidation from the delete batches and the file writers.
    • The S3 destinations that put builds from local names.

    To keep each PR reviewable, with a contract its tests can observe, the work is split into four steps:

    1. Keep listed identities through traversal (#1381 step 1) #1401: traversal (find, walk, tree, and the directory synthesis of flat listings) lists the literal prefix of each listed directory. S3Path(bucket, "") normalizes the key to None.
    2. Act on listed identities in expansion, lookups, invalidation and rm/chmod/cat/du (#1381 step 2) #1402: a typed expansion, cache keys for lookups that cannot collide, and typed invalidation. rm, chmod, cat and du act on typed paths, on both filesystems.
    3. Act on listed identities in pairing and copy/mv/get (#1381 step 3) #1403: pairing, and copy, mv and get (including open), on both filesystems.
    4. Type generated put destinations and document path addressing limits (#1381 step 4) #1404: typed destinations for put, and the documentation of bucket//, of the string-addressing limit, and of the compositions that go through strings.

    Summing du sizes from the listing is a separate optimization and not part of this issue. A synthetic directory can replace an object of the same name in the name-keyed results.

    Each step's issue includes its reproductions.

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