feat(tools): record debt changes in per-pull-request fragments #17217

Merged
LeandroLP23 merged 6 commits from upstream-pr/17217 into main 2026-11-14 20:38:35 +00:00
LeandroLP23 commented 2026-11-08 14:53:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-11-08T14:53:35Z.


What

Pull requests stop editing the shared debt files to add, change or remove entries. Each one adds its own fragment, docs/dev/debt/changes/<branch>.md, and tools/debt_fold.py applies the fragments to the debt files. Two files with different names never conflict, so the debt conflicts between pull requests go away. The proposal and its numbers are in #12521 (comment): today 300 of the 465 open pull requests that conflict with main conflict in a debt file, and 107 of them conflict nowhere else.

# libc

## add Silent stubs

- [sceFoo](../../../core/libs/prx/libc/Export.cpp) (libc) - returns 0 without reading its argument

## change [sceBar]

- [sceBar](../../../core/libs/prx/libc/Export.cpp) (libc) - clears the pool, as the 4.03 module does

## remove [sceBaz]
  • tools/debt_fold.py:
    • add puts entries after the last entry of the section that links the same file, or at the end of the section, creating it if needed.
    • change and remove name text that occurs in exactly one entry of the file, usually its link. Table rows, such as the pending-export lists, count as entries. # TechnicalDebt names the index.
    • With no option it applies every fragment and deletes it. --check validates without writing, and --show <name> prints a debt file with the pending fragments applied.
    • It refuses a target that matches no entry or several, and two fragments that change the same entry, naming both. It reads entries with check_conventions.debt_entries.
  • tools/check_conventions.py:
    • A new debt-fragment error folds the pull request's fragments onto the debt files at its head, together with any fragments already pending, and reports one that does not apply.
    • Entries in fragments get the same debt-file, debt-length and debt-labels checks as entries in the debt files.
    • Fragment links are written as in the debt file, and doc-link resolves them from there.
  • Docs: the format is in a Fragments part of docs/dev/TechnicalDebt.md, with one rule line in CONTRIBUTING.md and the AGENTS.md line updated. Headings and text outside entries are still edited in place.

No existing entry changes format, and nothing is folded yet. Open pull requests that edit the debt files directly keep merging as they do today. How often to run the fold, and whether a later check should warn about direct entry edits, is your call.

Tested

Windows 11 Home 10.0.26300, Python 3.13.

  • tools/tests/test_debt_fold.py (9 tests) and tools/tests/test_check_conventions_debt_fragments.py (4 tests). The other 17 test_check_conventions* and test_debt* files pass unchanged.
  • python tools/debt_fold.py --check on this branch: exit 0, nothing pending.
  • Real files, on a throwaway commit: a fragment for libSceAudioIn.md that removes sceAudioInSetUsbGain, changes sceAudioInSetConnections and adds an entry, plus a bad fragment that removes "unknown signature" and changes the same entry.
    • The Conventions check reported two debt-fragment errors on the bad one: the target matches 15 entries, and both fragments change sceAudioInSetConnections.
    • With the bad one dropped, the fold applied the good one, placed the added entry after the file's other Export.cpp entries and before its pending-import list, and deleted the fragment.
  • Replay: the debt changes of the 164 pull requests merged since 11-07 that touched a debt file, each turned into a fragment and folded onto its parent. 161 give the same entries as the real merge. 12 of those also changed text outside entries (section renames, totals in prose). 2 create or delete a debt file, and 1 differs.
  • Same base: the merges since 11-07 on libc.md (24), libSceAgcDriver.md (5) and shader.md (5), as fragments against one common base, fold to the same entries as main.
  • python tools/check_conventions.py --base origin/main passes.
  • tools/pr_overlap.py: the 18 open pull requests that share these files and merge with main merge with this branch. It could not compare 10 that already conflict with main. git merge-tree against main and against this branch adds no conflicting file to any of them, #14212 included.

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:5212309835 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17217). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-11-08T14:53:35Z. --- ### What Pull requests stop editing the shared debt files to add, change or remove entries. Each one adds its own fragment, `docs/dev/debt/changes/<branch>.md`, and `tools/debt_fold.py` applies the fragments to the debt files. Two files with different names never conflict, so the debt conflicts between pull requests go away. The proposal and its numbers are in #12521 ([comment](https://github.com/boykopovar/AnyPS5/issues/12521#issuecomment-6722737444)): today 300 of the 465 open pull requests that conflict with `main` conflict in a debt file, and 107 of them conflict nowhere else. ```markdown # libc ## add Silent stubs - [sceFoo](../../../core/libs/prx/libc/Export.cpp) (libc) - returns 0 without reading its argument ## change [sceBar] - [sceBar](../../../core/libs/prx/libc/Export.cpp) (libc) - clears the pool, as the 4.03 module does ## remove [sceBaz] ``` - **`tools/debt_fold.py`:** - `add` puts entries after the last entry of the section that links the same file, or at the end of the section, creating it if needed. - `change` and `remove` name text that occurs in exactly one entry of the file, usually its link. Table rows, such as the pending-export lists, count as entries. `# TechnicalDebt` names the index. - With no option it applies every fragment and deletes it. `--check` validates without writing, and `--show <name>` prints a debt file with the pending fragments applied. - It refuses a target that matches no entry or several, and two fragments that change the same entry, naming both. It reads entries with `check_conventions.debt_entries`. - **`tools/check_conventions.py`:** - A new `debt-fragment` error folds the pull request's fragments onto the debt files at its head, together with any fragments already pending, and reports one that does not apply. - Entries in fragments get the same `debt-file`, `debt-length` and `debt-labels` checks as entries in the debt files. - Fragment links are written as in the debt file, and `doc-link` resolves them from there. - **Docs:** the format is in a Fragments part of `docs/dev/TechnicalDebt.md`, with one rule line in `CONTRIBUTING.md` and the `AGENTS.md` line updated. Headings and text outside entries are still edited in place. No existing entry changes format, and nothing is folded yet. Open pull requests that edit the debt files directly keep merging as they do today. How often to run the fold, and whether a later check should warn about direct entry edits, is your call. ### Tested Windows 11 Home 10.0.26300, Python 3.13. - `tools/tests/test_debt_fold.py` (9 tests) and `tools/tests/test_check_conventions_debt_fragments.py` (4 tests). The other 17 `test_check_conventions*` and `test_debt*` files pass unchanged. - `python tools/debt_fold.py --check` on this branch: exit 0, nothing pending. - **Real files, on a throwaway commit:** a fragment for `libSceAudioIn.md` that removes `sceAudioInSetUsbGain`, changes `sceAudioInSetConnections` and adds an entry, plus a bad fragment that removes "unknown signature" and changes the same entry. - The Conventions check reported two `debt-fragment` errors on the bad one: the target matches 15 entries, and both fragments change `sceAudioInSetConnections`. - With the bad one dropped, the fold applied the good one, placed the added entry after the file's other `Export.cpp` entries and before its pending-import list, and deleted the fragment. - **Replay:** the debt changes of the 164 pull requests merged since 11-07 that touched a debt file, each turned into a fragment and folded onto its parent. 161 give the same entries as the real merge. 12 of those also changed text outside entries (section renames, totals in prose). 2 create or delete a debt file, and 1 differs. - **Same base:** the merges since 11-07 on `libc.md` (24), `libSceAgcDriver.md` (5) and `shader.md` (5), as fragments against one common base, fold to the same entries as `main`. - `python tools/check_conventions.py --base origin/main` passes. - **`tools/pr_overlap.py`:** the 18 open pull requests that share these files and merge with `main` merge with this branch. It could not compare 10 that already conflict with `main`. `git merge-tree` against `main` and against this branch adds no conflicting file to any of them, #14212 included. ### 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
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!17217
No description provided.