Skip to content

[ci/doc] Fix rllib API-doc consistency check crashing on empty whitelist - #64783

Merged
elliot-barn merged 1 commit into
ray-project:masterfrom
dstrodtman:djs-260715-rllib-whitelist-set
Jul 15, 2026
Merged

elliot-barn merged 1 commit into
ray-project:masterfrom
dstrodtman:djs-260715-rllib-whitelist-set

Conversation

@dstrodtman

Copy link
Copy Markdown
Contributor

Why are these changes needed?

The per-team API-doc consistency check (ci/ray_ci/doc/cmd_check_api_discrepancy.py) crashes on the rllib team:

File "ci/ray_ci/doc/cmd_check_api_discrepancy.py", line 166, in _check_team
    doc_only_whitelist = white_list_apis | config.get("doc_only_whitelist", set())
TypeError: unsupported operand type(s) for |: 'dict' and 'set'

The rllib config declared its empty whitelist as {}, which Python parses as an empty dict, not an empty set. Every other team uses a non-empty set literal, so rllib was the only team whose white_list_apis was a dict.

The mismatch stayed latent while white_list_apis was used only in in membership tests, where an empty dict and an empty set behave identically. The reverse/dedup policy work (#64420) added a white_list_apis | config.get("doc_only_whitelist", set()) union, and dict | set raises TypeError — breaking the check for every doc-scoped PR that reaches the rllib team.

The fix declares the empty whitelist as set() so its type matches the other teams and the union operand.

Related issue number

N/A — regression from #64420.

Checks

  • I've signed off every commit (git commit -s).
  • I've made sure the tests are passing. Note that there might be a few flaky tests.
  • Testing Strategy
    • Unit tests

The per-team API-doc consistency check dies on the rllib team with:

    TypeError: unsupported operand type(s) for |: 'dict' and 'set'

The rllib config declared its (empty) whitelist as `{}`, which Python
parses as an empty dict, not an empty set. Every other team uses a
non-empty set literal, so rllib was the only team holding a dict.

The bug stayed latent while `white_list_apis` was used only in `in`
membership tests, where an empty dict and an empty set behave the same.
The reverse/dedup policy work added `white_list_apis | config.get(
"doc_only_whitelist", set())`, and `dict | set` raises, breaking the
check for every doc-scoped PR that reaches the rllib team.

Declare the empty whitelist as `set()` so its type matches the other
teams and the union operand.

Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman requested a review from a team as a code owner July 15, 2026 18:44

@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 configuration in ci/ray_ci/doc/cmd_check_api_discrepancy.py to initialize white_list_apis for rllib as an empty set (set()) instead of an empty dictionary ({}). There are no review comments, and I have no additional feedback to provide.

@dstrodtman dstrodtman added the go add ONLY when ready to merge, run all tests label Jul 15, 2026
@elliot-barn
elliot-barn merged commit 98c9eb7 into ray-project:master Jul 15, 2026
3 checks passed
elliot-barn pushed a commit that referenced this pull request Jul 15, 2026
…d debt (#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 #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

- [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]>
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]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…ist (ray-project#64783)

## Why are these changes needed?

The per-team API-doc consistency check
(`ci/ray_ci/doc/cmd_check_api_discrepancy.py`) crashes on the `rllib`
team:

```
File "ci/ray_ci/doc/cmd_check_api_discrepancy.py", line 166, in _check_team
    doc_only_whitelist = white_list_apis | config.get("doc_only_whitelist", set())
TypeError: unsupported operand type(s) for |: 'dict' and 'set'
```

The `rllib` config declared its empty whitelist as `{}`, which Python
parses as an empty **dict**, not an empty set. Every other team uses a
non-empty set literal, so `rllib` was the only team whose
`white_list_apis` was a dict.

The mismatch stayed latent while `white_list_apis` was used only in `in`
membership tests, where an empty dict and an empty set behave
identically. The reverse/dedup policy work (ray-project#64420) added a
`white_list_apis | config.get("doc_only_whitelist", set())` union, and
`dict | set` raises `TypeError` — breaking the check for every
doc-scoped PR that reaches the `rllib` team.

The fix declares the empty whitelist as `set()` so its type matches the
other teams and the union operand.

## Related issue number

N/A — regression from ray-project#64420.

## Checks

- [x] I've signed off every commit (`git commit -s`).
- [x] I've made sure the tests are passing. Note that there might be a
few flaky tests.
- Testing Strategy
   - [x] Unit tests

Signed-off-by: Douglas Strodtman <[email protected]>
Signed-off-by: 400Ping <[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]>
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