Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for passing PyArrow S3FileSystem keyword arguments via storage_options across Ray Data's file read and write APIs, and adds a s3_filesystem_defaults configuration to DataContext initialized from the RAY_DATA_S3_FILESYSTEM_DEFAULTS environment variable. Feedback on the changes highlights a security vulnerability where S3 URI credentials could be leaked in logs and dashboard paths, suggesting a reconstruction of the netloc without userinfo. Additionally, a robustness improvement is suggested to handle empty environment variables gracefully during JSON parsing to prevent import crashes.
8b772da to
db0599a
Compare
Forward per-call PyArrow S3FileSystem options through file-based readers and writers, including the Parquet, Text, ORC and MCAP V2 readers. Apply DataContext and environment defaults, then URI connection options, then per-call overrides while preserving URI object paths. Validate supported paths, argument types and filesystem/catalog conflicts, and sanitize configuration errors without exposing credentials. Add regression tests and document defaults and precedence. Validation: applicable pre-commit checks passed. Isolated source tests passed (46 cases, with Ray environment dependencies stubbed). Full Ray pytest collection is blocked by the missing ray._raylet extension. Signed-off-by: dragongu <[email protected]>
Treat empty and whitespace-only RAY_DATA_S3_FILESYSTEM_DEFAULTS values as unset, while still rejecting malformed nonempty JSON. Strip URI userinfo before passing the object URI to any downstream path helper. Add regressions for uppercase and percent-encoded URI credentials and verify against a local S3 endpoint that anonymous@ requests remain unsigned, matching PyArrow's native URI inference. Validation: 56 isolated source test cases and applicable pre-commit checks passed. Full Ray pytest collection remains blocked by missing ray._raylet. Signed-off-by: dragongu <[email protected]>
db0599a to
5ca74c1
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
Reviewed by Cursor Bugbot for commit 5ca74c1. Configure here.
Remove custom S3 URI connection-option parsing and merging. Combine only DataContext defaults and per-call storage_options, and let PyArrow's S3FileSystem constructor validate the resulting keyword arguments. Reject URI query parameters and userinfo when storage_options is supplied. Keep the existing resolver behavior unchanged when storage_options is omitted or an explicit filesystem is used. Update tests and documentation to describe this narrower configuration boundary. Validation: 65 isolated source cases passed on each of PyArrow 23.0.0 and 25.0.1; applicable pre-commit checks passed. Full Ray pytest collection remains blocked by the missing ray._raylet extension. Signed-off-by: dragongu <[email protected]>
|
Related PR: #68208 (same issue #68206,
Happy to help with the merge if useful. |
Accept case-insensitive s3 and s3a URI prefixes in the storage_options branch, using the same S3FileSystem and existing object-path normalization. Keep the original inference and explicit-filesystem paths unchanged when storage_options is omitted. Cover mixed aliases, encoded object keys, credential forwarding, and local HEAD/GET requests. Document that the alias support applies only when storage_options is supplied. Validation: 83 isolated source cases passed on each of PyArrow 23.0.0 and 25.0.1. Applicable pre-commit checks passed. Full Ray pytest collection remains blocked by the missing ray._raylet extension. Signed-off-by: dragongu <[email protected]>
@lhjnano Thanks! s3a:// support and case-insensitive matching are now covered in 874b99e for the storage_options path. On the current base, the undeclared keyword went into **arrow_parquet_args, not **ray_remote_args. storage_options is now explicitly declared and forwarded to filesystem construction before listing. |
## Summary Adds `python/ray/data/tests/AGENTS.md`, short instructions that tell coding agents how to write Ray Data tests: shared cluster fixtures, `DataContext` fixtures, test data, parametrize, asserts and mocks, plus one before/after example. Recent agent-written Data PRs added 1.6× to 15× more test code than library code, much of it repeated setup: a Ray cluster per test, a hand-set `DataContext`, field-by-field asserts. It also adds one shared `datasource_v2` fixture to `tests/conftest.py`, which the instructions point to. It replaces three copies of the same fixture. ## Before - No agent instructions say how to structure a Data test. #67919 (open) adds rules on *which* tests to write, in `python/ray/data/.claude/rules/`, which only Claude Code reads. #67928 (open) adds review instructions with one line on shared fixtures. - Three copies of the V1/V2 reader fixture: `orc_reader_version` in `test_orc.py`, `use_datasource_v2` in `test_parquet.py`, and an autouse `datasource_v2` in `test_mcap.py`. ## After - `python/ray/data/tests/AGENTS.md` holds the instructions. Codex, Cursor and other agents read `AGENTS.md`; `python/ray/data/tests/.claude/CLAUDE.md` imports it for Claude Code, as `python/ray/data/` already does. The rules apply to new and changed tests, not to rewriting untouched ones. - One `datasource_v2` fixture in `tests/conftest.py`. `test_orc.py` and `test_parquet.py` take it by name, and `test_mcap.py` applies it to every test through `pytestmark`. Test ids (`[v1]`, `[v2]`) don't change. No library code changes. The fixture change is a refactor: each file collects the same tests as before. ## Subsystems None. Tests and agent instructions only. ## Questions for reviewers - @AarryaSaraf: this covers *how* to write tests, and your `test_rules.md` in #67919 covers *which* tests to write. The PRs that prompted this were written with Codex, which doesn't read `.claude/rules/`. Would you be OK moving your test rules into this `AGENTS.md`, here or in #67919, so every agent sees both? - @goutamvenkat-anyscale: the fixture line in #67928's `REVIEW.md` could link to this file. ## Additional information ### Not a duplicate #67919 and #67928 are the only open PRs with agent rules for Data tests. This PR covers what they don't: test structure and fixtures, in a file that agents other than Claude Code also read. ### Testing | Command | Result | |---|---| | pre-commit on the 6 changed files | Passed | | `pytest datasource/test_mcap.py` | 67 passed, 6 skipped. The collected test ids are identical to master's (73). | | `pytest datasource/test_parquet.py -k "v1 or v2"` (the tests that use the fixture) | 23 passed, 1 skipped | | `pytest datasource/test_orc.py` | 217 passed, 6 failed: all `test_read_orc_v2_partitioned_scan_optimizations`, which asserts the reader's source path ends in `python/ray/data/...`. That isn't true for the pip-installed Ray used locally, and the test doesn't use the renamed fixture. | Environment: Ray nightly (3eb9895) with this branch's `python/ray/data` and `python/ray/tests` linked over it, Python 3.12.10, pyarrow 23.0.1, pandas 2.3.3, pytest 7.4.4. Not checked yet: that Codex and Claude Code load the new file when run from the repository root. ### Note for open PRs #68235 adds a test that takes `use_datasource_v2`. If it merges after this PR, that test needs the one-word rename to `datasource_v2`. AI assistance (Claude Code) was used to draft the instructions, the fixture change and this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Abhishek Verma <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
|
@dragongu can you help me understand the use case?
I see that this could be convenient, but don't think it adds too much value if we have 2 ways of doing the same thing. Does storage_options add more expressivity? I just wanna make sure this is the right use case because modifying the publicAPI is very hard to reverse, and will require other reviewers too |
@iamjustinhsu Thanks,here's how I think about it: 1. It follows the existing 2. What it adds beyond 3. It fixes #68206. Today |

Description
Add per-call
storage_optionsto Ray Data's file read and write APIs to make S3 configuration easier: users can pass a dictionary instead of constructing and passing a PyArrow filesystem. Platform operators can centrally manage shared settings such asconnect_timeoutandrequest_timeoutthroughDataContext.s3_filesystem_defaultsorRAY_DATA_S3_FILESYSTEM_DEFAULTS, while users override only the settings they need.Passing
storage_options, including{}, applies these defaults; omitting it preserves existing filesystem inference. The shared resolver applies the configuration before listing or IO for V1 readers, Parquet/Text/ORC/MCAP V2 readers, and file datasinks.