Skip to content

[ci/doc] Stop failing documented @Deprecated APIs in the API-doc check - #66612

Merged
dstrodtman merged 1 commit into
masterfrom
djs-260930-api-check-allow-deprecated
Sep 30, 2026
Merged

dstrodtman merged 1 commit into
masterfrom
djs-260930-api-check-allow-deprecated

Conversation

@dstrodtman

Copy link
Copy Markdown
Contributor

Why

The API policy says deprecated APIs must be documented. The docs-side half of doc: check API doc consistency, added in #64420, did the opposite: it failed any documented autosummary or autoclass entry that resolved to a @Deprecated object. That's what blocked #66308, which deprecates read_clickhouse and write_clickhouse and leaves them documented with a deprecation notice, which is what the policy asks for.

Teams have been working around the rule instead. Ray Data kept its deprecated APIs in tracked_doc_debt under a comment asking for them to be removed from the docs.

What

  • API.split_resolvable_and_broken_doc_apis no longer flags deprecated objects. It still fails documented names that don't resolve and documented names that resolve to private objects (_foo or ._internal.), with the existing override-hook and __all__ re-export exemptions unchanged.
  • It returns (unresolved, private) instead of (unresolved, non_public), and the error output says "private" instead of "deprecated / private."
  • API.introspect_annotation_type is removed. The deprecated check was its only caller. The inherited-annotation behavior it tested is still covered through Module in test_module.py.
  • The four Ray Data tracked_doc_debt entries for deprecated APIs are removed: AggregateFn, Dataset.iter_tf_batches, Dataset.to_random_access_dataset, and read_unity_catalog. All four are @Deprecated in source, so the entries only existed to get around this rule.

Out of scope: the policy also implies the code-side check should require deprecated APIs to be documented. Today that check skips them. There are about 90 @Deprecated decorators under python/ray, many on undocumented methods, so turning that on is a per-team burndown and belongs in a follow-up.

Duplicate check

No open PR touches this rule. I searched open PRs for api_policy_check, cmd_check_api_discrepancy, and "API doc consistency" together with deprecation. #66308 is the PR this unblocks, not a duplicate.

Testing

python -m pytest ci/ray_ci/doc/test_api.py ci/ray_ci/doc/test_cmd_check_api_discrepancy.py ci/ray_ci/doc/test_module.py
40 passed
pre-commit run --files <changed files>   # ruff, black, docstyle, import order: all passed

I didn't run the checker end to end against a real Ray install. This PR's doc: check API doc consistency step does that, and should pass with the four Data exemptions removed.

This PR was written with AI assistance (Claude Code). I reviewed the change.

🤖 Generated with Claude Code

The API policy (doc/source/ray-contribute/api-policy.md) requires
deprecated APIs to be documented, but the docs-side consistency check
failed any documented name that resolved to a @deprecated object. Keep
the private-name rule and drop the deprecated leg, remove the now-unused
live-annotation introspection, and drop the four Ray Data exemptions that
existed only to work around the rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman marked this pull request as ready for review September 30, 2026 19:13
@dstrodtman
dstrodtman requested a review from a team as a code owner September 30, 2026 19:13

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the API discrepancy check tool to align with the API policy, which requires @deprecated APIs to be documented. Consequently, the introspect_annotation_type method has been removed, and the validation logic in split_resolvable_and_broken_doc_apis has been simplified to only flag private-named APIs rather than deprecated ones. Related tests and configuration debt lists have been updated accordingly. There are no review comments to address, and I have no additional feedback to provide.

@dstrodtman
dstrodtman enabled auto-merge (squash) September 30, 2026 19:27
@github-actions github-actions Bot added the go add ONLY when ready to merge, run all tests label Sep 30, 2026
@dstrodtman
dstrodtman merged commit da2a468 into master Sep 30, 2026
7 checks passed
@dstrodtman
dstrodtman deleted the djs-260930-api-check-allow-deprecated branch September 30, 2026 19:44
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
ray-project#66612)

## Why

The [API
policy](https://docs.ray.io/en/latest/ray-contribute/api-policy.html)
says deprecated APIs must be documented. The docs-side half of `doc:
check API doc consistency`, added in ray-project#64420, did the opposite: it failed
any documented autosummary or autoclass entry that resolved to a
`@Deprecated` object. That's what blocked ray-project#66308, which deprecates
`read_clickhouse` and `write_clickhouse` and leaves them documented with
a deprecation notice, which is what the policy asks for.

Teams have been working around the rule instead. Ray Data kept its
deprecated APIs in `tracked_doc_debt` under a comment asking for them to
be removed from the docs.

## What

- `API.split_resolvable_and_broken_doc_apis` no longer flags deprecated
objects. It still fails documented names that don't resolve and
documented names that resolve to private objects (`_foo` or
`._internal.`), with the existing override-hook and `__all__` re-export
exemptions unchanged.
- It returns `(unresolved, private)` instead of `(unresolved,
non_public)`, and the error output says "private" instead of "deprecated
/ private."
- `API.introspect_annotation_type` is removed. The deprecated check was
its only caller. The inherited-annotation behavior it tested is still
covered through `Module` in `test_module.py`.
- The four Ray Data `tracked_doc_debt` entries for deprecated APIs are
removed: `AggregateFn`, `Dataset.iter_tf_batches`,
`Dataset.to_random_access_dataset`, and `read_unity_catalog`. All four
are `@Deprecated` in source, so the entries only existed to get around
this rule.

Out of scope: the policy also implies the code-side check should
*require* deprecated APIs to be documented. Today that check skips them.
There are about 90 `@Deprecated` decorators under `python/ray`, many on
undocumented methods, so turning that on is a per-team burndown and
belongs in a follow-up.

## Duplicate check

No open PR touches this rule. I searched open PRs for
`api_policy_check`, `cmd_check_api_discrepancy`, and "API doc
consistency" together with deprecation. ray-project#66308 is the PR this unblocks,
not a duplicate.

## Testing

```
python -m pytest ci/ray_ci/doc/test_api.py ci/ray_ci/doc/test_cmd_check_api_discrepancy.py ci/ray_ci/doc/test_module.py
40 passed
pre-commit run --files <changed files>   # ruff, black, docstyle, import order: all passed
```

I didn't run the checker end to end against a real Ray install. This
PR's `doc: check API doc consistency` step does that, and should pass
with the four Data exemptions removed.

This PR was written with AI assistance (Claude Code). I reviewed the
change.

🤖 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants