You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Keep the identity of listed keys through traversal, fan-outs, and invalidation #1381
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.
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.
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 /.
key="".S3Path("b", "") prints b and re-parses with key None.
Decision
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.
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.
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.
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:
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.
Activity
laughingman7743 commentedon Nov 13, 2026
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,mvanddu, these also do:getandcat.get_fileopens the path, andS3FileTarget.resolveparses it again.walk,tree, and the directory synthesis of flat listings.copy.info,existsand the lookup cache. Version lookups share their string keys with keys that end in a literal?versionId=.putbuilds from local names.To keep each PR reviewable, with a contract its tests can observe, the work is split into four steps:
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.rm,chmod,catandduact on typed paths, on both filesystems.copy,mvandget(includingopen), on both filesystems.put, and the documentation ofbucket//, of the string-addressing limit, and of the compositions that go through strings.Summing
dusizes 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.