Skip to content

fix(tools): recognize markdown links and pull request URLs in pr_overlap dependencies - #8025

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
emirplus:fix-pr-overlap-markdown-links
Oct 22, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
emirplus:fix-pr-overlap-markdown-links

Conversation

@emirplus

Copy link
Copy Markdown
Contributor

What

In tools/pr_overlap.py, depends_on(body) matches dependency declarations using regular expressions that strictly require #\d+ syntax.

When contributors format dependency declarations using Markdown links (such as [#123](https://github.com/.../pull/123) or [PR #123](...)) or raw pull request URLs, depends_on fails to extract the pull request numbers and returns an empty set.

  1. Normalize Markdown links pointing to GitHub pull requests into #<number>.
  2. Normalize raw GitHub pull request URLs into #<number>.
  3. Unwrap remaining Markdown link text before matching dependency patterns.

Tested

python tools/check_conventions.py --base origin/main
python -m unittest tools/tests/test_pr_overlap_dependencies.py
python -m unittest tools/tests/test_pr_overlap_dependencies.py tools/tests/test_pr_overlap_encoding.py tools/tests/test_pr_overlap_exports.py tools/tests/test_pr_overlap_own_branch.py tools/tests/test_pr_overlap_wrapped_exports.py

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@oneandonlydean oneandonlydean self-assigned this Oct 20, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

@emirplus thanks. One problem: the new patterns accept a pull request URL from any repository, so Depends on: https://github.com/shadps4-emu/shadPS4/pull/1234 now reads as a dependency on #1234 here (main returns none). Could they match only github.com/boykopovar/AnyPS5/pull/N (case-insensitive)?

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 988 tools/pr_overlap.py

@xXPBSXx

xXPBSXx commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Linux data point for 358dda936e (WSL2, Ubuntu 24.04, kernel 6.18 - a virtualised kernel, not bare-metal Linux; Python 3.12.3), this head merged onto main 5d10ea9ea (clean merge), python3 -I tools/tests/test_pr_overlap_dependencies.py:

  • With the PR: 18 tests OK.
  • Without it (the PR's test_pr_overlap_dependencies.py on top of main without the PR's source change): FAILED (5 failures).
    Not tested: macOS, Windows (Windows data from another run is not part of this comment).

AI-assisted (Claude Code).

@xXPBSXx

xXPBSXx commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Windows data point for 358dda936e: Windows 10 19045, Python 3.12.10, WinLibs GCC 15.2.0 and Ninja on PATH, this head merged onto main 05f9995704 (clean merge), python -I tools/tests/test_pr_overlap_dependencies.py:

  • With the PR: 18 tests OK.
  • Without it (the PR's test_pr_overlap_dependencies.py on top of main without the PR's source change): FAILED (5 failures).
    Not tested: Linux/macOS in this comment.

AI-assisted (Claude Code).

@harisibrar1 harisibrar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verified on Windows 11, Python 3.14:

  • python -m unittest tools/tests/test_pr_overlap*.py: 61 tests, OK (4 skipped).
  • With tools/pr_overlap.py reverted to main, test_markdown_links_and_full_urls fails 5 of its 6 subtests, so the new test does cover the change.
  • Depends on: none, [none](...), issue URLs, and PR URLs in prose after none all still give no dependencies. /pull/12/files, /pull/12#issuecomment-1, comma-separated URLs and "and"-joined links parse correctly.
  • python tools/check_conventions.py --base main: passed.
  • Problem: the URL patterns on lines 43 and 45 accept any github.com/<owner>/<repo>/pull/N, not only this repository's. - [x] Depends on: https://github.com/llvm/llvm-project/pull/12 (or [llvm#12](https://github.com/llvm/llvm-project/pull/12)) now returns {12}, where main returns set(). overlaps() then treats AnyPS5 PR #12 as a dependency and drops the overlap report between the two PRs.
  • Suggested fix: match only URLs for the current repository, e.g. rf"https?://github\.com/{re.escape(REPO)}/pull/(\d+)\b" with re.I, or pass the repo into depends_on. The test helper already patches REPO to owner/repo, so the existing cases keep passing. Please add a subtest that a URL to another repository yields set().

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@emirplus @harisibrar1's check confirms the open ask from 20 Oct: the URL patterns accept a pull request from any repository, so a link to another project's PR #12 is read as a dependency on AnyPS5 #12 and hides a real overlap. Please match only this repository's URLs (case-insensitive), and add a subtest that a URL to another repository gives set(). Thanks @harisibrar1 for the Windows run and the extra cases.

@emirplus
emirplus force-pushed the fix-pr-overlap-markdown-links branch from 358dda9 to 486eb18 Compare October 21, 2026 16:36
@emirplus

Copy link
Copy Markdown
Contributor Author

@oneandonlydean Updated to restrict pull request URLs and Markdown links strictly to this repository (case-insensitively). Also added subtests verifying that external pull request URLs and links to other repositories yield an empty set.

@harisibrar1 harisibrar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rechecked 486eb18 merged onto main 950388b: links to other repositories (https://github.com/llvm/llvm-project/pull/12, [llvm#12](https://github.com/llvm/llvm-project/pull/12)) now give set(), this repository's links are still read case-insensitively, none still parses, and test_pr_overlap*.py passes (4 platform skips).

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

@oneandonlydean
oneandonlydean merged commit 94fbb8c into boykopovar:main Oct 22, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants