fix: use two-dot diff in check_llms_txt.py's PR-added-page detection - #184
Merged
Conversation
Three-dot diff needs a merge-base, which fails in CI: the checkout action fetches the PR's merge ref shallowly (--depth=1), and the script's own git fetch for the base ref is also shallow and separate, so the two commits share no locally-available common ancestor. The merge-base computation errors out, is silently swallowed, and added_page_slugs() returns empty — so a page added in the same PR is reported as a broken link instead of "pending deploy" (seen in #182). Two-dot diff compares the two tree snapshots directly and needs no shared ancestry, so it works regardless of fetch depth. It's also equivalent to three-dot's result here, since main-tip is already a parent of the checked-out merge commit, making the merge-base trivially main-tip itself. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
zoltan-baba
requested review from
aorcsik,
ilanazholobovsky and
matenadasdi
as code owners
August 14, 2026 12:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The "pending deploy" carve-out added in #179 (skip failing the build for links to pages added in the same PR) doesn't actually work in CI, as seen in #182: a genuinely new page (
managing-rde-access.mdx, matching slug inllms.txt) was still reported as a broken link.Root cause:
added_page_slugs()computesgit diff --name-status origin/<base>...HEAD(three-dot), which requires Git to find a merge-base between the two refs. Butactions/checkoutchecks out the PR's merge ref with--depth=1, and the script's owngit fetch --depth=1 origin <base>is a separate shallow fetch — so the two commits share no common ancestor commit actually present in the local repo. The merge-base lookup fails, is silently swallowed by the existingexceptblock, andnew_slugscomes back empty.Fix: use two-dot diff instead. It compares the two tree snapshots directly without needing shared ancestry, so it's unaffected by shallow-fetch depth. It's also equivalent to the three-dot result in this exact setup, since the checked-out ref is GitHub's merge commit (parents: base-tip, PR-head) — so
merge-base(base, merge-commit)is triviallybase-tipitself.No behavior change for the intended case; this only fixes the CI environment where the check was silently degrading to "always treat as broken."
Test plan
check-llms-txton this PR (touchesscripts/check_llms_txt.py, so it triggers) and confirm it passesllms.txt) no longer fails this check🤖 Generated with Claude Code