fix(tools): wrap entrypoint in main with stream reconfigure in pad_input #10206

Merged
emirplus merged 4 commits from upstream-pr/10206 into main 2026-11-22 09:15:54 +00:00
emirplus commented 2026-10-23 13:32:31 +00:00 (Migrated from github.com)

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


What

Wrap the tools/pad_input.py entrypoint in main(argv=None), reconfigure stdout/stderr to UTF-8 with backslashreplace error handling, and return 0 on success (sys.exit(main())). Adds tests for explicit argv and for the stream reconfiguration.

Tested

  • python3 tools/tests/test_pad_input.py: 12 passed (MarcZX10 on this head).
  • Windows 11, merged onto main: selected tests 366 pass, 1 fail (pr_overlap_encoding, also fails on main), 6 skip (babyhuey).

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 (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4983542178 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10206). Originally posted by [emirplus](https://github.com/emirplus) on 2026-10-23T13:32:31Z. --- ### What Wrap the `tools/pad_input.py` entrypoint in `main(argv=None)`, reconfigure stdout/stderr to UTF-8 with `backslashreplace` error handling, and return 0 on success (`sys.exit(main())`). Adds tests for explicit argv and for the stream reconfiguration. ### Tested - `python3 tools/tests/test_pad_input.py`: 12 passed (MarcZX10 on this head). - Windows 11, merged onto main: selected tests 366 pass, 1 fail (`pr_overlap_encoding`, also fails on main), 6 skip (babyhuey). ### 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 (Claude Code)
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_pad_input.py passed (12 tests). The diff is small and git diff --check is clean.

The required repository conventions check currently fails because the PR description contains only a one-sentence summary and omits the required What, Tested, and Checklist sections. Please fill those sections with the intended behavior, actual tests run, and applicable checklist items, then rerun conventions.

There is also a concrete integration overlap with #6531: a pairwise git merge-tree preview reports conflicts in both tools/pad_input.py and tools/tests/test_pad_input.py. #6531 changes directory/path validation and error handling; this PR adds entry-point/stream handling. Please coordinate the merge order with that PR’s author, record a dependency if one needs to land first, and preserve both changes in a combined rebase. No closure is requested.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5629313815 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10206#pullrequestreview-5629313815). 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_pad_input.py` passed (12 tests). The diff is small and `git diff --check` is clean. The required repository conventions check currently fails because the PR description contains only a one-sentence summary and omits the required `What`, `Tested`, and `Checklist` sections. Please fill those sections with the intended behavior, actual tests run, and applicable checklist items, then rerun conventions. There is also a concrete integration overlap with #6531: a pairwise `git merge-tree` preview reports conflicts in both `tools/pad_input.py` and `tools/tests/test_pad_input.py`. #6531 changes directory/path validation and error handling; this PR adds entry-point/stream handling. Please coordinate the merge order with that PR’s author, record a dependency if one needs to land first, and preserve both changes in a combined rebase. No closure is requested.
THEMANnt commented 2026-10-29 06:19:24 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Reviewed 70da4aae77e49685cc4f1f64f119f8c48169abaf against 938812df1403f9616dba71744216725891ca4979.

The explicit-argv entrypoint preserves the controller-command writer and reports success through main's return value. Both streams use UTF-8/backslashreplace, including filenames that cannot be printed with strict Unicode handling. No actionable finding in this scoped change.

Windows/Python 3.11: head 14 passed/2 POSIX skips; baseline 12 passed/2 skips. The new explicit-argv tests fail against the old entrypoint signature; that is API-coverage evidence, not proof of an old CLI failure. Independent actual CLI subprocesses write a cross-button command to Unicode/surrogate filenames and exit 0 on both arms under an ASCII/backslashreplace output default. No controller or title was run.

Publication-time checks: merge conflict with main. Please complete these checks before final approval; this status alone is not a demonstrated implementation defect.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693641432 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10206#pullrequestreview-5693641432). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-29T06:19:24Z. **Review:** COMMENTED --- Reviewed `70da4aae77e49685cc4f1f64f119f8c48169abaf` against `938812df1403f9616dba71744216725891ca4979`. The explicit-argv entrypoint preserves the controller-command writer and reports success through main's return value. Both streams use UTF-8/backslashreplace, including filenames that cannot be printed with strict Unicode handling. No actionable finding in this scoped change. Windows/Python 3.11: head 14 passed/2 POSIX skips; baseline 12 passed/2 skips. The new explicit-argv tests fail against the old entrypoint signature; that is API-coverage evidence, not proof of an old CLI failure. Independent actual CLI subprocesses write a cross-button command to Unicode/surrogate filenames and exit 0 on both arms under an ASCII/backslashreplace output default. No controller or title was run. Publication-time checks: merge conflict with main. Please complete these checks before final approval; this status alone is not a demonstrated implementation defect.
MarcZX10 commented 2026-11-22 07:58:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T07:58:53Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the reviewed code supports merging.

What I ran

Reviewed head 70345a51a24958b92f97f119123464c2b9a261bc. No commands or tests were run.

Results

Check Result Note
Code review passed Both changed files read
Tests not run Author reports 12 passing tests

Findings

Blocking

None.

Non-blocking

None.

Not verified

The test suite and runtime behavior were not independently verified. The author reports 12 tests passed on this head and selected Windows tests passed on a merged preview. Both changed files listed in the manifest were read; no files were excluded by the manifest.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6011138359 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10206#pullrequestreview-6011138359). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T07:58:53Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the reviewed code supports merging. ## What I ran Reviewed head `70345a51a24958b92f97f119123464c2b9a261bc`. No commands or tests were run. ## Results | Check | Result | Note | |---|---|---| | Code review | passed | Both changed files read | | Tests | not run | Author reports 12 passing tests | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The test suite and runtime behavior were not independently verified. The author reports 12 tests passed on this head and selected Windows tests passed on a merged preview. Both changed files listed in the manifest were read; no files were excluded by the manifest. ## To get this to a good state Nothing is required.
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!10206
No description provided.