feat(tools): export symbolized sample reports as JSON #12499
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12499"
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 StoneDC on 2026-10-28T15:55:36Z.
What
Adds
--jsonreports using the same counts as text output, with top lists and sorted module identity status.--outstill writes collapsed stacks. Includes #12498's opt-in strict-window validation; JSON identity lookups use the parser's lowercase keys while display names retain their original spelling.#13197 merged at 2026-10-31T03:32:43Z; its exact merged head
d5cb07d3c8f92a288e4d171af704a019d15db0b2and recorded mainde824c2919ca65086c6324a1e0388866a7327eeaare ancestors. This head includes updated #124982c9c09f4aa27df3b80fb2f03ff55c08451931221. Remaining order: #12498 -> #12499. Stacking through the refreshed prerequisite retains both json and os imports and avoids the import-block conflict against main.Tested
Published head
f8dab396ca32a6a8a3d1595e859a23500cac6339, based on recorded mainde824c2919ca65086c6324a1e0388866a7327eea. Production script and test file are byte-identical to the previous published headcb974d114ad7eb0ee905093b8606df584994f4c5. No function, assertion or timeout changed in this integration update.Windows Python 3.12.14/3.14.3 and Linux Python 3.12.16/3.14.4: the actual registered
symbolize_samplesCTest passes, 47 methods per configuration; four existing Windows filesystem/permission skips, zero Linux skips. With the new regression retained, removing only the strict-window/JSON lookup fix still fails its intended assertion on both OSes and interpreters. No setup/import failure is counted.Actual test commit
6d3be57e51de82630d983796d01c8583920ed6e3and published head have identical complete tree65ea2aecd499f4b5481a6c20a10383b272c700ec; only the final merge message/parent metadata was normalized afterward. Per-head conventions with the complete description, whitespace, prerequisite/main ancestry and unchanged-file checks pass. Fresh hosted checks remain pending until they finish; no new full product, PS5/title, local macOS or GPU test is claimed.Earlier implementation rationale and validation (historical revisions)
What
Add --json sampler counts and module identity status while retaining text output and collapsed-stack --out behavior.
Refresh the prerequisite stack after #13197 was rebased again. Its current description now explicitly states #13197 → #12498 → #12499. Integrate its exact head
df27b15bd6and recorded main, retaining loop-safe path comparisons, both imports on the JSON follower, COFF validation and every original error/feature test. The described order is now aligned across the three PRs; no external branch is edited by this update.Tested
Exact tested head
a4e51e429445f6baea641adcc5c3704de9bd24dc; recorded main9f748f4d8e36ce3714f3b95f3386316e110a9b22; previous published head7406721e044976c3fd4b6c242f2279365aed3989. Recorded main and the previous published head are ancestors. All current-main and previous unique test methods are retained; the documented #12488 context nesting and #12766 identical-shadow cleanup preserve the effective assertions.Windows 11: Python 3.14.3 and 3.12.14, CMake 4.3.1 / MinGW GCC 15.2. Non-root Ubuntu 26.04 / WSL: Python 3.14.4 and isolated Python 3.12.16, CMake 4.2.3 / GCC 15.2. Linux runs exact source archives on its native filesystem; a temporary Git snapshot supplies the release tests' current-tree revision lookup.
For both interpreters on each OS, configure Ninja Release with BUILD_TESTING=ON and ANYPS5_RELINKER_ONLY=ON, then run
ctest --test-dir <build> -R '^symbolize_samples$' -Vand the CTest skip-policy audit. All four configurations pass.Registered
symbolize_samples: 1 CTest group / 42 Python methods pass per configuration. Windows has four existing filesystem/symlink skips; Linux has none. No CTest group skips. Existing real-loop, permissive/strict, JSON where applicable, file-preservation and COFF regressions remain unchanged. The exact live prerequisite is an ancestor; #12499 contains the complete refreshed #12498 headf073e53274625f8a8ccb83d0c9ea10dc5d8ab688.Current-main conventions with this complete description, whitespace, Python 3.9 grammar, AST test-retention and production-script registration checks pass. No timeout was raised. These are interpreter/tool tests, not native product builds. No actual Python 3.9/3.11, local macOS, PS5/title/GPU or live sampler/browser run is claimed. New-head hosted CI starts after publication; old-head approvals/checks are not fresh results for this head.
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-28T16:08:05Z.
Review: COMMENTED
I reviewed head
dc76abdaf171and ran the focusedsymbolize_samplesCTest locally on Linux/Python 3.11; it passed (1/1). Conventions and script registration passed. The JSON path reusessample_counts,self_counts, and the existing module candidate map, preserving default text output and--outcollapsed-stack output. The new tests compare counts/symbols against text, exercise thread filtering and--unverified, and preserve raw addresses for an accepted PE with no symbols. Hosted Ubuntu/Windows relinker, ASan, conventions, intake, labels, and eligibility passed; both macOS relinker jobs remain pending. I found no blocker in this scoped review; this comment is not approval of the remaining platform matrix.Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-28T17:31:39Z.
Review: APPROVED
Reviewed head
dc76abdaf171on macOS 26.2 arm64. This is the first macOS run; the body lists none.Results
python -m unittest tools.tests.test_symbolize_samples: 33 OK on Python 3.9.6 (system), 3.13 and 3.14.tools/symbolize_samples.pyfrom main470a562903and the PR tests, exactly the 3 new tests fail.check_conventions --base upstream/mainclean,check_test_registration --scripts212,git merge-treeagainst470a562903clean.Mutants of
json_report(each run against the full module):identity_matches = candidate_accepted,identity_recorded = candidate_accepted, extra stdout line after the JSON.symbolizer.headersin place ofsamples.headers(same dict object).selfignores--top,inclusiveignores--top, unsortedmodules, andidentity_matches = identity_recorded. In the third case, a recorded size/timestamp that does not match the PE still reportstrue. No current fixture has a record that disagrees with the PE.The code itself is correct. The JSON contract just isn't pinned in these four places. Here is a test-only diff (14 lines) that kills all four. With it the module gives 34 OK on 3.9.6/3.13/3.14, and the main red control goes to 4 failures:
Merge order (non-blocking): your #12498 (sampler subtraction windows, head 9c03facb2f) conflicts with this head in both
tools/symbolize_samples.py(around L307-308) and the test file (L485). Whichever merges second needs a rebase.No blocker. Approving. AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-29T06:46:42Z.
Review: APPROVED
Reviewed
47bebadbe30e31fe94d449c49ce6430a79709f6aagainst46e54cf1f73dcabda5573619e55bd99534776a8d. JSON symbolization reuses the same self/inclusive aggregation as text output and reports candidate acceptance separately from recorded/matching module identity. Collapsed-stack --out behavior is retained; strict window validation remains opt-in. No actionable finding in this scoped review.Windows/Python 3.11 validation: head 33 passed, 3 skipped; baseline 27 passed, 3 skipped. Fixture JSON/text counts, identity states and window-validation cases pass. Old-code controls include unsupported new options and absent helper APIs; they are not all independent bug reproductions. Platform alias/permission cases are skipped; no live sampler capture was made.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T06:37:49Z.
Review: CHANGES_REQUESTED
Re-checked — new head, changes requested
On head
d04458600f1cc0f6359b21d9feabd0d2efcd2fc3, the new error boundary still leaks aRuntimeErrorfor symlink-loop paths, and the related open fix has no declared landing order.What I ran
d04458600f1cc0f6359b21d9feabd0d2efcd2fc3; recorded base:4c7d275bef89d309313d16bc2bc05d37a1b50be2; currentmain:47cdccde40bca36c1203ec498d9ff47f23bc6537.1f48be6a1bf05f50a745dee6e301a12b828d5bcf.Results
git diff --checkexited 0 with no output.RuntimeErrortraceback for an--outsymlink loop.Unedited check output
Findings
Blocking
An output symlink loop escapes the new CLI error boundary. The wrapper catches
OSErrorandValueError, but on Python 3.11Path.resolve()raisesRuntimeErrorfor a loop. I reproduced this on the exact head using--outpointing to a two-link cycle: the command exits 1 with a traceback rather than the documented usage-error path. Handle this exception or use a loop-safe path comparison, and add a regression for looped output, sample, and--sincepaths. Open PR #13197 contains a relatedos.path.realpathchange and those regression cases; coordinate the implementation rather than duplicating work.The overlapping changes have no declared order. The PR overlap comment lists #13197 touching
tools/symbolize_samples.py; #12499's checklist still saysDepends on: none. The #13197 description says it should land second with an import-line port, but its checklist also saysnone. The repository asks overlapping PR authors to agree on an order and declare it. Please confirm the order with that author and update the appropriate checklist line.Sources
Path.resolve()call at headd04458600f1cc0f6359b21d9feabd0d2efcd2fc393244d6c0e50d8d4aee77e06418c716736afec3fmain47cdccde40bca36c1203ec498d9ff47f23bc6537Not verified
I did not run Python tests on Windows or macOS. The author-reported cross-platform test results were not independently reproduced. Product and specialized hosted jobs are skipped; no build was needed for this Python change.
To get this to a good state
Return symlink-loop input paths through the normal usage-error path without a traceback, add regressions for all three path arguments, and record the agreed #13197 landing order. I will rerun the suite and source checks on the exact new head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T07:53:11Z.
Review: APPROVED
Reviewed — looks good
At exact head
76b1c846a1ebb7c3c24552a54d483e938be73981, the symlink-loop fix, regression tests, and declared dependency order are in place; the focused Python suite passes.What I ran
Reviewed the PR against current
mainf7f03daf52f11191174b1be089a56e268390a707; the merge preview was clean (67bbb3f21608513df57e1a23c249027c7d45a6ad). Environment: Linux x86_64, Python 3.11.2, Git 2.39.5. Ran the tests from a detached worktree at the exact PR head.Results
git diff --checkmain67bbb3f21608513df57e1a23c249027c7d45a6ad.Unedited local output
Findings
Blocking
None found in the reviewed update.
Non-blocking
None.
Sources
symbolize_samples.pyat the reviewed head uses loop-safeos.path.realpathcomparisons for source/output paths.Not verified
I did not run the Python suite on Windows or macOS. The hosted Windows/macOS relinker jobs are still pending; they do not exercise the changed Python tool.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-30T22:58:50Z.
Review: COMMENTED
Merge-skew check against current
main:symbolize_samplesfails after a clean merge.Setup: Linux x86_64 (i7-8700, Ubuntu 26.04, Python 3.14.4). Head
a4e51e4294, merged with--no-ffontomain9605300f29(clean merge, local only). Ranpython3 tools/tests/test_symbolize_samples.pyand the relinker-only CTest suite.Result: 5 failures, 3 of 3 runs. The same test passes on the head alone and on
mainalone.validate_window()looks up# modulerecords with the frame's case.test_json_and_text_share_counts_for_real_pe_symbols_and_unknown_modules,test_json_honours_top_sorts_modules_and_reports_identity_mismatch, and the--json --require-matching-windowsubtest oftest_json_loop_errors_preserve_files_with_matching_window. In the first two,identity_recordedandidentity_matchescome outFalsefor modules that do have a matching record.Cause: #13419 (
98a587adbe, merged as82debeeae0today, after this head).read_headers()now stores the module names in lowercase. Themodulesentries of the JSON report still usename in samples.headersandsamples.headers.get(name). To confirm: the PR merged onto82debeeae0^1passes, and onto82debeeae0it fails.Fix (verified): the #12498 change plus the same lookup in the JSON report. With both on the merge, the file passes 3 of 3 runs (45 tests).
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T01:33:02Z.
Review: APPROVED
Re-checked — new head, looks good
At head
cb974d114ad7eb0ee905093b8606df584994f4c5, strict-window and JSON module identity now use the parser's lowercased header keys, and the new cases pass with targeted controls distinguishing the previous implementation.What I ran
Reviewed exact head
cb974d114ad7eb0ee905093b8606df584994f4c5against PR basebff0289787c98570491c8f175179c8a5651c8017. The live merge preview against currentmain0a63de777bdff1babae0ae3e30790ba11039c2a1was clean. Environment: Linux 6.1.0-54-amd64 x86_64, Python 3.11.2; no project build was run.The precheck ran
py_compile, the registered Python test module, test registration, diff/conventions checks, and the live stack check against this exact head.Results
tools.tests.test_symbolize_samplesadd_testor workflow.tools/pr_test_quality.py, so that heuristic did not run. The precheck's default negative-control attempt used currentmain, which lacks the declared stack; I instead used the previously approved PR head as the control below.Unedited output excerpts
The aggregate precheck conclusion reflects the unavailable test-quality helper and its current-main negative-control setup; the exact-head Python suite, syntax, registration, conventions, and merge checks above passed.
Negative control
a4e51e429445f6baea641adcc5c3704de9bd24dc, kept the new test file, and ran the two new case-insensitive testsThe separate symlink-loop regression already passes on that prior head; it predates this update and is not counted as a negative control for the current changes.
Findings
Blocking
None found in the updated diff or checks.
Non-blocking
macOS relinker checks and the labels job were still pending when checked. I did not run a project build.
Sources