fix(tools): validate the timeline body when resuming its sequence #11885
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11885"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-27T11:33:25Z.
What
previous_sequenceintools/pad_input.pyvalidated only the header of anAPS5_PAD_TIMELINEcommand, whilePad::InputCommandFile::read()(core/libs/prx/libScePad/include/InputCommandFile.hpp) accepts or rejects the whole file: every event row (token count,+-prefixed unsigned values, button mask ⊆0x10fffe|0x200000|0x400000, duration 1–5000, ordered non-overlapping events,start ≤ 3600000 − duration, line ≤ 127 chars) and the whitespace-only tail.A hand-edited command file with a valid header and an invalid body therefore reported a sequence the runtime never adopted:
18446744073709551615and any rejected row, bothpad_input.pyandpad_timeline.pyrefuse every further command with "controller command sequence is exhausted" until the file is deleted — even though the runtime rejected that command and would adopt a fresh one.The single-pulse branch of
previous_sequencealready mirrored its consumer exactly; the timeline body mirror was missing.previous_sequencenow validates the timeline body with the same acceptance rules asread(): each of thecountrows must be three unsigned tokens ≤ 2⁶⁴−1 within the 127-char line budget, with the consumer's mask, duration, ordering and one-hour checks, and only whitespace may follow. A header whose body is rejected contributes no sequence, so the helpers resume from their own clock, and the exhaustion lockout above no longer triggers.Tested
macOS 26.2, Apple M5 (arm64), CMake/Ninja,
ANYPS5_RELINKER_ONLY=ON,BUILD_TESTING=ON(Python 3.13). Base:8ff4baf534(upstream/main), tested head:fa895b282e.Differential check on this Mac against the real consumer:
InputCommandFile.hppcompiled with a driver printinglastSequenceafter the constructor's first read, compared withpad_input.previous_sequenceovercompile_timeline/pad_input.py(event counts, repeats, gaps, every button combination incl. touch bits and stick forms) — all accepted by the consumer with the exact expected sequence, and-/4-token rows, mask bits outside0x70fffe, duration 0/5001/6000, start 3600000, out-of-order rows,+/leading-zero/oversized values, tabs/CRLF/BOM/unicode digits, 127/128/129-char lines, NUL and junk tails, whitespace-only tails, boundary rows3599996 4vs3599996 5).Before: 13 divergences, all header-valid/body-invalid timelines where Python over-reported the sequence. After: 0 divergences in 337 cases.
tools/tests/test_pad_input.py: valid multi-row body (with+-prefixed row and trailing whitespace) still advances the sequence; twelve rejected bodies contribute no sequence; an exhausted header with a rejected body no longer locks out commands. 39/39 pass; full relinker ctest 361/361;check_conventionsandpr_overlapclean.Host-only change to the Python tool; no title, GPU or console involved. No performance claim.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T11:44:19Z.
Review: CHANGES_REQUESTED
Please restore the required pull request template in the description. The current
conventionscheck fails with three explicit findings: missing### What,### Tested, and### Checklistheadings.CONTRIBUTING.mdrequires copying the template, retaining its lines, and filling the checklist fields (including Depends on, Unblocks, GPUs tested, and AI-assisted). The current Problem/Change/Evidence/Tests sections contain useful detail, but do not satisfy that required format.I reviewed the Python validator against
Pad::InputCommandFile::read()and ranpython3 -m unittest tools.tests.test_pad_inputon the PR files: 14 tests passed. The Linux/Windows relinker jobs and ASan pass; macOS relinker remains pending. Please update the template and rerun conventions before merge.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T12:23:03Z.
Review: APPROVED
The PR template is restored with the required
What,Tested, andChecklistsections, and the conventions check now passes. The implementation still matches the timeline validator change reviewed earlier; the local Python suite passed 14/14 cases. Hosted Windows/Linux relinker and ASan checks pass; macOS relinker jobs remain pending, but this Python-only change does not alter relinker code. I found no remaining blocker in this PR.Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-28T04:23:03Z.
Review: APPROVED
Reviewed
fa895b282e15f348bd13ef11bfee9222b5bb51f3— approve. Resuming a command sequence now validates the entire timeline body rather than trusting a valid-looking header.Windows/Python 3.11: head 19 passed, 2 skipped (21 total); author base 16 passed, 2 skipped (18 total). The old-production control fails the new malformed-body cases, including ordering, bounds, masks, count and trailing data. File read errors continue to propagate rather than being mistaken for an absent command. No real controller was exercised.
The inspected hosted Windows relinker job merged this exact head and completed successfully. This is not a full product or game build.
Pull request closed