fix(tools): handle errors cleanly and reconfigure streams in debt_split #10205

Merged
emirplus merged 1 commit from upstream-pr/10205 into main 2026-11-01 00:20:05 +00:00
emirplus commented 2026-10-23 13:29:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by emirplus on 2026-10-23T13:29:44Z.


What

Wrap the debt_split entrypoint in main(argv=None) with UTF-8 stream reconfiguration using backslashreplace error handling.

Catch CalledProcessError when git rev-parse fails outside a git repository and report via parser.error rather than propagating an unhandled traceback.

Tested

python3 tools/tests/test_debt_split.py (18 tests, including two new ones for the stream reconfiguration and the non-git directory error). Not run on a title.

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:
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4983504131 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10205). Originally posted by [emirplus](https://github.com/emirplus) on 2026-10-23T13:29:44Z. --- ### What Wrap the debt_split entrypoint in main(argv=None) with UTF-8 stream reconfiguration using backslashreplace error handling. Catch CalledProcessError when git rev-parse fails outside a git repository and report via parser.error rather than propagating an unhandled traceback. ### Tested `python3 tools/tests/test_debt_split.py` (18 tests, including two new ones for the stream reconfiguration and the non-git directory error). Not run on a title. ### 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 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 / no -->
MarcZX10 commented 2026-10-23 14:01:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T14:01:42Z.

Review: CHANGES_REQUESTED


I ran the focused test file on this exact head: python3 tools/tests/test_debt_split.py passed (16 tests). The diff is small and git diff --check is clean.

The required repository conventions check currently fails because the PR description contains only the two-sentence summary and omits the required What, Tested, and Checklist sections. Please fill in those sections with the intended behavior, the actual tests run, and the applicable checklist items, then rerun the conventions check. I have not found another functional blocker in this focused review; I’m requesting this template correction so the PR is reviewable under the repository rules.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5629313788 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10205#pullrequestreview-5629313788). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T14:01:42Z. **Review:** CHANGES_REQUESTED --- I ran the focused test file on this exact head: `python3 tools/tests/test_debt_split.py` passed (16 tests). The diff is small and `git diff --check` is clean. The required repository conventions check currently fails because the PR description contains only the two-sentence summary and omits the required `What`, `Tested`, and `Checklist` sections. Please fill in those sections with the intended behavior, the actual tests run, and the applicable checklist items, then rerun the conventions check. I have not found another functional blocker in this focused review; I’m requesting this template correction so the PR is reviewable under the repository rules.
THEMANnt commented 2026-10-29 06:19:12 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Reviewed a58282cc589f7657986c9e2920f3a3f76382e960 against 938812df1403f9616dba71744216725891ca4979.

The entrypoint now reports a non-Git working directory as an argparse usage error and configures both output streams with UTF-8/backslashreplace. The scoped error handler leaves the split/resolve implementation unchanged. No actionable code defect found.

Windows/Python 3.11: head 18/18 and baseline 16/16 unit tests passed. A real subprocess in an independent non-Git directory exits 2 with no traceback on the head; the baseline exits 1 with a CalledProcessError traceback. The new-tests/old-code run fails as expected. The latest conventions run is failing, and the PR body still has an unfilled AI-assisted placeholder; please complete that metadata and rerun the check. This is a validation/metadata limitation, not a demonstrated implementation defect.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693639954 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10205#pullrequestreview-5693639954). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-29T06:19:12Z. **Review:** COMMENTED --- Reviewed `a58282cc589f7657986c9e2920f3a3f76382e960` against `938812df1403f9616dba71744216725891ca4979`. The entrypoint now reports a non-Git working directory as an argparse usage error and configures both output streams with UTF-8/backslashreplace. The scoped error handler leaves the split/resolve implementation unchanged. No actionable code defect found. Windows/Python 3.11: head 18/18 and baseline 16/16 unit tests passed. A real subprocess in an independent non-Git directory exits 2 with no traceback on the head; the baseline exits 1 with a CalledProcessError traceback. The new-tests/old-code run fails as expected. The latest conventions run is failing, and the PR body still has an unfilled AI-assisted placeholder; please complete that metadata and rerun the check. This is a validation/metadata limitation, not a demonstrated implementation defect.
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!10205
No description provided.