Skip to content

Address the key as written in the single-object methods, pipe_file, put_file and get_file included #1511

In review

Description

@laughingman7743

Current scope (2026-12-01): after (a1) #1615 and before #1491 (a2); see the order decision. Earlier: scope (2026-11-29): bucket// writes the key /; see the decisions and the cross-track order, which take precedence over the text below.

Part of #1493 (defects 4 and 10 of the audit; decision 3). After #1491.

Current state (master 23e2a43)

The methods that act on one object disagree on a trailing slash:

s3://bucket/dir/ addresses
cat_file, rm_file, touch, cp_file (destination), tags, metadata, xattrs, sign, non-recursive chmod the key dir/
pipe_file, put_file (through open), get_file the key dir

So pipe_file("s3://bucket/dir/", b"x") writes dir, and cat_file("s3://bucket/dir/") then reads the marker dir/. docs/filesystem.md:343-351 documents the stripping; test_pipe_file_trailing_slash (GH-1037, tests/pyathena/filesystem/test_s3.py:4398) made pipe_file strip as open() does. s3fs 2026.9.0 addresses the key as written in all of these methods (split_path keeps the trailing slash).

bucket// is the bucket for the lookups and listings and the key / for the single-object methods. touch("bucket//") writes the key /, while docs/filesystem.md:727 says that a write to it raises ValueError; pipe_file and put_file raise.

Decided (maintainer, on #1493)

The single-object methods (cat_file, rm_file, touch, cp_file, pipe_file, put_file, get_file, tags, ACL, sign, metadata, xattrs) address the key as written. Lookups and listings, open() included, address dir. The batch methods keep fsspec's meaning of the slash.

Proposal

  1. pipe_file, put_file and get_file pass the S3Path of Parse caller-supplied S3 paths with one parser in every filesystem method #1491's entry point to _open_path(), which already accepts one, instead of a stripped string; pipe_file() rejects compression for small values and uploads an empty object when a compressed write fails #1037's test changes.
  2. bucket//: one rule for the writes (touch, pipe_file, put_file, the cp_file destination), settled in the PR, and the docs follow it.
  3. Ranged cat_file of a marker (dir/) sizes the marker, not dir (s3.py:3873-3878), which today raises FileNotFoundError for a negative range; the docs change with it.
  4. docs/filesystem.md: one table of the three groups replaces the paragraphs at :343-351 and :720-727. open("…/dir/", "wb") writing dir while pipe_file writes dir/ is stated.

The differential check of #1491 is rerun, with the rows of these methods as the intended differences.

Compatibility

Breaking for 5.0.0 (release note): a caller that passes dir/ to pipe_file, put_file or get_file addresses a different key. Master only.

Activity

  1. laughingman7743 commented on Nov 29, 2026

    @laughingman7743
    MemberAuthor

    Decision on item 2 (maintainer, 2026-11-29, after consulting Codex and Fable 5.2): the single-object writes to bucket// (touch, pipe_file, put_file, the cp_file destination) write the key /, as the rule "the single-object methods address the key as written" gives. pipe_file and put_file stop raising for it; the docs at docs/filesystem.md:720-727 change accordingly.

  2. added this to the 5.0.0 milestone on Nov 30, 2026
  3. laughingman7743 commented on Nov 30, 2026

    @laughingman7743
    MemberAuthor

    Decision (maintainer, 2026-12-01), for the 5.0.0 milestone: #1511 no longer waits for #1491 (a2).

  4. laughingman7743 commented on Nov 30, 2026

    @laughingman7743
    MemberAuthor

    Notes for this issue from #1491 (a1) (#1615, merged as 3597987). They are not decisions.

  5. laughingman7743 commented on Dec 1, 2026

    @laughingman7743
    MemberAuthor

    Decision (maintainer, 2026-12-01), for #1645, after consulting Codex and Claude Fable 5.2 (both recommended it):

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions