Repository navigation
fix(link-checker): distinguish empty diffs from unavailable bases - #1418
BichengWang wants to merge 2 commits into
Conversation
Treat a successful diff with no Markdown or notebook changes as authoritative. Falling back to older refs can audit unrelated historical files and report broken links outside the contribution. Cover empty and Python-only diffs, unavailable-ref fallback, and CLI no-op behavior with offline regressions.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the reliability of the link checker's Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates tools/check_all_links.py to return the list of changed files once a successful comparison base is established, even if the list is empty, and adds comprehensive unit tests in tools/test_check_all_links.py. Feedback on the changes points out that the fallback logic is broken when no base branch can be determined, as returning a falsy value causes the script to exit early instead of falling back to scanning all files. A code suggestion is provided to properly handle this fallback behavior.
--changedfalls through to older refs when a successful diff contains no changed Markdown or notebooks. A branch identical toorigin/maincan consequently audit unrelated notebooks. When every comparison base is unavailable, the fallback also reports no modified files and exits without scanning the repository.Stop at the first successful diff, including empty and Python-only diffs. Return
Nonewhen no base is available so the CLI performs the promised full audit. Add selection and CLI regressions, including a fresh Git repository without commits.Validation:
python3 -m unittest tools/test_check_all_links.py -v: 15 tests pass on Python 3.11. The two unavailable-base regressions fail before the fallback fix.--changedCLI, Pyink on changed lines, Python compilation, andgit diff --checkpass.