fix(tools): resolve documentation links as repository paths on Windows #1254

Merged
popcoder565 merged 1 commit from upstream-pr/1254 into main 2026-10-08 05:28:49 +00:00
popcoder565 commented 2026-10-07 19:55:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-07T19:55:17Z.


What

tools/check_conventions.py normalized link targets with os.path.normpath, which returns backslash paths on Windows. Every relative link added to a Markdown file then failed the doc-link check ("Relative link to a file that does not exist"), and listed() compares the same resolved paths, so a silent stub listed in TechnicalDebt was not found on Windows either. Links are repository-relative POSIX paths, so they are now normalized with posixpath.normpath. On Linux the result is unchanged, as os.path is posixpath there. For the same reason CI cannot catch this bug: the Conventions job runs on Linux, so the false doc-link errors only appear when the check is run on Windows, as CONTRIBUTING asks before pushing.

Tested

Windows 10 (19045), Python 3.13.9.

  • On a branch that adds a TechnicalDebt link to an existing source file, python tools/check_conventions.py --base origin/main reported a doc-link error before this change and passes with it.
  • From docs/dev/TechnicalDebt.md, links() resolves ../../core/shader/recompiler/Recompiler.cpp, ../user/USAGE.md#build and /README.md to core/shader/recompiler/Recompiler.cpp, docs/user/USAGE.md and README.md, and listed() finds a stub named on a TechnicalDebt line that links its file.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4777734745 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1254). Originally posted by [popcoder565](https://github.com/popcoder565) on 2026-10-07T19:55:17Z. --- ### What `tools/check_conventions.py` normalized link targets with `os.path.normpath`, which returns backslash paths on Windows. Every relative link added to a Markdown file then failed the `doc-link` check ("Relative link to a file that does not exist"), and `listed()` compares the same resolved paths, so a silent stub listed in TechnicalDebt was not found on Windows either. Links are repository-relative POSIX paths, so they are now normalized with `posixpath.normpath`. On Linux the result is unchanged, as `os.path` is `posixpath` there. For the same reason CI cannot catch this bug: the Conventions job runs on Linux, so the false `doc-link` errors only appear when the check is run on Windows, as CONTRIBUTING asks before pushing. ### Tested Windows 10 (19045), Python 3.13.9. - On a branch that adds a TechnicalDebt link to an existing source file, `python tools/check_conventions.py --base origin/main` reported a `doc-link` error before this change and passes with it. - From `docs/dev/TechnicalDebt.md`, `links()` resolves `../../core/shader/recompiler/Recompiler.cpp`, `../user/USAGE.md#build` and `/README.md` to `core/shader/recompiler/Recompiler.cpp`, `docs/user/USAGE.md` and `README.md`, and `listed()` finds a stub named on a TechnicalDebt line that links its file. ### Checklist - [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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes
Dextroid17 commented 2026-10-07 20:27:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-07T20:27:23Z.


Verified this one, and the substitution is right — with a caveat worth writing down, because no CI here can see the bug.

links() resolves a documentation link against the file's directory, and the result is compared against the repository's own file list (tools/check_conventions.py:148, resolved not in self.tree). On Windows os.path is ntpath, so on main the resolved path comes back with backslashes while the tree holds POSIX paths, and every relative link reads as missing:

core/libs/prx/libc/docs/dev/BUILD.md
  ntpath.normpath    (== os.path.normpath on Windows)  -> core\libs\prx\libc\docs\dev\BUILD.md
  posixpath.normpath (this PR, == os.path.normpath on Linux) -> core/libs/prx/libc/docs/dev/BUILD.md

On the Linux runner os.path is posixpath answers True, which is exactly why the conventions job is green either way and why this never surfaced.

What I did not do: I could not drive the real function under Windows semantics from here to show the end-to-end failure, because on Linux os.path is posixpath — rebinding one rebinds both, and a test written that way passes on both versions. So the evidence is the substitution itself plus the comparison at line 148, not a run on Windows. Saying that rather than implying a test I did not do.

The change is a no-op on Linux, so it needs no test — but a sentence in the body recording why (Linux os.path is posixpath, so CI cannot catch this) would help whoever wonders next.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6046221484 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1254#issuecomment-6046221484). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-07T20:27:23Z. --- Verified this one, and the substitution is right — with a caveat worth writing down, because no CI here can see the bug. `links()` resolves a documentation link against the file's directory, and the result is compared against the repository's own file list (`tools/check_conventions.py:148`, `resolved not in self.tree`). On Windows `os.path` is `ntpath`, so on `main` the resolved path comes back with backslashes while the tree holds POSIX paths, and every relative link reads as missing: ``` core/libs/prx/libc/docs/dev/BUILD.md ntpath.normpath (== os.path.normpath on Windows) -> core\libs\prx\libc\docs\dev\BUILD.md posixpath.normpath (this PR, == os.path.normpath on Linux) -> core/libs/prx/libc/docs/dev/BUILD.md ``` On the Linux runner `os.path is posixpath` answers `True`, which is exactly why the conventions job is green either way and why this never surfaced. **What I did not do:** I could not drive the real function under Windows semantics from here to show the end-to-end failure, because on Linux `os.path` *is* `posixpath` — rebinding one rebinds both, and a test written that way passes on both versions. So the evidence is the substitution itself plus the comparison at line 148, not a run on Windows. Saying that rather than implying a test I did not do. The change is a no-op on Linux, so it needs no test — but a sentence in the body recording *why* (Linux `os.path is posixpath`, so CI cannot catch this) would help whoever wonders next.
popcoder565 commented 2026-10-07 20:52:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-07T20:52:12Z.


Thanks for checking. I added that to the description: the Conventions job runs on Linux, where os.path is posixpath, so CI can’t catch this. The false doc-link errors only show up when the check runs on Windows.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6046626876 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1254#issuecomment-6046626876). Originally posted by [popcoder565](https://github.com/popcoder565) on 2026-10-07T20:52:12Z. --- Thanks for checking. I added that to the description: the Conventions job runs on Linux, where os.path is posixpath, so CI can’t catch this. The false doc-link errors only show up when the check runs on Windows.
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!1254
No description provided.