Repository navigation
[Data] Add agent instructions for test structure and fixtures - #68289
Merged
richardliaw merged 1 commit intoNov 21, 2026
Merged
Conversation
Add python/ray/data/tests/AGENTS.md: short instructions for coding agents on how to write Ray Data tests. It covers the shared cluster fixtures, DataContext fixtures, test data, parametrize, asserts and mocks, with one before/after example. python/ray/data/tests/.claude/CLAUDE.md imports it for Claude Code, as python/ray/data/ already does. Add one shared datasource_v2 fixture to tests/conftest.py, which the instructions point to. It replaces three copies: orc_reader_version in test_orc.py, use_datasource_v2 in test_parquet.py, and the autouse datasource_v2 in test_mcap.py, which now applies it with pytestmark. Test ids don't change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abhishek Verma <[email protected]>
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
abhishekverma-ray
requested review from
AarryaSaraf,
goutamvenkat-anyscale and
richardliaw
November 18, 2026 03:36
Contributor
Author
Back-testTo see whether these instructions change what an agent writes, I took the code-only change from two Data PRs that merged yesterday. I had an agent add tests for it twice: once without this file, and once told to read it. It was the same model (Claude) with the same prompt otherwise, one run each. Then I reverted each code change to see which new tests catch it. #67079 (synthesized
#67228 (filtered Lance row counts, +56 code lines)
What the file changed:
Caveats:
|
richardliaw
approved these changes
Nov 21, 2026
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
Adds
python/ray/data/tests/AGENTS.md, short instructions that tell coding agents how to write Ray Data tests: shared cluster fixtures,DataContextfixtures, 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-setDataContext, field-by-field asserts.It also adds one shared
datasource_v2fixture totests/conftest.py, which the instructions point to. It replaces three copies of the same fixture.Before
python/ray/data/.claude/rules/, which only Claude Code reads. [Data] Add REVIEW.md code-review instructions for Ray Data subsystems #67928 (open) adds review instructions with one line on shared fixtures.orc_reader_versionintest_orc.py,use_datasource_v2intest_parquet.py, and an autousedatasource_v2intest_mcap.py.After
python/ray/data/tests/AGENTS.mdholds the instructions. Codex, Cursor and other agents readAGENTS.md;python/ray/data/tests/.claude/CLAUDE.mdimports it for Claude Code, aspython/ray/data/already does. The rules apply to new and changed tests, not to rewriting untouched ones.datasource_v2fixture intests/conftest.py.test_orc.pyandtest_parquet.pytake it by name, andtest_mcap.pyapplies it to every test throughpytestmark. 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
test_rules.mdin [Data] Add a data-pr skill and review rules for code and tests #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 thisAGENTS.md, here or in [Data] Add a data-pr skill and review rules for code and tests #67919, so every agent sees both?REVIEW.mdcould 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
pytest datasource/test_mcap.pypytest datasource/test_parquet.py -k "v1 or v2"(the tests that use the fixture)pytest datasource/test_orc.pytest_read_orc_v2_partitioned_scan_optimizations, which asserts the reader's source path ends inpython/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/dataandpython/ray/testslinked 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 todatasource_v2.AI assistance (Claude Code) was used to draft the instructions, the fixture change and this description.
🤖 Generated with Claude Code