Repository navigation
fix: don't misdetect uv.lock changes from diff text alone - #765
Open
brobro10000 wants to merge 2 commits into
Open
brobro10000 wants to merge 2 commits into
brobro10000 wants to merge 2 commits into
Conversation
compare_pr_differnce routed to the uv.lock parser whenever the literal string "uv.lock" appeared anywhere in a PR's diff text, even when uv.lock wasn't actually one of the changed files. A plain pip-tools repo can trip this if a vendored/copied requirements file's generated header happens to mention "pyproject.toml / uv.lock" after the repo it's copied from migrates to uv -- the uv parser then finds no real uv.lock file, returns nothing, and both review comments post empty. Confirmed this has been silently hiding every dependency-risk comment on openedx/edx-enterprise's weekly "chore: Upgrade Python requirements" PRs since 2026-08-28 (6 consecutive PRs): edx-enterprise vendors requirements/edx-platform-constraints.txt, copied from edx-platform, and edx-platform's own uv migration added a "pyproject.toml / uv.lock" line to that file's header. Guard the dispatch with the PR's actual changed files (the same source of truth _parse_uv already uses internally) before trusting the diff text, so the fast path for repos that never mention uv.lock is unaffected and genuinely uv-migrated repos route correctly either way.
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.
Summary
compare_pr_differncedecides whether to parse a requirements-upgrade PR's diff asa uv repo or a pip-tools repo with:
This is a bare substring check on the PR's entire diff text, not a check for
whether
uv.lockis actually one of the changed files. A plain pip-tools repo cantrip this if the diff happens to contain the literal text "uv.lock" for any other
reason — once that happens,
_parse_uvcorrectly finds no realuv.lockfilechanged and returns nothing, so both review comments post completely empty,
silently hiding every real dependency change from the PR.
Real-world impact (confirmed)
openedx/edx-enterprisevendorsrequirements/edx-platform-constraints.txt— afile explicitly "copied from edx-platform. See make upgrade" per its own header.
edx-platformrecently migrated topyproject.toml+uv, which changed thiscopied file's generated header to include the line:
That line alone is enough to trip the substring check on every edx-enterprise
upgrade PR since, even though edx-enterprise itself has no
uv.lockand is stillentirely pip-tools based. I bisected edx-enterprise's weekly bot PR history and
confirmed this has been silently broken for 6 consecutive weeks:
Every one of those PRs posted:
with no package list at all under either heading — despite real changes including
several MAJOR version bumps (e.g.
cryptography49→50,edx-organizations8→9,filelock3→4,python-slugify8→9 in PR #2708 alone).I confirmed this isn't a regression in
_parse_uvitself — genuinely uv-migratedrepos (
openedx/taxonomy-connector,openedx/openedx-ledger) parse correctly viathe same
_parse_uvpath this week, with full and accurate package lists. The bugis specifically the false-positive dispatch: the substring fires without an
actual
uv.lockfile in the diff.Fix
Guard the dispatch with the PR's actual changed files — the same source of truth
_parse_uvalready uses internally (pr.get_files()) — instead of trusting thediff text alone:
The
"uv.lock" in txtfast-path check is kept first so repos whose diffs nevermention "uv.lock" never pay the extra
get_files()call. For a real uv.lock diff,its own
diff --git a/uv.lock b/uv.lockheader always contains the substring, sothis is a pure narrowing of false positives with no change to true-positive
behavior — correct across the full migration spectrum (pure pip-tools, pure uv, or
a repo transitioning between the two).
Testing
tests/test_pull_request_creator.py:test_compare_upgrade_difference_uv_lock_mentioned_but_not_changed— reproducesthe edx-enterprise scenario (diff text mentions "uv.lock" but it isn't a changed
file); confirmed this test fails against the old code (
_parse_uvgets calledwhen it shouldn't) and passes against the fix.
test_compare_upgrade_difference_uv_lock_actually_changed— confirms a realuv.lockfile change still routes to_parse_uv.uv run pytest tests/test_pull_request_creator.py): 24/24pass (22 existing + 2 new).
edx-enterprise#2708(fetched viathe same API + media type this tool uses) with the fix applied — it now correctly
surfaces 127 valid and 32 suspicious package changes, including all the
previously-hidden MAJOR bumps and one DOWNGRADE (
django-simple-history).