Repository navigation
[ci] Make the API param coverage check blocking - #67541
Conversation
Remove soft_fail from the `lint: API param coverage` step, after fixing the four failure patterns its warn-phase history turned up: - Skip parameters whose names start with `_`, Ray's private-kwarg convention. - Skip pydantic validators, whose `v` argument the framework supplies. - Skip Click commands and groups, whose options document themselves with `help=`. - When the depth-500 base-branch fetch leaves no merge-base, unshallow and retry instead of failing with no findings. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request makes the API parameter coverage check blocking in CI, improves git fetch robustness for shallow clones, and refactors the coverage tool to ignore private parameters, Pydantic validators, and Click commands. The review feedback suggests extending this exclusion to property setters (using the @x.setter decorator) to prevent false positives, along with adding a corresponding unit test to verify this behavior.
| _NON_DOCSTRING_PARAM_DECORATORS = frozenset( | ||
| { | ||
| "field_validator", | ||
| "model_validator", | ||
| "validator", | ||
| "root_validator", | ||
| "command", | ||
| "group", | ||
| } | ||
| ) |
There was a problem hiding this comment.
Public property setters (e.g., @x.setter) are typically documented in the class docstring or on the getter, rather than having their own Args: block. Without excluding them, any public property setter will be flagged as having undocumented parameters (like value). Adding "setter" to _NON_DOCSTRING_PARAM_DECORATORS prevents these false positives.
| _NON_DOCSTRING_PARAM_DECORATORS = frozenset( | |
| { | |
| "field_validator", | |
| "model_validator", | |
| "validator", | |
| "root_validator", | |
| "command", | |
| "group", | |
| } | |
| ) | |
| _NON_DOCSTRING_PARAM_DECORATORS = frozenset( | |
| { | |
| "field_validator", | |
| "model_validator", | |
| "validator", | |
| "root_validator", | |
| "command", | |
| "group", | |
| "setter", | |
| } | |
| ) |
There was a problem hiding this comment.
Done in 9addd7f. Added setter to _NON_DOCSTRING_PARAM_DECORATORS, and the docstring of has_non_docstring_param_decorator now notes that a setter's value is documented on the getter.
| """Start Ray processes.""" | ||
| ''' | ||
| ) | ||
| assert _check(base=None, head=head) == [] |
There was a problem hiding this comment.
Add a unit test to verify that public property setters (decorated with @x.setter) are correctly ignored by the parameter coverage check.
assert _check(base=None, head=head) == []
def test_property_setter_ignored():
head = _src(
'''
@PublicAPI
class C:
"""Summary."""
@property
def x(self):
"""The x property."""
return 1
@x.setter
def x(self, value):
pass
'''
)
assert _check(base=None, head=head) == []There was a problem hiding this comment.
Added test_property_setter_ignored in 9addd7f. It failed before the fix (it flagged C.x for an undocumented value) and passes now.
A setter's value is documented on the getter, so a public @x.setter was flagged for an undocumented value parameter. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Description
This PR makes the
lint: API param coveragestep a required check by removingsoft_fail: true. The step was added in #64788 on 2026-08-11. A comment in the step said to removesoft_fail"once the false-positive rate is confirmed low." This PR measures that rate from the step's CI history and fixes the four failure patterns the history turned up.While the step only warns, undocumented parameters still land on master. #65633, #66602, and #66950 all merged with the check failing.
Warn-phase metrics
These numbers come from every
premergebuild from 2026-08-11 to 2026-10-29, pulled from the Buildkite API.Each failure falls into one of three groups:
@PublicAPIcallable has noArgs:entry. Two of these PRs, #65823 and #65839, were stacked on #65633 before it merged and report its findings again.vargument of a pydantic@field_validator. #66255 flagged the private kwarg_direct_http. #67258 flagged an option of theray startClick command, whichhelp=documents.could not determine merge-baseand no findings. The branches of #65437 and #65809 forked 520 and 598 master commits before their builds. The step'sgit fetch --depth=500makes the full CI clone shallow, so their merge-base wasn't in the fetched history.That's 13 spurious failures out of 3,453 runs, about 0.4%, or 13 of 55 failures. Each one would block a PR once the step is required, so this PR fixes all four patterns before removing
soft_fail.Changes
_-prefixed parameters:api_param_coverage.pyskips parameters whose names start with_. That's Ray's convention for private kwargs, such asray.put(_owner=...),tune.run(_remote=...), andDeployment.options(_internal=...). On master, 31 public callables have such parameters.field_validator,model_validator,validator,root_validator,command, orgroup. On master, this removes 59 callables from scope. All of them are Click commands, such asray startandray job submit, or pydantic validators on Serve config models. None of them is a Python API whose parameters a docstring documents.@<name>.setter. A setter'svalueis documented on the property's getter, which is the docstring Sphinx renders, not in anArgs:section of its own.git merge-basefails after the depth-500 fetch,ci/lint/lint.shrunsgit fetch --unshallowand retries. A branch within 500 commits of the base never reaches that path. The Python check still fails closed if the base can't be resolved after that..buildkite/lint.rayci.ymldropssoft_fail: trueand the warn-phase comment. The--blockinghelp text incmd_check_api_param_coverage.pyno longer describes a warn phase.Related issues
Follow-up to #64788.
Additional information
Testing
pytest ci/ray_ci/doc/test_api_param_coverage.py: 40 passed. That's the 28 existing tests plus 12 new cases covering_params, each validator spelling, Click command forms, and property setters. The test comments name the real PR that motivated each one.masterand a branch forked at commit 50,git fetch --depth=500followed bygit merge-basefails, which reproduces the CI failure. With the newlint.shblock, it resolves the correct fork commit. A branch forked 10 commits back resolves without the fallback.pre-commit runon the changed files passes, including ruff, black, shellcheck, and docstyle.Duplicate check
gh pr list --state open --search "param coverage"and--search "api_param_coverage"return no open PR that touches this check. The script hasn't changed since #65391 on 2026-08-14.AI assistance
I used Claude Code to pull and classify the Buildkite history, draft the changes, and run the replay. I reviewed every changed line and the classification of every failing PR.
🤖 Generated with Claude Code