Skip to content

DOC Fix broken ref #30407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 4, 2024
Merged

Conversation

jeremiedbb
Copy link
Member

Follow-up of #30316

Seen in the 1.6 release PR (see). I don't know why it wasn't caught by the CI in the original PR...

@jeremiedbb jeremiedbb added the Quick Review For PRs that are quick to review label Dec 4, 2024
Copy link

github-actions bot commented Dec 4, 2024

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 8b8648d. Link to the linter CI: here

Copy link
Member

@lesteve lesteve left a comment

Choose a reason for hiding this comment

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

Thanks, I checked the rendered docs and they look good. Setting auto-merge

@lesteve lesteve enabled auto-merge (squash) December 4, 2024 16:05
@lesteve lesteve merged commit 29f6ca3 into scikit-learn:main Dec 4, 2024
35 checks passed
jeremiedbb added a commit to jeremiedbb/scikit-learn that referenced this pull request Dec 4, 2024
jeremiedbb added a commit that referenced this pull request Dec 6, 2024
virchan pushed a commit to virchan/scikit-learn that referenced this pull request Dec 9, 2024
@lucyleeow
Copy link
Member

Whoops bad merge I think! Thanks @jeremiedbb !

@lesteve
Copy link
Member

lesteve commented Dec 10, 2024

Like @jeremiedbb, I would have expected it to be caught by the CI, I guess adding --nitpicky (same as -n) to warn about reference issues would be a first step but not super useful in itself.

Whether it is a good idea to turn this warning into an error is left as an exercise:

  • -W i.e. --fail-on-error seems way too strict. For example right now it fails because an extension has not defined its thread-safety

    Warning, treated as error:
    the sphinxcontrib.sass extension does not declare if it is safe for parallel reading, assuming it isn't
    
  • grepping the log file for some messages seems doable but would add even more logic to the already involved build_doc.sh script ...

The warnings looks like this:

/home/lesteve/dev/scikit-learn/sklearn/inspection/_permutation_importance.py:docstring of sklearn.inspection._permutation_importance.permutation_importance:32: WARNING: undefined label: 'scoring_nonexistent'

@lucyleeow
Copy link
Member

lucyleeow commented Dec 10, 2024

Looking at build_doc.sh if there is a warning in files changed in the PR, CI should fail

affected_doc_warnings() {
files=$(git diff --name-only origin/main...$CIRCLE_SHA1)
# Look for sphinx warnings only in files affected by the PR
if [ -n "$files" ]
then
for af in ${files[@]}
do
warn+=`grep WARNING ~/log.txt | grep $af`
done
fi
echo "$warn"
}

So maybe we didn't pick up the error in #30316 because that file did not change (I accepted the merge change from main).

I think this is really an edge case but a potential fix could be to regularly (weekly?) run doc build on main and check for warnings (filtering some out). (i.e. a weekly CI job, not related to PRs)

Note I did build the docs locally a little while ago and noticed some reference (?) warnings, which was on my to-do list to fix a little while ago but I never got round to it 😅


For proof, in #30319 I did a bad merge and there was an undefined label, which did cause CI failure:

https://app.circleci.com/pipelines/github/scikit-learn/scikit-learn/63923/workflows/9340d0d9-da2b-48e7-aa9d-a1e6e4e45c67/jobs/293464

(Note that if you search for 'warning' in the output, there are many other warnings )

This was fixed in commit d25d36b , where you can see CIs passed (i.e. the other warnings did not cause the CI failure, it was just the undefined label).

@lesteve
Copy link
Member

lesteve commented Dec 11, 2024

Indeed, warnings should be turned into errors in

if [ "$warnings" != "/home/circleci/project/ no warnings" ]
then
echo "Sphinx generated warnings when building the documentation related to files modified in this PR."
echo "Please check doc/_build/html/stable/_changed.html"
exit 1

So maybe we didn't pick up the error in #30316 because that file did not change (I accepted the merge change from main).

Ah yeah good point, the issue happened in an unchanged file and build_doc.sh is only checking warnings that are in modified files.

Not entirely sure whether it's worth doing something about it to be honest ...

@lucyleeow
Copy link
Member

Agreed, happy to leave it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation module:ensemble Quick Review For PRs that are quick to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants