Repository navigation
Conversation
PS5 handling of the superframe remainder after a gapless total is unmeasured. The proposed discard rule conflicts with TestAt9GaplessSegments, so keep default continuation unchanged. Enable the experiment only with APS5_AJM_GAPLESS_END_TAIL=1. Retain validated tails across partial runs, consume exact retries without output, decode appended superframes, and clear retained bytes on reset. Add regression coverage and document the uncertainty. Credit akkadbakkad89 for proposing the rule in boykopovar#11700. Related: boykopovar#11700 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cover three paths of the opt-in gapless tail rule that the earlier cases did not reach: an output limit that stops before an unchanged gapless total, queued resampler output at ratios 0.5 and 2, and single-frame jobs without RUN_MULTIPLE_FRAMES. Each case checks that an exact tail retry is discarded after the total is reached. Related: boykopovar#11700 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Check that a matching short prefix of the retained tail consumes no input while resampled PCM is still queued, and that the full tail is then discarded. Check that a decoder failure, a context clear or a gapless reset before the total is reached leaves no retained bytes that could discard later input. Related: boykopovar#11700 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — changes requested
The opt-in discard rule adds explicitly unmeasured console behavior despite the repository rule that unknown behavior must throw; the PR needs an approved exception or must keep that path throwing.
What I ran
Reviewed head 82a08a337682115fc33d0cb4560bb5947d291b01 against base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 (main); the merge preview was clean. Environment: Debian Linux 6.1, Python 3.11.2, GCC 12.2.0. I read all four changed files and the relevant policy, AJM test registration, and discussion.
gh api repos/boykopovar/AnyPS5/pulls/14735 --jq '{state:.state, head:.head.sha, base:.base.sha, base_branch:.base.ref}'
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14735
git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...82a08a337682115fc33d0cb4560bb5947d291b01
python3 tools/pr_abi_audit.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 82a08a337682115fc33d0cb4560bb5947d291b01
python3 tools/pr_test_quality.py --root /marc/AnyPS5 --json core/libs/tests/GuestAjm.cpp
gh pr checks 14735 --repo boykopovar/AnyPS5Results
| Check | Result | Note |
|---|---|---|
| Diff and conventions | passed | Whitespace and PR template checks passed. |
| Merge preview | passed | Clean against the stated base. |
| Export audit | passed | No ABI issue found. |
| Test registration | passed | Heuristic warning cleared by CMake inspection. |
| AJM runtime tests | not run | Require an exact-head build. |
| Hosted CI | not run | Six jobs were queued on this head. |
Commands and unedited check output
Precheck report table:
| Check | Status | Command / reason |
|---|---|---|
| build_and_compile | not_applicable | The precheck deliberately does not configure, build, or compile AnyPS5. |
| diff_check | passed | git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...82a08a337682115fc33d0cb4560bb5947d291b01 |
| conventions_and_pr_template | passed | /usr/bin/python3 tools/check_conventions.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 82a08a337682115fc33d0cb4560bb5947d291b01 --title fix(ajm): add opt-in gapless superframe tail discard --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14735-82a08a337682/pr-body.md |
| changed_export_abi_audit | failed | /usr/bin/python3 tools/pr_abi_audit.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 82a08a337682115fc33d0cb4560bb5947d291b01 --json |
| python_syntax | not_applicable | No changed Python implementation files. |
| related_python_unit_tests | not_applicable | No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite. |
| python_test_registration | not_applicable | No changed test_*.py files. |
| live_dependency_and_mergeability_check | passed | /usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14735 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14735-82a08a337682/stack |
| build_dependent_cpp_tests | not_applicable | Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build. |
| test_quality_heuristics | failed | /usr/bin/python3 /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14735-82a08a337682/head-82a08a337682-56af92a2/tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14735-82a08a337682/head-82a08a337682-56af92a2 --json core/libs/prx/libSceAjm.native/src/Ajm.cpp core/libs/tests/GuestAjm.cpp docs/dev/ENVIRONMENT.md docs/dev/debt/libSceAjm.native.md |
| negative_controls | not_applicable | No changed Python test module in tools/ can be run as a no-build base-source control. |
Precheck raw output:
All conventions checks passed.
/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14735-82a08a337682/head-82a08a337682-56af92a2/tools/pr_abi_audit.py': [Errno 2] No such file or directory
/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14735-82a08a337682/head-82a08a337682-56af92a2/tools/pr_test_quality.py': [Errno 2] No such file or directory
ABI audit raw output:
ABI audit: passed
sceAjmBatchCancel: NID=NVDXiUesSbA declarations=1 definitions=1 aliases=0
sceAjmBatchErrorDump: NID=WfAiBW8Wcek declarations=1 definitions=1 aliases=0
sceAjmBatchInitialize: NID=MmpF1XsQiHw declarations=1 definitions=1 aliases=0
sceAjmBatchJobClearContext: NID=uJ3m8INuikg declarations=1 definitions=1 aliases=0
sceAjmBatchJobControl: NID=7FZsbyVRM4U declarations=1 definitions=1 aliases=0
sceAjmBatchJobControlBufferRa: NID=dmDybN--Fn8 declarations=1 definitions=1 aliases=0
sceAjmBatchJobDecode: NID=39WxhR-ePew declarations=1 definitions=1 aliases=0
sceAjmBatchJobDecodeSingle: NID=5LLWbpP5xi8 declarations=1 definitions=1 aliases=0
sceAjmBatchJobDecodeSplit: NID=SJ3i0DXP8vg declarations=1 definitions=1 aliases=0
sceAjmBatchJobGetCodecInfo: NID=uSrXaxT+oPQ declarations=1 definitions=1 aliases=0
sceAjmBatchJobGetGaplessDecode: NID=Esr9db8S1S0 declarations=1 definitions=1 aliases=0
sceAjmBatchJobGetInfo: NID=TBWW4aPfWcA declarations=1 definitions=1 aliases=0
sceAjmBatchJobGetResampleInfo: NID=JkdNCocpu1M declarations=1 definitions=1 aliases=0
sceAjmBatchJobGetStatistics: NID=3cAg7xN995U declarations=1 definitions=1 aliases=0
sceAjmBatchJobInitialize: NID=ezM2OhNxzck declarations=1 definitions=1 aliases=0
sceAjmBatchJobInlineBuffer: NID=stlghnic3Jc declarations=1 definitions=1 aliases=0
sceAjmBatchJobRun: NID=jVCWcthifr8 declarations=1 definitions=1 aliases=0
sceAjmBatchJobRunBufferRa: NID=ElslOCpOIns declarations=1 definitions=1 aliases=0
sceAjmBatchJobRunSplit: NID=Z9NVCesiP0Q declarations=1 definitions=1 aliases=0
sceAjmBatchJobRunSplitBufferRa: NID=7jdAXK+2fMo declarations=1 definitions=1 aliases=0
sceAjmBatchJobSetGaplessDecode: NID=SkEwpiu3tZg declarations=1 definitions=1 aliases=0
sceAjmBatchJobSetResampleParameters: NID=81HsnXFbWS4 declarations=1 definitions=1 aliases=0
sceAjmBatchJobSetResampleParametersEx: NID=5ldnD16rYZw declarations=1 definitions=1 aliases=0
sceAjmBatchStart: NID=5tOfnaClcqM declarations=1 definitions=1 aliases=0
sceAjmBatchStartBuffer: NID=fFFkk0xfGWs declarations=1 definitions=1 aliases=0
sceAjmBatchWait: NID=-qLsfDAywIY declarations=1 definitions=1 aliases=0
sceAjmDecAt9ParseConfigData: NID=1t3ixYNXyuc declarations=1 definitions=1 aliases=0
sceAjmDecMp3ParseFrame: NID=eDFeTyi+G3Y declarations=1 definitions=1 aliases=0
sceAjmFinalize: NID=MHur6qCsUus declarations=1 definitions=1 aliases=0
sceAjmInitialize: NID=dl+4eHSzUu4 declarations=1 definitions=1 aliases=0
sceAjmInstanceCreate: NID=AxoDrINp4J8 declarations=1 definitions=1 aliases=0
sceAjmInstanceDestroy: NID=RbLbuKv8zho declarations=1 definitions=1 aliases=0
sceAjmMemoryRegister: NID=bkRHEYG6lEM declarations=1 definitions=1 aliases=0
sceAjmMemoryUnregister: NID=pIpGiaYkHkM declarations=1 definitions=1 aliases=0
sceAjmModuleRegister: NID=Q3dyFuwGn64 declarations=1 definitions=1 aliases=0
sceAjmModuleUnregister: NID=Wi7DtlLV+KI declarations=1 definitions=1 aliases=0
limit: This lexical audit does not parse C++ fully, prove calling-convention or binary ABI correctness, verify runtime version tables, or replace compilation.
limit: An absent source declaration or explicit alias can be intentional for assembly exports, conditional platform code, or generated interfaces; inspect findings before treating them as defects.
Test-quality heuristic raw output:
{
"findings": [
{
"path": "core/libs/tests/GuestAjm.cpp",
"line": 1,
"kind": "possible-unregistered-cpp-test",
"message": "Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage."
}
],
"negative_control_candidates": [],
"limits": [
"Heuristics can miss weak assertions and can flag valid tests; inspect every finding.",
"A test that passes against base is not by itself proof that the PR test is inadequate.",
"Negative controls are only candidates until the test actually runs against base and fails by assertion rather than import/setup error."
]
}The warning was checked against the exact-head core/libs/prx/libSceAjm.native/CMakeLists.txt, which registers this source as guest_ajm.
Hosted CI output:
conventions pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41332011325/job/124923903896
eligibility pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41332011333/job/124923902789
intake pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41332011168/job/124923903344
labels pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41332011120/job/124923903548
library-portability pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41332011319/job/124923902492
report pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41332011329/job/124923902474
Negative control
The author reports disabling APS5_AJM_GAPLESS_END_TAIL in a temporary test variant: the output-limit, resampler-queue, single-frame and queued-prefix cases failed, while the stale-state cleanup case passed as expected. I did not reproduce this control because it requires the compiled test binary.
| Assertion | Change to code under test | Result here |
|---|---|---|
| New tail-discard cases distinguish enabled behavior | Disable the opt-in switch | Not run by me; author-reported failures above. |
| Stale-state cleanup is independent of the opt-in | Disable the opt-in switch | Not run by me; author reports it passed. |
Findings
Blocking
- Unknown behavior is implemented behind an environment flag. The PR says console handling is unmeasured and asks for an exception to
AGENTS.md, which directs unknown general behavior to throw and be recorded in the debt file. The opt-in flag limits when the new rule runs but does not establish that the rule is valid or that a policy exception was approved. Please obtain maintainer approval for the exception, or make the unsupported path throw until the behavior is measured. The exact implementation and uncertainty are recorded in the PR and debt entry.
Non-blocking
- None found in the source and tests read. The author-reported Windows runs are not independently verified here.
Sources
- Repository rule at the reviewed head
- Contribution rule at the reviewed head
- Opt-in rule and implementation
- Existing gapless test and added cases
- CMake registration for
GuestAjm.cpp - Documented uncertainty
Not verified
I did not build or run the AJM C++ tests, test on Windows, or verify behavior on a PS5. The contributor's Windows results and the in-title run reported in the PR are author-supplied evidence. The Ajm.cpp blob at this head matches the implementation blob in the cited prior in-title commit, but that does not independently verify the reported run or console semantics. Hosted checks were pending at review time.
To get this to a good state
Please obtain maintainer approval for the documented exception or change the unsupported path to throw. On the updated head I will rerun the precheck, ABI audit, test-registration inspection and available hosted checks; a build remains necessary to verify the AJM runtime tests.
Re-checked — corrected evidence attributionI misstated who reported the in-title run in my review; it was reported by Tamalero, not the PR author. The run remains contributor-reported evidence from the PR discussion and was not independently verified by me. The Windows test results in the PR were reported by the PR author. |
|
Thanks, @MarcZX10. Keeping the opt-in discard rule needs a maintainer exception to the AGENTS.md rule. @adriadam10, @oneandonlydean: would you accept that exception? If not, I'll remove the rule and throw when an ATRAC9 run ends with its nonzero gapless total reached and bytes remaining in the current superframe. That also changes the default behaviour, and I'd update the affected tests, including AI-assisted: yes |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
There was a problem hiding this comment.
Correction (2026-11-01): this review's claim that maintainers close PRs without a title ID is wrong. CONTRIBUTING allows Unblocks: none; a title is only required when the PR fixes a title. The technical points below are unaffected.
On the question the author put to the maintainers: I would not take the exception.
-
The opt-in rule is behaviour nobody has measured on console. AGENTS.md says to throw and record in the debt file when the general behaviour is unknown, and an
APS5_AJM_GAPLESS_END_TAILswitch is the same approximation with a flag in front of it. It also adds a permanent knob toENVIRONMENT.mdthat titles will end up depending on. Keeping this on a probe branch until there is a measurement is the cleaner route. -
The code is ~600 lines (mostly tests) for a rule that is off by default. In
Ajm.cppthe rule adds two per-instancestd::vector<uint8_t>copies of the superframe remainder, amemcmpon every run job once a tail is held, and aResetDecoderon the resubmission path. Those are cheap, but none of it is justified without a title where #11700 actually reproduces. -
The PR names no title ID with a log line showing a title reaching this path on main. The body says it was not run in a title by the author. Without that, this is the export-only pattern maintainers close.
-
The test change
decoded.stream.result == 0x10added to the accepted set in an existing assertion widens a check that currently cannot distinguish a fatal-free end from the new end-of-stream status. Please say which existing test needed it and why, since it weakens that assertion for the switch-off case too.
If the throw-on-remainder alternative is chosen, it needs the TestAt9GaplessSegments expectation changed in the same PR, and a trace from a real title showing the remainder case is hit.
|
Thanks, @MarcZX10 and @CnRJay. I'm closing this and keeping the probe branch at The unpushed throw variant rejects the second run in #2052's On point 4, I widened AI-assisted: yes |
What
I add an experimental ATRAC9 superframe-tail discard rule, enabled only by
APS5_AJM_GAPLESS_END_TAIL=1. PS5 handling of the remainder after a gapless total is unmeasured, and the proposed rule conflicts withTestAt9GaplessSegmentsfrom #2052. With the switch unset, the existing continuation is unchanged. I record the uncertainty in the AJM debt file anddocs/dev/ENVIRONMENT.md. Related: #11700.AGENTS.md requires a throw when the general behaviour is unknown. I propose an exception here to preserve the existing continuation exercised by
TestAt9GaplessSegmentswhile allowing opt-in testing of the alternative for #11700. Console behaviour remains unmeasured. If this exception is unsuitable, I can change the unsupported path to throw.I retain the complete superframe remainder from input accepted for decoding. An exact resubmission is consumed without PCM output; appended superframes follow the normal decode path. Matching short prefixes remain unconsumed and retain the tail. Mismatches continue through the existing decoder. Resets and initialization clear retained bytes.
I credit @akkadbakkad89 for proposing the rule. I have not run it in a title myself or confirmed its semantics on console hardware. I do not claim to close #11700.
tools/pr_overlap.pyfound no confirmed overlap among 1,838 open PRs but could not compare 41 that conflict withmain. I manually checked the 40 affectingdocs/dev/ENVIRONMENT.md; none adds or changes an AJM, ATRAC9, gapless or superframe entry. The remaining PR, #14212, adds blank lines between debt entries, including indocs/dev/debt/libSceAjm.native.md, where this branch replaces one entry. Whichever merges second needs a trivial rebase.Tested
I tested the source tree now committed as 82a08a3 on
mainf2d874c, on Windows 11 build 26200 with WinLibs MinGW-w64 GCC 15.2.0 UCRT r7, Ninja, Release andBUILD_TESTING=ON. The full suite tested the source tree subsequently committed as e96ec11; the last commit only adds two test cases, after which I rebuilt and reran the AJM tests.libswith eight jobs and verified that the three MinGW runtime DLLs beside the patched libraries match the toolchain copies.ctest --test-dir build -R '^guest_ajm' --timeout 300 --output-on-failure: 4/4 passed (guest_ajm,guest_ajm_aac_multichannel,guest_ajm_vibration,guest_ajm_wvorbis).guest_ajmruns 57 named test functions across its default and opt-in processes, 11 of them opt-in tail cases.TestAt9GaplessEndTailOutputLimitchecks an unchanged total of 300, output room for 256 samples, a 44-sample resume and exact-tail discard.TestAt9GaplessEndTailResamplerQueuechecks total 300, skip 100, ratios 0.5 and 2, small output buffers, PCM, sample totals, frame counts and held-sample counts across exact-tail and appended-input retries.TestAt9GaplessEndTailSingleFrameJobschecks successive 256- and 44-sample emissions withoutRUN_MULTIPLE_FRAMES, short-prefix retention and exact-tail discard.TestAt9GaplessEndTailQueuedPrefixchecks, at ratios 0.5 and 2 with resampled PCM still queued, that a matching 165-byte prefix of the retained 330-byte tail consumes no input while queued PCM drains, and that the full tail is then consumed without new PCM, with the total staying at 300.TestAt9GaplessEndTailStaleStatechecks recovery after malformed continuations (result 2, nothing consumed or emitted) and subsequent decoding after context clear or gapless reset before completion, including lowering the total from 512 to 128.ctest --test-dir build -j 8 --timeout 300 --output-on-failure: 3,264 passed, 10 skipped and 11 failed out of 3,285. On a subsequent serial rerun with CTest 4.3.1, 10 passed.guest_wide_formattingstill failed at the knownwcsftimelength comparison caused by this machine's cp1250 time-zone name (fix(libc): convert Windows time zone names to UTF-8 #10987). None of the 11 is an AJM test.python tools/check_conventions.py --base origin/mainandgit diff --check origin/main; both passed.Tamalero reported an in-title run of 4692b07, the same implementation as e418313 on an older base, in Ratchet & Clank: Rift Apart (PPSA01474 v01.005.003), using an RTX 4090 under Linux. Their stack was
mainbb04a4f, including #12322, plus #9749, #10906, #10000 and local probes, including a skip of two refused dispatches. They removed their local version of the rule before cherry-picking; one manual Ajm.cpp merge involved an unused probe, and the added implementation lines remained identical.With the same build and route, enabling the switch reached Rivet's opening; the run stopped at 235 s, about 1,360 frames, with four tail discards and no instance decoding past its gapless total. With the switch unset, the game froze before "Press X" at frame 455, about 55 s, and remained frozen at 387 s. Instance 16420 decoded 768 samples beyond its total of 296,960. Their comment notes that the run and write-up were done by Claude on a contributor's machine; it was not my run.
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)