Repository navigation
[Docs][Core] Specify if the node id needs to be a hex or byte value - #67592
Merged
pseudo-rnd-thoughts merged 4 commits intoNov 4, 2026
Merged
pseudo-rnd-thoughts merged 4 commits into
pseudo-rnd-thoughts merged 4 commits into
Conversation
added 2 commits
October 30, 2026 12:16
…ed as hex values or bytes Signed-off-by: Mark Towers <[email protected]>
…ed as hex values or bytes Signed-off-by: Mark Towers <[email protected]>
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates docstrings across several Ray internal files to explicitly document where node, actor, and job IDs are represented as hex strings versus binary bytes. The feedback suggests a correction to the actor_table docstring in python/ray/_private/state.py to clarify that the 'NodeID' key is nested inside 'Address' and 'OwnerAddress' dictionaries rather than being a top-level key, which helps prevent potential KeyErrors.
This was referenced Oct 30, 2026
dstrodtman
added a commit
that referenced
this pull request
Oct 30, 2026
## Why are these changes needed? The `docstring-only` label's scope guard, `ci/ray_ci/doc/check_docstring_only.py`, rejects every file that isn't `.py`. Docstring edits to Cython bindings therefore can't use the label, even when they change nothing else. #67592 hit this: its edits to `python/ray/includes/gcs_client.pxi` and `global_state_accessor.pxi` only add and rewrite docstrings, and the guard failed them with "isn't a Python file" ([build 75788](https://buildkite.com/ray-project/premerge/builds/75788#01a18cd4-72d1-46c4-b00f-0995c3e2b663)). This PR extends the guard to two more kinds of file: - **`.pyi` stubs** are Python, so they go through the existing `ast` comparison unchanged. - **Cython files, `.pyx`, `.pxi`, and `.pxd`,** can't go through `ast`, which can't parse `cdef`. The guard compares their `tokenize` token streams instead. It drops comments, blank lines, and line breaks inside brackets. It removes a string only where Python allows a docstring: the first statement of the file, or the first statement in the indented body of a `def`, `class`, `cdef`/`cpdef` function, or `cdef class`. Two Cython constructs look like comments or docstrings but are code, and the guard keeps both: - `# cython:` and `# distutils:` comments set compiler directives and build options. `_raylet.pyx`, `_raylet.pxd`, and `libcoreworker.pxd` carry them, including `embedsignature`. - A string in a `cdef extern from` block is verbatim C or C++ that Cython compiles. Five files under `python/ray/` have one. A `cdef extern` header has neither a parameter list nor `class`, so the guard never treats that string as a docstring. The token comparison fails closed where it differs from the `ast` rule. It treats replacing a docstring-only body with `pass` as a code change, and it doesn't strip a docstring written on the same line as its `def`. The label still compiles the PR's Cython. A `python/` change selects `doc: docstring examples`, which depends on `ray-core-build`, so a docstring edit that breaks the Cython build still fails the PR. `ci.md`, `ci/ray_ci/doc/README.md`, and the step comment in `.buildkite/lint.rayci.yml` now name the covered file types and the two Cython exceptions. `ci.md` also notes that `doc: docstring examples` runs only Python modules. No CI step runs `>>>` examples in Cython docstrings, with or without the label, because no `doctest()` target lists a Cython file and `--doctest-modules` collects only `.py`. ## Testing - `pytest ci/ray_ci/doc/test_check_docstring_only.py` passes all 33 tests on Python 3.10, which is the forge image's version, and on 3.12 and 3.13. The new tests cover stub docstrings, the #67592 edit shapes, line rewrapping, indentation changes, the build comments, the extern C block, a non-leading string, an f-string in the docstring position, a Cython cast, an `except?` clause, and a tokenize error. - On #67592's head against its merge base, the new guard reports "5 file(s), docstrings only." and exits 0. The guard on master fails the same diff the way CI did. - All 39 `.pyx`, `.pxi`, `.pxd`, and `.pyi` files on master tokenize on Python 3.10 through 3.13. - Mutation test on master's Cython files: the guard caught all 1,520 injected single-token and indentation edits to code, plus every directive-comment change. - History replay: I ran the comparison on every modification to a Cython file in the last 940 commits on master that touched one, 1,831 file changes in all. It passed 42, and I read each of those diffs: all are docstring, comment, blank-line, or in-bracket rewrapping changes. The other 1,789 changed code and failed. - `pre-commit run` on the changed files passes. ## Duplicate check No open PR changes `check_docstring_only.py` or the label's file coverage. I searched open PRs for "docstring-only" and "check_docstring_only". ## AI assistance I wrote this change with Claude Code (Opus 5.5). I reviewed every changed line, and I ran the tests and checks listed above. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: Mark Towers <[email protected]>
iamjustinhsu
approved these changes
Nov 4, 2026
karticam
approved these changes
Nov 4, 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.
Description
In recent PRs, I've found that Gemini and Claude sometimes get confused on if the node id should be a hex or byte value.
This PR updates the docstrings for all applicable functions to specify this and avoid these issues in the future