docs(debt): separate entries with blank lines and drop derived export totals #14212

Closed
janzezno wants to merge 3 commits from upstream-pr/14212 into main
janzezno commented 2026-10-31 23:42:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by janzezno on 2026-10-31T23:42:28Z.


What

Options 2 and 3 of #12521, as agreed there: a blank line between the entries of every technical debt file, no export or declaration totals in entries, and a script that applies the reformat so open pull requests can rerun it when they rebase. One file per entry and merge=union are left out.

Three commits:

  1. tools/debt_format.py, the check and the rule.
    • python3 tools/debt_format.py adds a blank line before each top-level entry (- at the start of a line) of docs/dev/TechnicalDebt.md and docs/dev/debt/*.md that follows a non-blank line, and lists the files it changed. Nothing else changes: nested items, tables and continuation lines stay as they are. --check changes nothing, lists the files and exits with 1.
    • python3 tools/debt_format.py resolve, during a stopped rebase or merge: for each conflicted debt file it separates the entries of the base, ours and theirs versions, merges them again with git merge-file, stages the files that merge cleanly and formats the other debt files. Two rules settle the hunks the count removal leaves. When one side only renumbered lines in which the other side dropped numbers, the other side's lines are taken. When every word one side changed in a hunk was a number it replaced, the hunk is merged word by word under the same rule. The remaining hunks keep conflict markers, with the base section under merge.conflictStyle=diff3, and the command exits with 1.
    • New Conventions error debt-spacing: an entry the pull request adds or edits directly after a non-blank line.
    • debt_split.py and stubgen.py write separated entries.
    • CONTRIBUTING.md: the blank-line rule, no totals of a linked file's exports or declarations, and debt_format.py resolve on a conflict.
    • test_check_conventions_debt_labels.py from #15470 puts a blank line between the two entries of its fixture.
  2. The totals removed from the prose: 267 lines in 154 files, for example "24 named callable exports are listed in the PS5 3.20 export table" → "these named callable exports are listed in the PS5 3.20 export table", "[302 exports (60 without a known name, bound by NID)]" → "[Exports (those without a known name, bound by NID)]", "13 entries present in both version-labelled images" → "the entries present in both version-labelled images", and the "these 45 exports: …" counts in front of explicit lists. Counts of firmware and external tables stay (function-NID totals with their SHA-256, sizes of the 3.20 tables, the sibling inventories, catalogue comparisons such as "282 match the public 3.20 catalogue and 6 do not"), as do layouts, limits, spelled-out counts of short lists and measured breakdowns, such as the classes of 11.00 bodies in libSceNKWebKit.md. No check, test or tool reads these totals, so no check changes for them.
  3. python3 tools/debt_format.py: 4945 blank lines in 200 files, and no other line.

Like #12862, commits 2 and 3 are regenerated on the main they land on: this version is regenerated on main b259b261af, and I regenerate it again if main conflicts with it before it lands. On 5c184f22eb, 1135 of the 1745 open pull requests change a debt file.

After this lands, every open pull request that adds or edits a debt entry fails debt-spacing until it rebases or runs python3 tools/debt_format.py, and most of them conflict in the debt files until it rebases and runs resolve, as with the AGC split.

Overlaps:

  • #13957 changed the same line of write_debt in tools/debt_split.py and went first (merged 2026-11-05). The regeneration keeps its preamble argument: write_lf(path, space_debt(render(f"# {name} technical debt", sections, order, preamble))).
  • #13801 added rows to the same RULES table in tools/check_conventions.py; it was closed without merging, so that overlap is gone.
  • #14158 adds an entry to docs/dev/debt/libSceLibcInternal.md; as proposed it went first (merged 2026-11-06), and the regeneration picks up its entry.
  • #15470 added an add_test at the same spot of the root CMakeLists.txt and the debt-labels check and helpers at the same spots of tools/check_conventions.py; it went first (merged 2026-11-07), and the regeneration keeps both sides of each hunk.
  • #15907 replaced the debt_split add_test next to the new debt_format one in the root CMakeLists.txt; as proposed, whichever was ready first landed, and it went first (merged 2026-11-09), so it is in this branch's base.
  • #17217 adds debt fragments and shares the root CMakeLists.txt, CONTRIBUTING.md, docs/dev/TechnicalDebt.md and tools/check_conventions.py with this branch. They merge without conflicts, and its fold keeps a spaced file spaced, so either can land first. If it goes first, this branch is regenerated right after a fold.

Tested

Arch Linux, Python 3.14.9, git 2.56.0. Regenerated on main b259b261af; the conventions check, the debt tool tests (also with core.autocrlf=true) and the debt_report.py comparison were rerun there, the full tools suite on 105c9e4d91 and the open pull request numbers on 5c184f22eb.

  • Commit 3 adds only empty lines (git diff --ignore-blank-lines is empty). The whole branch against main is the count edits of commit 2 plus empty lines.
  • python3 tools/check_conventions.py --base b259b261af: no errors. 7 debt-length warnings for entries that were over 1000 characters before commit 2 edited them: five in libSceHmd2.md, the pending-exports entry of libSceLibreSsl3.md (1393 characters on main) and the ResourceRequestBase entry of libSceNKWebKit.md (1821).
  • tools/tests/test_debt_format.py (12 tests), test_debt_split.py, test_check_conventions_debt_length.py, test_check_conventions_comments.py, test_check_conventions_blob_reads.py, test_check_conventions_doc_links.py, test_stubgen.py and test_stubgen_stdout_newlines.py pass. Of the 116 tools/tests/test_*.py, 115 pass; test_run_report_schema.py (no jsonschema here) fails on main too. The debt, stubgen and conventions debt tests also pass with core.autocrlf=true in the global git config, as on the Windows runner: test_debt_format.py runs its repositories with core.autocrlf=false, since a CRLF checkout made the resolve test compare CRLF bytes. python3 tools/check_test_registration.py --scripts: 274 test scripts, each run.
  • python3 tools/debt_report.py --json gives the same file, section, labels, names and reason for all 6355 entries on main, after commit 2 and after commit 3; only the line numbers move.
  • Open pull requests: of the 1745 open on 5c184f22eb, 1135 change a debt file. For each one I merged every debt file it changes with git merge-file (base: the merge base, ours: main or this branch, theirs: the head):
Ours PRs with a debt-file conflict
main today 356
This branch, plain merge 936
This branch, after resolve 347
This branch without commit 2, after resolve 342

After resolve, 40 pull requests that conflict today merge cleanly and 31 that merge cleanly today conflict. 27 of those 31 conflict in a file whose totals commit 2 changes; the other 4 come from the blank lines alone. No merged file resolve leaves clean has an entry without its blank line. The last row is also the steady state of the layout: with all three versions formatted, today's pull requests conflict in 342 cases instead of 356. The word-by-word rule settles 79 hunks in 70 pull requests where a pull request changed a total and other words of the same entry; only the total is replaced by this branch's wording and the rest of the change is kept.

Not built: no source file changes.

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: #12521
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5102608365 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14212). Originally posted by [janzezno](https://github.com/janzezno) on 2026-10-31T23:42:28Z. --- ### What Options 2 and 3 of #12521, as [agreed there](https://github.com/boykopovar/AnyPS5/issues/12521#issuecomment-6549877768): a blank line between the entries of every technical debt file, no export or declaration totals in entries, and a script that applies the reformat so open pull requests can rerun it when they rebase. One file per entry and `merge=union` are left out. Three commits: 1. `tools/debt_format.py`, the check and the rule. - `python3 tools/debt_format.py` adds a blank line before each top-level entry (`- ` at the start of a line) of `docs/dev/TechnicalDebt.md` and `docs/dev/debt/*.md` that follows a non-blank line, and lists the files it changed. Nothing else changes: nested items, tables and continuation lines stay as they are. `--check` changes nothing, lists the files and exits with 1. - `python3 tools/debt_format.py resolve`, during a stopped rebase or merge: for each conflicted debt file it separates the entries of the base, ours and theirs versions, merges them again with `git merge-file`, stages the files that merge cleanly and formats the other debt files. Two rules settle the hunks the count removal leaves. When one side only renumbered lines in which the other side dropped numbers, the other side's lines are taken. When every word one side changed in a hunk was a number it replaced, the hunk is merged word by word under the same rule. The remaining hunks keep conflict markers, with the base section under `merge.conflictStyle=diff3`, and the command exits with 1. - New Conventions error `debt-spacing`: an entry the pull request adds or edits directly after a non-blank line. - `debt_split.py` and `stubgen.py` write separated entries. - CONTRIBUTING.md: the blank-line rule, no totals of a linked file's exports or declarations, and `debt_format.py resolve` on a conflict. - `test_check_conventions_debt_labels.py` from #15470 puts a blank line between the two entries of its fixture. 2. The totals removed from the prose: 267 lines in 154 files, for example "24 named callable exports are listed in the PS5 3.20 export table" → "these named callable exports are listed in the PS5 3.20 export table", "[302 exports (60 without a known name, bound by NID)]" → "[Exports (those without a known name, bound by NID)]", "13 entries present in both version-labelled images" → "the entries present in both version-labelled images", and the "these 45 exports: …" counts in front of explicit lists. Counts of firmware and external tables stay (function-NID totals with their SHA-256, sizes of the 3.20 tables, the sibling inventories, catalogue comparisons such as "282 match the public 3.20 catalogue and 6 do not"), as do layouts, limits, spelled-out counts of short lists and measured breakdowns, such as the classes of 11.00 bodies in `libSceNKWebKit.md`. No check, test or tool reads these totals, so no check changes for them. 3. `python3 tools/debt_format.py`: 4945 blank lines in 200 files, and no other line. Like #12862, commits 2 and 3 are regenerated on the `main` they land on: this version is regenerated on `main` b259b261af, and I regenerate it again if `main` conflicts with it before it lands. On 5c184f22eb, 1135 of the 1745 open pull requests change a debt file. After this lands, every open pull request that adds or edits a debt entry fails `debt-spacing` until it rebases or runs `python3 tools/debt_format.py`, and most of them conflict in the debt files until it rebases and runs `resolve`, as with the AGC split. Overlaps: - #13957 changed the same line of `write_debt` in `tools/debt_split.py` and [went first](https://github.com/boykopovar/AnyPS5/pull/13957#issuecomment-6550752660) (merged 2026-11-05). The regeneration keeps its `preamble` argument: `write_lf(path, space_debt(render(f"# {name} technical debt", sections, order, preamble)))`. - #13801 added rows to the same `RULES` table in `tools/check_conventions.py`; it was closed without merging, so that overlap is gone. - #14158 adds an entry to `docs/dev/debt/libSceLibcInternal.md`; as [proposed](https://github.com/boykopovar/AnyPS5/pull/14212#issuecomment-6604096208) it went first (merged 2026-11-06), and the regeneration picks up its entry. - #15470 added an `add_test` at the same spot of the root `CMakeLists.txt` and the `debt-labels` check and helpers at the same spots of `tools/check_conventions.py`; it went first (merged 2026-11-07), and the regeneration keeps both sides of each hunk. - #15907 replaced the `debt_split` `add_test` next to the new `debt_format` one in the root `CMakeLists.txt`; as [proposed](https://github.com/boykopovar/AnyPS5/pull/15907#issuecomment-6694318275), whichever was ready first landed, and it went first (merged 2026-11-09), so it is in this branch's base. - #17217 adds debt fragments and shares the root `CMakeLists.txt`, `CONTRIBUTING.md`, `docs/dev/TechnicalDebt.md` and `tools/check_conventions.py` with this branch. They merge without conflicts, and its fold keeps a spaced file spaced, so [either can land first](https://github.com/boykopovar/AnyPS5/pull/17217#issuecomment-6725716645). If it goes first, this branch is regenerated right after a fold. ### Tested Arch Linux, Python 3.14.9, git 2.56.0. Regenerated on `main` b259b261af; the conventions check, the debt tool tests (also with `core.autocrlf=true`) and the `debt_report.py` comparison were rerun there, the full tools suite on 105c9e4d91 and the open pull request numbers on 5c184f22eb. - Commit 3 adds only empty lines (`git diff --ignore-blank-lines` is empty). The whole branch against `main` is the count edits of commit 2 plus empty lines. - `python3 tools/check_conventions.py --base b259b261af`: no errors. 7 `debt-length` warnings for entries that were over 1000 characters before commit 2 edited them: five in `libSceHmd2.md`, the pending-exports entry of `libSceLibreSsl3.md` (1393 characters on `main`) and the `ResourceRequestBase` entry of `libSceNKWebKit.md` (1821). - `tools/tests/test_debt_format.py` (12 tests), `test_debt_split.py`, `test_check_conventions_debt_length.py`, `test_check_conventions_comments.py`, `test_check_conventions_blob_reads.py`, `test_check_conventions_doc_links.py`, `test_stubgen.py` and `test_stubgen_stdout_newlines.py` pass. Of the 116 `tools/tests/test_*.py`, 115 pass; `test_run_report_schema.py` (no `jsonschema` here) fails on `main` too. The debt, stubgen and conventions debt tests also pass with `core.autocrlf=true` in the global git config, as on the Windows runner: `test_debt_format.py` runs its repositories with `core.autocrlf=false`, since a CRLF checkout made the `resolve` test compare CRLF bytes. `python3 tools/check_test_registration.py --scripts`: 274 test scripts, each run. - `python3 tools/debt_report.py --json` gives the same file, section, labels, names and reason for all 6355 entries on `main`, after commit 2 and after commit 3; only the line numbers move. - Open pull requests: of the 1745 open on 5c184f22eb, 1135 change a debt file. For each one I merged every debt file it changes with `git merge-file` (base: the merge base, ours: `main` or this branch, theirs: the head): | Ours | PRs with a debt-file conflict | |---|---| | `main` today | 356 | | This branch, plain merge | 936 | | This branch, after `resolve` | 347 | | This branch without commit 2, after `resolve` | 342 | After `resolve`, 40 pull requests that conflict today merge cleanly and 31 that merge cleanly today conflict. 27 of those 31 conflict in a file whose totals commit 2 changes; the other 4 come from the blank lines alone. No merged file `resolve` leaves clean has an entry without its blank line. The last row is also the steady state of the layout: with all three versions formatted, today's pull requests conflict in 342 cases instead of 356. The word-by-word rule settles 79 hunks in 70 pull requests where a pull request changed a total and other words of the same entry; only the total is replaced by this branch's wording and the rest of the change is kept. Not built: no source file changes. ### 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: #12521 - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
adriadam10 commented 2026-11-06 20:24:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-11-06T20:24:41Z.

Review: CHANGES_REQUESTED


  • The head conflicts with main (mergeable: CONFLICTING), only in debt files: libSceFreeType.md, libSceFreeTypeOt.md, libSceLibcInternal.md (#14158's entry), libSceNKWebKit.md, libSceRegMgr.md, libkernel.md, libkernel_sys.md. Regenerate commits 2 and 3 on current main, as you described, and push.
  • Once regenerated and the PR is green on the merge queue's Build run, it is ready from our side; the tool and the debt-spacing rule read as described.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5806499832 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14212#pullrequestreview-5806499832). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-11-06T20:24:41Z. **Review:** CHANGES_REQUESTED --- - The head conflicts with `main` (`mergeable: CONFLICTING`), only in debt files: `libSceFreeType.md`, `libSceFreeTypeOt.md`, `libSceLibcInternal.md` (#14158's entry), `libSceNKWebKit.md`, `libSceRegMgr.md`, `libkernel.md`, `libkernel_sys.md`. Regenerate commits 2 and 3 on current `main`, as you described, and push. - Once regenerated and the PR is green on the merge queue's Build run, it is ready from our side; the tool and the `debt-spacing` rule read as described.
MarcZX10 commented 2026-11-14 05:23:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T05:23:26Z.

Review: COMMENTED


Reviewed — no blocking findings

The inspected formatter and convention-checker changes show no verified blocking defect, but the full review is incomplete because many changed files were not read and checks were not run.

What I ran

Read the prepared description, commit list, diff, and manifest for head 6b4941bfe250142672c12b48b7b6c706b9691452. Inspected the changed logic and tests in tools/debt_format.py, tools/check_conventions.py, tools/tests/test_debt_format.py, tools/debt_split.py, and tools/stubgen.py through repo_read.py. No commands or tests were run.

Results

Check Result Note
Targeted code review passed No defect verified in the inspected logic
Test execution not run Results in the description are author-reported
Full changed-file review not run Many changed files were excluded from the review folder and not read

Findings

Blocking

None in the code inspected.

Non-blocking

None.

Not verified

The changed documentation files and other changed files listed in the manifest were not read in full; their wording and content changes are not verified. The full test suite and the author-reported checks were not run in this review. I read the description, commit list, diff, manifest, and the five repository files listed above; many changed files were excluded from the review folder because they were too large.

To get this to a good state

Nothing is required. Optional: complete review of the unread changed files and run the relevant checks before making a formal approval decision.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5901871791 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14212#pullrequestreview-5901871791). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-14T05:23:26Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The inspected formatter and convention-checker changes show no verified blocking defect, but the full review is incomplete because many changed files were not read and checks were not run. ## What I ran Read the prepared description, commit list, diff, and manifest for head `6b4941bfe250142672c12b48b7b6c706b9691452`. Inspected the changed logic and tests in `tools/debt_format.py`, `tools/check_conventions.py`, `tools/tests/test_debt_format.py`, `tools/debt_split.py`, and `tools/stubgen.py` through `repo_read.py`. No commands or tests were run. ## Results | Check | Result | Note | |---|---|---| | Targeted code review | passed | No defect verified in the inspected logic | | Test execution | not run | Results in the description are author-reported | | Full changed-file review | not run | Many changed files were excluded from the review folder and not read | ## Findings ### Blocking None in the code inspected. ### Non-blocking None. ## Not verified The changed documentation files and other changed files listed in the manifest were not read in full; their wording and content changes are not verified. The full test suite and the author-reported checks were not run in this review. I read the description, commit list, diff, manifest, and the five repository files listed above; many changed files were excluded from the review folder because they were too large. ## To get this to a good state Nothing is required. Optional: complete review of the unread changed files and run the relevant checks before making a formal approval decision.

Pull request closed

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!14212
No description provided.