Repository navigation
fix: strip trailing separator in FileSystem.is_writeable - #4300
Merged
epatey merged 3 commits intoJun 23, 2026
Merged
Conversation
he-yufeng
force-pushed
the
fix/is-writeable-trailing-sep
branch
2 times, most recently
from
June 21, 2026 16:53
ea2368f to
af28722
Compare
he-yufeng
force-pushed
the
fix/is-writeable-trailing-sep
branch
from
June 22, 2026 19:46
af28722 to
e9e4d81
Compare
he-yufeng
force-pushed
the
fix/is-writeable-trailing-sep
branch
from
June 22, 2026 22:52
e9e4d81 to
61fc0c5
Compare
Fix no-op trailing-separator issue in FileSystem.is_writeable()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FileSystem.is_writeable()callspath.rstrip("/\\")but discards the result, so the trailing separator is never actually stripped:FileRecorder.is_writeable()passes the user'slog_dirstraight through, and log dirs are commonly given with a trailing slash (--log-dir ./logs/,s3://bucket/logs/). With the trailing slash left in place, the write-test path becomess3://bucket/logs//.inspect_write_test— a double separator, which is a malformed key on S3/Azure.Fix
Assign the stripped value back:
(The module already has a
strip_trailing_sep()helper; this just makes the existing inline strip actually take effect.)Test
Added
test_is_writeable_strips_trailing_sepintests/util/test_file.py: it callsis_writeable("mydir/")on an in-memory filesystem (withtouch/rmpatched) and asserts the write-test path contains no double separator. It fails onmain(assert '//' not in 'mydir//...') and passes with this change.Verified locally with
pytest tests/util/test_file.py::test_is_writeable_strips_trailing_sepandruff check/ruff format --check(clean). A few unrelated path/URI tests in that file fail only on a Windows checkout due to POSIX-path assumptions; they're untouched by this change and pass on CI.