Skip to content

[ci/doc] Split API-doc whitelist into permanent exemptions and tracked debt - #64786

Merged
elliot-barn merged 2 commits into
ray-project:masterfrom
dstrodtman:ci-doc-split-permanent-vs-tracked-exemptions
Jul 15, 2026
Merged

elliot-barn merged 2 commits into
ray-project:masterfrom
dstrodtman:ci-doc-split-permanent-vs-tracked-exemptions

Conversation

@dstrodtman

Copy link
Copy Markdown
Contributor

Why are these changes needed?

The per-team white_list_apis sets in ci/ray_ci/doc/cmd_check_api_discrepancy.py are the accepted-exceptions list for the "every @PublicAPI symbol must be documented" check. Today one flat set per team mixes two very different kinds of exemption:

  • Permanent, intentional — deprecated APIs documented in a separate file (Train's deprecated.rst), an intentional alias (Tune's ConcurrencyLimiter), a symbol that genuinely can't be deprecated (Data's RandomAccessDataset).
  • Doc debt — @PublicAPI symbols still owed a document-or-deprecate decision, several parked behind TODOs for a long time.

Reading one flat set, you can't tell "correct and permanent" from "we forgot" without opening each comment.

What this changes

Split each team's exemptions into two keys — white_list_apis (permanent) and tracked_doc_debt (owed a decision) — and union them at check time. The set the check accepts is unchanged; this is purely a legibility change so a reviewer, and tooling, can tell the two halves apart.

Current split: 7 permanent (Train 5, Data 1, Tune 1) and 22 tracked debt (Core 12, Serve 8, Data 1, Tune 1).

Follow-up to #64783, which fixed the empty RLlib whitelist crashing this check.

A separate effort is routing each team's tracked_doc_debt entries to their owners for the document-or-deprecate decisions; clearing an entry (documenting it, deprecating it, or removing an erroneous public annotation) then removes it from the list.

Related issue number

Follow-up to #64783.

Checks

  • I've signed off every commit (git commit -s) to certify the DCO.
  • Unit tests pass: bazel test //ci/ray_ci/doc:test_cmd_check_api_discrepancy (9 passed, incl. a new test that a tracked_doc_debt entry is honored identically to a white_list_apis entry).
  • Behavior-preserving: verified each team's effective whitelist (white_list_apis | tracked_doc_debt) is byte-for-byte unchanged from before the split.

…d debt

The per-team `white_list_apis` sets in the API-doc consistency check mix two
kinds of exemption: permanent, intentional ones (deprecated APIs documented in
a separate file, an intentional alias, genuinely un-deprecatable symbols) and
doc debt still owed a document-or-deprecate decision. Reading one flat set, you
can't tell "correct and permanent" from "we forgot" without checking each
comment.

Split each team's exemptions into two keys, `white_list_apis` (permanent) and
`tracked_doc_debt` (owed a decision), unioned at check time so the set the
check accepts is unchanged. Add a test that a symbol in `tracked_doc_debt` is
honored the same as one in `white_list_apis`.

Current split: 7 permanent (Train 5, Data 1, Tune 1) and 22 tracked debt
(Core 12, Serve 8, Data 1, Tune 1). Follow-up to ray-project#64783, which fixed the empty
RLlib whitelist crashing this check.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman requested a review from a team as a code owner July 15, 2026 19:29

@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 refactors the API discrepancy check tool to separate permanent API exemptions (white_list_apis) from temporary documentation debt (tracked_doc_debt). While the two lists are unioned for the undocumented public API check, the reviewer identified a potential issue where this unioning also affects the doc_only_whitelist check later in the script. This could allow broken documented APIs in the debt list to bypass resolution checks. It is recommended to keep these lists separate when constructing the doc_only_whitelist.

@dstrodtman dstrodtman added go add ONLY when ready to merge, run all tests and removed go add ONLY when ready to merge, run all tests labels Jul 15, 2026
@elliot-barn
elliot-barn merged commit ae127bd into ray-project:master Jul 15, 2026
5 checks passed
dstrodtman added a commit to dstrodtman/ray that referenced this pull request Jul 16, 2026
Clears the remaining data-team failures the fail-loud API-doc consistency
check now surfaces, both by extending existing exemption keys (not the
coverage whitelist):

- intentional_duplicate_apis: the Dataset.to_* / write_* conversion and write
  methods are each documented twice on purpose -- in the generated
  ray.data.Dataset.rst method table (included by dataset.rst) and in
  saving_data.rst's save-topic grouping -- exactly like the existing
  to_arrow_refs / to_numpy_refs / to_pandas_refs entries.
- doc_only_whitelist (new key on the data config): public APIs re-exported from
  ray.data.__all__ whose implementation lives under _internal
  (ActorPoolStrategy, TaskPoolStrategy, ExecutionOptions, ExecutionResources,
  MixStoppingCondition, RandomSeedConfig). They resolve and are documented; only
  the resolve check's private-name heuristic flags them. This key feeds
  split_resolvable_and_broken_doc_apis only, not the must-be-documented check.

Not addressed here (data-team decisions): deprecated entries still documented
(aggregate.AggregateFn, Dataset.iter_tf_batches, read_unity_catalog) and the
private-named namespace_expressions accessor classes.

MERGE NOTE -- reconciling with ray-project#64786 (expected to merge first):
  ray-project#64786 splits each team's white_list_apis into white_list_apis (permanent) +
  tracked_doc_debt (owed a decision), unioned only for the must-be-documented
  check. This commit touches neither of those keys. Both additions here go to
  intentional_duplicate_apis and the new doc_only_whitelist, which ray-project#64786 does
  not modify. On conflict in TEAM_API_CONFIGS["data"], keep both sides: take
  ray-project#64786's white_list_apis/tracked_doc_debt split AND these two blocks. No entry
  moves between the coverage whitelist and these keys.

  Follow-up worth filing: teach the check to treat ray.data.__all__ membership
  as public so the six _internal re-exports need no doc_only_whitelist entry.

Signed-off-by: Douglas Strodtman <[email protected]>
ArturNiederfahrenhorst added a commit that referenced this pull request Jul 20, 2026
…ies (#64807)

#64420 added reverse (documented-must-resolve-to-public) and dedup
(documented-exactly-once) policies to the API-doc consistency check, and
#64783/#64786 populated per-team exemptions for every team except RLlib
(whose white_list_apis was left empty). The stricter check now flags ~30
pre-existing RLlib doc entries, failing the "doc: check API doc
consistency" premerge job on every PR that merges current master.

This fixes the RLlib side:

Unresolved doc entries:
- De-double autoclass targets that combined `.. currentmodule::` with a
fully-qualified name (RLlink, ConnectorV2, ConnectorPipelineV2, the
observation preprocessors, and the RLModule `apis` classes) by making
the autoclass argument relative to its currentmodule.
- RLModuleSpec dataclass fields -> `.. autoattribute:: ... :no-index:`
(mirrors the existing MultiRLModuleSpec block).
- RLModule instance attributes (observation_space, action_space,
inference_only, model_config) are assigned in setup(), not on the class,
so they resolve to None; exempt them via doc_only_whitelist.

Documented private/dunder objects:
- Whitelist the intentional override contract (RLModule._forward*,
Learner._make_module).
- Remove doc entries for internal helpers (Learner._check_is_built /
_check_registered_optimizer / _set_optimizer_lr / _get_clip_function,
Scheduler._create_tensor_variable, OfflineData/OfflinePreLearner
privates, SingleAgentEpisode/MultiAgentEpisode.__len__).

Duplicate documentation:
- Mark intentional cross-page duplicates as intentional_duplicate_apis
(AlgorithmConfig.build_learner / build_learner_group / learners;
Checkpointable.save_to_path / restore_from_path, inherited and shown on
each subclass page).

---------

Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
dstrodtman added a commit that referenced this pull request Aug 11, 2026
…eck (#65340)

## Why this change is needed

The API-doc consistency check (`ci/ray_ci/doc/`) classifies a documented
API as non-public when its canonical name resolves under a private
module, keying on the `._internal.` segment in `API._is_private_name()`.

Several public Ray Data APIs are re-exported into `ray.data.__all__`
while their implementation lives in `_internal`, so the heuristic flags
names that are legitimately public and correctly documented. Those false
positives were suppressed with a per-team `doc_only_whitelist` — a
hand-maintained list that had to grow by one entry every time a team
re-exported another API from a private module.

## What this change does

Reads the export instead of guessing from the path. A name that the
documented module declares in its `__all__` is public regardless of
where its implementation lives, so the new `API._is_public_reexport()`
exempts it from the private-name rule and the list goes away.

The exemption is deliberately narrow, so genuinely private symbols stay
flagged:

- **Only a public module's `__all__` counts.** A name documented through
a private path (`ray.data._internal.foo.Bar`) keeps its verdict — a
private module's `__all__` is not a public contract.
- **An underscore leaf stays private** on either side of the re-export.
`__all__` membership can never promote a `_foo` name.
- **Module-attribute reachability alone changes nothing.** Absent an
explicit `__all__` entry, the verdict is unchanged.

Scope is limited to the resolve check's non-public classification
(`split_resolvable_and_broken_doc_apis`). The "every `@PublicAPI` must
be documented" check and the duplicate-documentation check are
untouched, as is `API.is_public()` on the code side.

## Whitelist entries retired

All seven `doc_only_whitelist` entries on the data team config:

| Retired entry | Public name it's documented under |
|---|---|
| `ray.data._internal.compute.ActorPoolStrategy` |
`ray.data.ActorPoolStrategy` |
| `ray.data._internal.compute.TaskPoolStrategy` |
`ray.data.TaskPoolStrategy` |
|
`ray.data._internal.execution.interfaces.execution_options.ExecutionOptions`
| `ray.data.ExecutionOptions` |
|
`ray.data._internal.execution.interfaces.execution_options.ExecutionResources`
| `ray.data.ExecutionResources` |
|
`ray.data._internal.logical.operators.n_ary_operator.MixStoppingCondition`
| `ray.data.MixStoppingCondition` |
| `ray.data._internal.random_config.RandomSeedConfig` |
`ray.data.RandomSeedConfig` |
| `ray.llm._internal.batch.processor.base.Processor` |
`ray.data.llm.Processor` |

Each is present in `ray.data.__all__` or `ray.data.llm.__all__`, and
each is documented through its public `currentmodule` in
`doc/source/data/api/`. None carries a `@Deprecated` annotation, so none
relied on the whitelist for anything beyond the private-path suppression
this change replaces.

RLlib's `doc_only_whitelist` is a different case — instance attributes
assigned in `setup()` that the import walk can't resolve — and is
untouched.

## Related PRs

- #64423 added the `doc_only_whitelist` workaround.
- #64786 split the whitelists into permanent exemptions and tracked
debt.

## Checks

- [x] I've signed off every commit (`git commit --signoff`).
- [x] I've made sure the tests are passing.
- Testing Strategy
   - [x] Unit tests

`ci/ray_ci/doc/test_api.py` gains coverage for the re-export case, for
the same object documented through its private canonical path, and for
the negative control — a class importable from the same public module
but absent from its `__all__`, which must still be flagged. A private
mock subpackage (`ci/ray_ci/doc/mock/_internal/`) provides the fixture
so the test exercises the real `._internal.` code path rather than a
spoofed `__module__`.

Verified locally: the four `ci/ray_ci/doc` unit-test files pass (44
tests), and `pre-commit` is clean on the changed files. The end-to-end
`api_policy_check` step needs a bazel-built Ray in the docbuild image,
so the whitelist retirement is verified statically here (`__all__`
membership and annotations read from source, per the table above) and
premerge's `doc_api_policy_check` is the decisive check.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…d debt (ray-project#64786)

## Why are these changes needed?

The per-team `white_list_apis` sets in
`ci/ray_ci/doc/cmd_check_api_discrepancy.py` are the accepted-exceptions
list for the "every `@PublicAPI` symbol must be documented" check. Today
one flat set per team mixes two very different kinds of exemption:

- **Permanent, intentional** — deprecated APIs documented in a separate
file (Train's `deprecated.rst`), an intentional alias (Tune's
`ConcurrencyLimiter`), a symbol that genuinely can't be deprecated
(Data's `RandomAccessDataset`).
- **Doc debt** — `@PublicAPI` symbols still owed a document-or-deprecate
decision, several parked behind `TODO`s for a long time.

Reading one flat set, you can't tell "correct and permanent" from "we
forgot" without opening each comment.

## What this changes

Split each team's exemptions into two keys — `white_list_apis`
(permanent) and `tracked_doc_debt` (owed a decision) — and union them at
check time. The set the check accepts is **unchanged**; this is purely a
legibility change so a reviewer, and tooling, can tell the two halves
apart.

Current split: **7 permanent** (Train 5, Data 1, Tune 1) and **22
tracked debt** (Core 12, Serve 8, Data 1, Tune 1).

Follow-up to ray-project#64783, which fixed the empty RLlib whitelist crashing this
check.

A separate effort is routing each team's `tracked_doc_debt` entries to
their owners for the document-or-deprecate decisions; clearing an entry
(documenting it, deprecating it, or removing an erroneous public
annotation) then removes it from the list.

## Related issue number

Follow-up to ray-project#64783.

## Checks

- [x] I've signed off every commit (`git commit -s`) to certify the DCO.
- [x] Unit tests pass: `bazel test
//ci/ray_ci/doc:test_cmd_check_api_discrepancy` (9 passed, incl. a new
test that a `tracked_doc_debt` entry is honored identically to a
`white_list_apis` entry).
- [x] Behavior-preserving: verified each team's effective whitelist
(`white_list_apis | tracked_doc_debt`) is byte-for-byte unchanged from
before the split.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: 400Ping <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…ies (ray-project#64807)

ray-project#64420 added reverse (documented-must-resolve-to-public) and dedup
(documented-exactly-once) policies to the API-doc consistency check, and
ray-project#64783/ray-project#64786 populated per-team exemptions for every team except RLlib
(whose white_list_apis was left empty). The stricter check now flags ~30
pre-existing RLlib doc entries, failing the "doc: check API doc
consistency" premerge job on every PR that merges current master.

This fixes the RLlib side:

Unresolved doc entries:
- De-double autoclass targets that combined `.. currentmodule::` with a
fully-qualified name (RLlink, ConnectorV2, ConnectorPipelineV2, the
observation preprocessors, and the RLModule `apis` classes) by making
the autoclass argument relative to its currentmodule.
- RLModuleSpec dataclass fields -> `.. autoattribute:: ... :no-index:`
(mirrors the existing MultiRLModuleSpec block).
- RLModule instance attributes (observation_space, action_space,
inference_only, model_config) are assigned in setup(), not on the class,
so they resolve to None; exempt them via doc_only_whitelist.

Documented private/dunder objects:
- Whitelist the intentional override contract (RLModule._forward*,
Learner._make_module).
- Remove doc entries for internal helpers (Learner._check_is_built /
_check_registered_optimizer / _set_optimizer_lr / _get_clip_function,
Scheduler._create_tensor_variable, OfflineData/OfflinePreLearner
privates, SingleAgentEpisode/MultiAgentEpisode.__len__).

Duplicate documentation:
- Mark intentional cross-page duplicates as intentional_duplicate_apis
(AlgorithmConfig.build_learner / build_learner_group / learners;
Checkpointable.save_to_path / restore_from_path, inherited and shown on
each subclass page).

---------

Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: 400Ping <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…eck (ray-project#65340)

## Why this change is needed

The API-doc consistency check (`ci/ray_ci/doc/`) classifies a documented
API as non-public when its canonical name resolves under a private
module, keying on the `._internal.` segment in `API._is_private_name()`.

Several public Ray Data APIs are re-exported into `ray.data.__all__`
while their implementation lives in `_internal`, so the heuristic flags
names that are legitimately public and correctly documented. Those false
positives were suppressed with a per-team `doc_only_whitelist` — a
hand-maintained list that had to grow by one entry every time a team
re-exported another API from a private module.

## What this change does

Reads the export instead of guessing from the path. A name that the
documented module declares in its `__all__` is public regardless of
where its implementation lives, so the new `API._is_public_reexport()`
exempts it from the private-name rule and the list goes away.

The exemption is deliberately narrow, so genuinely private symbols stay
flagged:

- **Only a public module's `__all__` counts.** A name documented through
a private path (`ray.data._internal.foo.Bar`) keeps its verdict — a
private module's `__all__` is not a public contract.
- **An underscore leaf stays private** on either side of the re-export.
`__all__` membership can never promote a `_foo` name.
- **Module-attribute reachability alone changes nothing.** Absent an
explicit `__all__` entry, the verdict is unchanged.

Scope is limited to the resolve check's non-public classification
(`split_resolvable_and_broken_doc_apis`). The "every `@PublicAPI` must
be documented" check and the duplicate-documentation check are
untouched, as is `API.is_public()` on the code side.

## Whitelist entries retired

All seven `doc_only_whitelist` entries on the data team config:

| Retired entry | Public name it's documented under |
|---|---|
| `ray.data._internal.compute.ActorPoolStrategy` |
`ray.data.ActorPoolStrategy` |
| `ray.data._internal.compute.TaskPoolStrategy` |
`ray.data.TaskPoolStrategy` |
|
`ray.data._internal.execution.interfaces.execution_options.ExecutionOptions`
| `ray.data.ExecutionOptions` |
|
`ray.data._internal.execution.interfaces.execution_options.ExecutionResources`
| `ray.data.ExecutionResources` |
|
`ray.data._internal.logical.operators.n_ary_operator.MixStoppingCondition`
| `ray.data.MixStoppingCondition` |
| `ray.data._internal.random_config.RandomSeedConfig` |
`ray.data.RandomSeedConfig` |
| `ray.llm._internal.batch.processor.base.Processor` |
`ray.data.llm.Processor` |

Each is present in `ray.data.__all__` or `ray.data.llm.__all__`, and
each is documented through its public `currentmodule` in
`doc/source/data/api/`. None carries a `@Deprecated` annotation, so none
relied on the whitelist for anything beyond the private-path suppression
this change replaces.

RLlib's `doc_only_whitelist` is a different case — instance attributes
assigned in `setup()` that the import walk can't resolve — and is
untouched.

## Related PRs

- ray-project#64423 added the `doc_only_whitelist` workaround.
- ray-project#64786 split the whitelists into permanent exemptions and tracked
debt.

## Checks

- [x] I've signed off every commit (`git commit --signoff`).
- [x] I've made sure the tests are passing.
- Testing Strategy
   - [x] Unit tests

`ci/ray_ci/doc/test_api.py` gains coverage for the re-export case, for
the same object documented through its private canonical path, and for
the negative control — a class importable from the same public module
but absent from its `__all__`, which must still be flagged. A private
mock subpackage (`ci/ray_ci/doc/mock/_internal/`) provides the fixture
so the test exercises the real `._internal.` code path rather than a
spoofed `__module__`.

Verified locally: the four `ci/ray_ci/doc` unit-test files pass (44
tests), and `pre-commit` is clean on the changed files. The end-to-end
`api_policy_check` step needs a bazel-built Ray in the docbuild image,
so the whitelist retirement is verified statically here (`__all__`
membership and annotations read from source, per the table above) and
premerge's `doc_api_policy_check` is the decisive check.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Signed-off-by: 400Ping <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…eck (ray-project#65340)

## Why this change is needed

The API-doc consistency check (`ci/ray_ci/doc/`) classifies a documented
API as non-public when its canonical name resolves under a private
module, keying on the `._internal.` segment in `API._is_private_name()`.

Several public Ray Data APIs are re-exported into `ray.data.__all__`
while their implementation lives in `_internal`, so the heuristic flags
names that are legitimately public and correctly documented. Those false
positives were suppressed with a per-team `doc_only_whitelist` — a
hand-maintained list that had to grow by one entry every time a team
re-exported another API from a private module.

## What this change does

Reads the export instead of guessing from the path. A name that the
documented module declares in its `__all__` is public regardless of
where its implementation lives, so the new `API._is_public_reexport()`
exempts it from the private-name rule and the list goes away.

The exemption is deliberately narrow, so genuinely private symbols stay
flagged:

- **Only a public module's `__all__` counts.** A name documented through
a private path (`ray.data._internal.foo.Bar`) keeps its verdict — a
private module's `__all__` is not a public contract.
- **An underscore leaf stays private** on either side of the re-export.
`__all__` membership can never promote a `_foo` name.
- **Module-attribute reachability alone changes nothing.** Absent an
explicit `__all__` entry, the verdict is unchanged.

Scope is limited to the resolve check's non-public classification
(`split_resolvable_and_broken_doc_apis`). The "every `@PublicAPI` must
be documented" check and the duplicate-documentation check are
untouched, as is `API.is_public()` on the code side.

## Whitelist entries retired

All seven `doc_only_whitelist` entries on the data team config:

| Retired entry | Public name it's documented under |
|---|---|
| `ray.data._internal.compute.ActorPoolStrategy` |
`ray.data.ActorPoolStrategy` |
| `ray.data._internal.compute.TaskPoolStrategy` |
`ray.data.TaskPoolStrategy` |
|
`ray.data._internal.execution.interfaces.execution_options.ExecutionOptions`
| `ray.data.ExecutionOptions` |
|
`ray.data._internal.execution.interfaces.execution_options.ExecutionResources`
| `ray.data.ExecutionResources` |
|
`ray.data._internal.logical.operators.n_ary_operator.MixStoppingCondition`
| `ray.data.MixStoppingCondition` |
| `ray.data._internal.random_config.RandomSeedConfig` |
`ray.data.RandomSeedConfig` |
| `ray.llm._internal.batch.processor.base.Processor` |
`ray.data.llm.Processor` |

Each is present in `ray.data.__all__` or `ray.data.llm.__all__`, and
each is documented through its public `currentmodule` in
`doc/source/data/api/`. None carries a `@Deprecated` annotation, so none
relied on the whitelist for anything beyond the private-path suppression
this change replaces.

RLlib's `doc_only_whitelist` is a different case — instance attributes
assigned in `setup()` that the import walk can't resolve — and is
untouched.

## Related PRs

- ray-project#64423 added the `doc_only_whitelist` workaround.
- ray-project#64786 split the whitelists into permanent exemptions and tracked
debt.

## Checks

- [x] I've signed off every commit (`git commit --signoff`).
- [x] I've made sure the tests are passing.
- Testing Strategy
   - [x] Unit tests

`ci/ray_ci/doc/test_api.py` gains coverage for the re-export case, for
the same object documented through its private canonical path, and for
the negative control — a class importable from the same public module
but absent from its `__all__`, which must still be flagged. A private
mock subpackage (`ci/ray_ci/doc/mock/_internal/`) provides the fixture
so the test exercises the real `._internal.` code path rather than a
spoofed `__module__`.

Verified locally: the four `ci/ray_ci/doc` unit-test files pass (44
tests), and `pre-commit` is clean on the changed files. The end-to-end
`api_policy_check` step needs a bazel-built Ray in the docbuild image,
so the whitelist retirement is verified statically here (`__all__`
membership and annotations read from source, per the table above) and
premerge's `doc_api_policy_check` is the decisive check.

---------

Signed-off-by: Douglas Strodtman <[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