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

Merged
emirplus merged 2 commits from upstream-pr/8025 into main 2026-10-22 01:24:05 +00:00
emirplus commented 2026-10-19 18:04:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by emirplus on 2026-10-19T18:04:51Z.


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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4925238720 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8025). Originally posted by [emirplus](https://github.com/emirplus) on 2026-10-19T18:04:51Z. --- ### 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 <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
oneandonlydean commented 2026-10-20 04:30:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T04:30:49Z.


@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)?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6283417861 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8025#issuecomment-6283417861). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T04:30:49Z. --- @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[bot] commented 2026-10-20 04:59:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T04:59:19Z.


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
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6283752232 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8025#issuecomment-6283752232). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T04:59:19Z. --- <!-- pr-overlap --> 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](https://www.github.com/boykopovar/AnyPS5/pull/988) | `tools/pr_overlap.py` |
xXPBSXx commented 2026-10-21 03:11:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T03:11:50Z.


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).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6307085850 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8025#issuecomment-6307085850). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-21T03:11:50Z. --- 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 commented 2026-10-21 03:37:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T03:37:08Z.


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).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6307415814 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8025#issuecomment-6307415814). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-21T03:37:08Z. --- 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 commented 2026-10-21 05:33:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-21T05:33:03Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5595357001 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8025#pullrequestreview-5595357001). Originally posted by [harisibrar1](https://github.com/harisibrar1) on 2026-10-21T05:33:03Z. **Review:** COMMENTED --- 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 commented 2026-10-21 05:44:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T05:44:45Z.


@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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309012012 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8025#issuecomment-6309012012). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-21T05:44:45Z. --- @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 commented 2026-10-21 16:36:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by emirplus on 2026-10-21T16:36:30Z.


@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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6321200613 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8025#issuecomment-6321200613). Originally posted by [emirplus](https://github.com/emirplus) on 2026-10-21T16:36:30Z. --- @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 commented 2026-10-21 17:56:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-21T17:56:37Z.

Review: APPROVED


Rechecked 486eb18dc merged onto main 950388bfd: 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5603986628 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8025#pullrequestreview-5603986628). Originally posted by [harisibrar1](https://github.com/harisibrar1) on 2026-10-21T17:56:37Z. **Review:** APPROVED --- Rechecked 486eb18dc merged onto main 950388bfd: 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.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!8025
No description provided.