feat(tools): keep technical debt in one file per library #4411

Merged
adriadam10 merged 2 commits from upstream-pr/4411 into main 2026-10-12 18:39:57 +00:00
adriadam10 commented 2026-10-12 09:48:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T09:48:36Z.


What

docs/dev/TechnicalDebt.md had 684 entries in four sections, and most pull requests append to the same section ends, so it was the most common conflict: 176 open pull requests touch it. This keeps one file per library or component under docs/dev/debt/, with TechnicalDebt.md as the index.

  • docs/dev/debt/<name>.md: an entry goes to the file named after the first core/ path it links: <name> for core/libs/prx/<name>/..., otherwise core/<name>/... (shader, relinker, libs), so a recompiler entry that also cites a driver test stays in shader.md, under the same ### sections and order as before. Entries that link neither (Build, the 4 cross-library "Unknown function info" lines, 3 Functional lines) and the Silent stubs preamble stay in the index; #silent-stubs and #functional anchors still exist there. Links are rewritten to ../../../.
  • The second commit is generated only by python3 tools/debt_split.py split, nothing edited by hand; on a rebase it is regenerated rather than rebased.
  • tools/debt_split.py:
    • split moves every library or component entry in the index to its file, appending to existing files (idempotent: also fixes an entry a clean merge left in the index).
    • resolve, run during a rebase stopped on TechnicalDebt.md, takes the stopped commit's change between the merge base and its version (stages 1 and 3), applies its added, edited and removed entries to the debt files (an addition goes after the entry it followed), keeps main's index and stages everything. It refuses, leaving the conflict as it was, when the change also edits lines that stay in the index or when an edited/removed entry was also changed on main.
  • Conventions (check_conventions.py):
    • Silent stubs are looked up in every debt file, each link resolved from its own file.
    • Comments are accepted when the pull request changes the index or any debt file.
    • New debt-file rule: an added entry whose name is not the file it is in (including the index) fails, naming the right file. The naming rule lives once, in check_conventions.debt_name, which debt_split.py imports.
  • stubgen.py default debt link is relative to docs/dev/debt/.
  • CONTRIBUTING (Documentation and Code) and the PR template point at the per-library files and explain resolve.

Tested

  • No entry lost: the multiset of (section, entry with links resolved) is identical before and after, 684 = 684, 0 missing, 0 extra. Every new file passes doc-link.
  • tools/tests/test_debt_split.py (registered as debt_split): split by first core link, split appending to existing files without duplicating the index note, and resolve in real rebases: added + edited + removed entries (order kept, emptied file deleted, index equal to main's), refusal on index lines, refusal on an entry main also changed, refusal outside a conflict. Mutations (drop the delete, drop the index-line guard, always insert the note) each fail a test.
  • test_check_conventions_comments.py: silent-stub cases moved to a library file; new cases for debt-file (library entry in the index, in another library's file, component file, entry without a core link stays, entry filed by its first core link). Mutations (rule disabled; links resolved from the index instead of their own file) fail 2 and 4 tests.
  • All tools/tests suites pass; check_conventions.py --base upstream/main passes.
  • Rebased the commits of all 176 open pull requests that touch TechnicalDebt.md onto this branch, running resolve at every stop:
Today on main With this branch PRs
merges cleanly resolve handles every stop 74
merges cleanly clean (1), or leaves an entry in the index that debt-file reports and split moves (2) 3
merges cleanly refused: edits a line that stays in the index 1
merges cleanly conflicts in code files: the same commit-by-commit conflicts happen rebasing onto main (checked for all 6) 6
conflicts resolve handles the TechnicalDebt.md part 32
conflicts refused (index lines) 3
conflicts conflicts in other files 58

So no pull request gets a new conflict it cannot resolve with resolve except the 4 that edit index lines (the same hand merge as today).

@boykopovar this changes where technical debt lives (layout call). @oneandonlydean after merge, authors rebase and run python3 tools/debt_split.py resolve when TechnicalDebt.md conflicts; I can run it on the open pull requests we have edit access to.

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
  • Unblocks: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4827693392 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4411). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-12T09:48:36Z. --- ### What `docs/dev/TechnicalDebt.md` had 684 entries in four sections, and most pull requests append to the same section ends, so it was the most common conflict: 176 open pull requests touch it. This keeps one file per library or component under `docs/dev/debt/`, with `TechnicalDebt.md` as the index. - `docs/dev/debt/<name>.md`: an entry goes to the file named after the first `core/` path it links: `<name>` for `core/libs/prx/<name>/...`, otherwise `core/<name>/...` (`shader`, `relinker`, `libs`), so a recompiler entry that also cites a driver test stays in `shader.md`, under the same `###` sections and order as before. Entries that link neither (Build, the 4 cross-library "Unknown function info" lines, 3 Functional lines) and the Silent stubs preamble stay in the index; `#silent-stubs` and `#functional` anchors still exist there. Links are rewritten to `../../../`. - The second commit is generated only by `python3 tools/debt_split.py split`, nothing edited by hand; on a rebase it is regenerated rather than rebased. - `tools/debt_split.py`: - `split` moves every library or component entry in the index to its file, appending to existing files (idempotent: also fixes an entry a clean merge left in the index). - `resolve`, run during a rebase stopped on `TechnicalDebt.md`, takes the stopped commit's change between the merge base and its version (stages 1 and 3), applies its added, edited and removed entries to the debt files (an addition goes after the entry it followed), keeps `main`'s index and stages everything. It refuses, leaving the conflict as it was, when the change also edits lines that stay in the index or when an edited/removed entry was also changed on `main`. - Conventions (`check_conventions.py`): - Silent stubs are looked up in every debt file, each link resolved from its own file. - Comments are accepted when the pull request changes the index or any debt file. - New `debt-file` rule: an added entry whose name is not the file it is in (including the index) fails, naming the right file. The naming rule lives once, in `check_conventions.debt_name`, which `debt_split.py` imports. - `stubgen.py` default debt link is relative to `docs/dev/debt/`. - CONTRIBUTING (Documentation and Code) and the PR template point at the per-library files and explain `resolve`. ### Tested - No entry lost: the multiset of (section, entry with links resolved) is identical before and after, 684 = 684, 0 missing, 0 extra. Every new file passes `doc-link`. - `tools/tests/test_debt_split.py` (registered as `debt_split`): split by first core link, split appending to existing files without duplicating the index note, and `resolve` in real rebases: added + edited + removed entries (order kept, emptied file deleted, index equal to `main`'s), refusal on index lines, refusal on an entry `main` also changed, refusal outside a conflict. Mutations (drop the delete, drop the index-line guard, always insert the note) each fail a test. - `test_check_conventions_comments.py`: silent-stub cases moved to a library file; new cases for `debt-file` (library entry in the index, in another library's file, component file, entry without a core link stays, entry filed by its first core link). Mutations (rule disabled; links resolved from the index instead of their own file) fail 2 and 4 tests. - All `tools/tests` suites pass; `check_conventions.py --base upstream/main` passes. - Rebased the commits of all 176 open pull requests that touch `TechnicalDebt.md` onto this branch, running `resolve` at every stop: | Today on `main` | With this branch | PRs | |---|---|---| | merges cleanly | `resolve` handles every stop | 74 | | merges cleanly | clean (1), or leaves an entry in the index that `debt-file` reports and `split` moves (2) | 3 | | merges cleanly | refused: edits a line that stays in the index | 1 | | merges cleanly | conflicts in code files: the same commit-by-commit conflicts happen rebasing onto `main` (checked for all 6) | 6 | | conflicts | `resolve` handles the `TechnicalDebt.md` part | 32 | | conflicts | refused (index lines) | 3 | | conflicts | conflicts in other files | 58 | So no pull request gets a new conflict it cannot resolve with `resolve` except the 4 that edit index lines (the same hand merge as today). @boykopovar this changes where technical debt lives (layout call). @oneandonlydean after merge, authors rebase and run `python3 tools/debt_split.py resolve` when `TechnicalDebt.md` conflicts; I can run it on the open pull requests we have edit access to. ### 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] Unblocks: none - [x] AI-assisted: yes
Mouad-Scriptz-0 commented 2026-10-12 12:03:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Mouad-Scriptz-0 on 2026-10-12T12:03:51Z.


Dry run from the other side: I rebased each of my open pull requests onto this branch (git rebase --onto docs/debt-per-library <its base>, so only the PR's own commits replay) and ran python3 tools/debt_split.py resolve at every stop on docs/dev/TechnicalDebt.md. Fedora 44, git 2.53.

Pull request Stops resolve Entry lands in
#4448 1 resolved libSceAgcDriver.md
#4449 1 resolved libSceAgcDriver.md
#4216 1 resolved libkernel.md
#4215 1 resolved libSceAgcDriver.md
#4217 1 resolved libSceVideoOut.md
#4048 3 resolved at each, including the commit that edits an entry an earlier commit added libSceAgcDriver.md
#4218 0 clean (none)

check_conventions.py --base docs/debt-per-library passes on every result, with the link prefixes rewritten to ../../../.

One placement to consider: debt_name picks the first core/libs/prx/<name> link anywhere in the entry and only falls back to core/<name> when there is none. #4048's entry is about the shader recompiler (its first link is core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvMemoryInstructions.cpp) but also cites VulkanDevice.cpp for the feature it enables, so it was filed under libSceAgcDriver.md rather than shader.md, and debt-file accepted it there. Every recompiler entry that mentions a driver file will go the same way; taking the entry's first link, whichever tree it is in, would file it with its subject.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6123894274 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4411#issuecomment-6123894274). Originally posted by [Mouad-Scriptz-0](https://github.com/Mouad-Scriptz-0) on 2026-10-12T12:03:51Z. --- Dry run from the other side: I rebased each of my open pull requests onto this branch (`git rebase --onto docs/debt-per-library <its base>`, so only the PR's own commits replay) and ran `python3 tools/debt_split.py resolve` at every stop on `docs/dev/TechnicalDebt.md`. Fedora 44, git 2.53. | Pull request | Stops | `resolve` | Entry lands in | |---|---|---|---| | #4448 | 1 | resolved | `libSceAgcDriver.md` | | #4449 | 1 | resolved | `libSceAgcDriver.md` | | #4216 | 1 | resolved | `libkernel.md` | | #4215 | 1 | resolved | `libSceAgcDriver.md` | | #4217 | 1 | resolved | `libSceVideoOut.md` | | #4048 | 3 | resolved at each, including the commit that edits an entry an earlier commit added | `libSceAgcDriver.md` | | #4218 | 0 | clean | (none) | `check_conventions.py --base docs/debt-per-library` passes on every result, with the link prefixes rewritten to `../../../`. One placement to consider: `debt_name` picks the first `core/libs/prx/<name>` link anywhere in the entry and only falls back to `core/<name>` when there is none. #4048's entry is about the shader recompiler (its first link is `core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvMemoryInstructions.cpp`) but also cites `VulkanDevice.cpp` for the feature it enables, so it was filed under `libSceAgcDriver.md` rather than `shader.md`, and `debt-file` accepted it there. Every recompiler entry that mentions a driver file will go the same way; taking the entry's first link, whichever tree it is in, would file it with its subject.
adriadam10 commented 2026-10-12 13:29:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T13:29:19Z.


Thanks for the dry run. Agreed on the placement: debt_name now takes the entry's first core/ link, whichever tree it is in (<name> for core/libs/prx/<name>/..., otherwise core/<name>/...).

  • On today's index that moves 5 entries from libSceAgcDriver.md to shader.md (s_subvector_loop_*, the two s_memtime entries, flat SRT reads through a null pointer, f32 denormals): all recompiler entries that cite a driver test or file as evidence. Nothing else moves.
  • debt-file now rejects a recompiler entry filed in a library file (new test test_entry_goes_with_its_first_core_link), and test_debt_split has a shader entry that also links a library test.
  • Rebased on current main and regenerated the split commit (684 entries, 0 lost); reran the full rebase trial on the 176 open pull requests that touch the file, table in the description updated. #4448 and #4048 now conflict with main itself in code files (BdaResources.cpp, ShaderReplay.cpp), unrelated to this; the other five still resolve.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6125266307 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4411#issuecomment-6125266307). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-12T13:29:19Z. --- Thanks for the dry run. Agreed on the placement: `debt_name` now takes the entry's first `core/` link, whichever tree it is in (`<name>` for `core/libs/prx/<name>/...`, otherwise `core/<name>/...`). - On today's index that moves 5 entries from `libSceAgcDriver.md` to `shader.md` (`s_subvector_loop_*`, the two `s_memtime` entries, flat SRT reads through a null pointer, f32 denormals): all recompiler entries that cite a driver test or file as evidence. Nothing else moves. - `debt-file` now rejects a recompiler entry filed in a library file (new test `test_entry_goes_with_its_first_core_link`), and `test_debt_split` has a shader entry that also links a library test. - Rebased on current `main` and regenerated the split commit (684 entries, 0 lost); reran the full rebase trial on the 176 open pull requests that touch the file, table in the description updated. #4448 and #4048 now conflict with `main` itself in code files (`BdaResources.cpp`, `ShaderReplay.cpp`), unrelated to this; the other five still resolve.
CnRJay commented 2026-10-12 13:49:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-12T13:49:31Z.


+1

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6125609610 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4411#issuecomment-6125609610). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-10-12T13:49:31Z. --- +1
Kikoarl commented 2026-10-12 13:52:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-10-12T13:52:48Z.


Strong +1.

Keeping TechnicalDebt.md in sync across orthogonal PRs (libSceAgcDriver, shader, libSceSysmodule) was consistently the primary source of rebase churn. Modularizing into docs/dev/debt/<component>.md and providing debt_split.py resolve cleanly eliminates cross-subsystem collisions while making rebases effortless for open branches.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6125672918 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4411#issuecomment-6125672918). Originally posted by [Kikoarl](https://github.com/Kikoarl) on 2026-10-12T13:52:48Z. --- Strong +1. Keeping `TechnicalDebt.md` in sync across orthogonal PRs (`libSceAgcDriver`, `shader`, `libSceSysmodule`) was consistently the primary source of rebase churn. Modularizing into `docs/dev/debt/<component>.md` and providing `debt_split.py resolve` cleanly eliminates cross-subsystem collisions while making rebases effortless for open branches.
fma-rc commented 2026-10-12 13:55:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-12T13:55:05Z.


LGTM.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6125715575 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4411#issuecomment-6125715575). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-12T13:55:05Z. --- LGTM.
blawesom commented 2026-10-12 15:38:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-12T15:38:34Z.


Rebase handoff — rebased onto current main, authorship unchanged. This one needed a real semantic docs resolution, so here's what it involves:

This PR restructures the technical-debt ledger into one file per library (docs/dev/debt/<name>.md), while main kept adding new entries to the old single file — 10 entries landed since this PR's base. A plain union would have re-broken the PR's own convention (and the debt-file check enforces it). The rebased branch instead routes each of main's 10 new entries to its per-library file by the first core/ path it links (libSceHttp2, libSceRtc, libkernel, libSceNgs2.native, shader, libkernel_sys, libc ×2, libSceAgcDriver, shader), with the relative links adjusted for the deeper directory.

One consequence worth knowing for future PRs: any PR that adds a technical-debt entry while this one is open should target docs/dev/debt/<library>.md directly, or it will conflict here again.

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: 958/958 passed

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/4411
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is 63851a36c.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6127521942 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4411#issuecomment-6127521942). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-12T15:38:34Z. --- **Rebase handoff** — rebased onto current `main`, authorship unchanged. This one needed a real semantic docs resolution, so here's what it involves: This PR restructures the technical-debt ledger into one file per library (`docs/dev/debt/<name>.md`), while `main` kept adding new entries to the old single file — 10 entries landed since this PR's base. A plain union would have re-broken the PR's own convention (and the `debt-file` check enforces it). The rebased branch instead routes each of main's 10 new entries to its per-library file by the first `core/` path it links (`libSceHttp2`, `libSceRtc`, `libkernel`, `libSceNgs2.native`, `shader`, `libkernel_sys`, `libc` ×2, `libSceAgcDriver`, `shader`), with the relative links adjusted for the deeper directory. One consequence worth knowing for future PRs: any PR that adds a technical-debt entry while this one is open should target `docs/dev/debt/<library>.md` directly, or it will conflict here again. Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): - builds; `tools/check_conventions.py --base origin/main` passes - **full suite: 958/958 passed** **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/4411 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is `63851a36c`.
Mouad-Scriptz-0 commented 2026-10-12 16:07:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Mouad-Scriptz-0 on 2026-10-12T16:07:20Z.


Thanks, the first-core/ link rule reads right, and the five recompiler entries belong in shader.md.

On the two conflicts: #4448 is rebased on current main (f82f49d69, mergeable again; the BdaResources.cpp overlap was the failed-import test from #1357 next to mine). #4048's conflict is the agc_shader_replay usage line against #4325's --prepare; I'll rebase it today.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6127997667 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4411#issuecomment-6127997667). Originally posted by [Mouad-Scriptz-0](https://github.com/Mouad-Scriptz-0) on 2026-10-12T16:07:20Z. --- Thanks, the first-`core/` link rule reads right, and the five recompiler entries belong in `shader.md`. On the two conflicts: #4448 is rebased on current `main` (f82f49d69, mergeable again; the `BdaResources.cpp` overlap was the failed-import test from #1357 next to mine). #4048's conflict is the `agc_shader_replay` usage line against #4325's `--prepare`; I'll rebase it today.
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!4411
No description provided.