Skip to content

fix(libSceXml): skip ignorable white space by default as firmware 13.40 does - #24665

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
CodingBreadd:fix/libscexml-builder-skip-whitespace
Nov 25, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
CodingBreadd:fix/libscexml-builder-skip-whitespace

Conversation

@CodingBreadd

Copy link
Copy Markdown
Contributor

What

A new or re-initialized sce::Xml::Dom::DocumentBuilder now skips ignorable white space, as libSceXml.sprx of firmware 13.40 does. This library started with every option off, so pretty-printed XML grew white-space text nodes the console never produces: <r>\n <a> </a>\n <b>x </b>\n</r> gave r five children here ("\n ", a with a " " child, "\n ", b, "\n") and two on the console (a without children, b). A title that walks getFirstChild/getSibling expecting elements reads text nodes instead.

The module's engine initialization (0x10d50, reached from the builder's initialize) stores 1 at engine offset 0x80, the byte setSkipIgnorableWhiteSpace writes (0x110b0), and 0 at 0x81 (setResolveEntity, 0x110c0) and 0x82 (setSkipIgnorableText, 0x110d0). Run natively (see Tested): the default matches setSkipIgnorableWhiteSpace(true), the setting holds across documents of one builder, and terminate followed by initialize restores the default. Sax::Parser already starts with skipping on.

Tested

Windows 11 26300, WinLibs GCC 15.2.0 (UCRT, posix), Ninja, Release. ctest --test-dir build -R "^(guest_xml_|xml_dom_)": all 8 libSceXml tests pass; guest_xml_document_builder gains TestSkipIgnorableWhiteSpaceDefault, whose expected trees are the firmware's. tools/check_conventions.py --base origin/main and tools/pr_overlap.py --branch pass. Not tested with a title.

The firmware results come from 13.40 libSceXml.sprx (sha256 810de3883c4d988a5b2fd6306dfb0a5fee02b987682922540cd11a8c242c88d6) mapped into a Windows process by a small loader that applies its relocations, binds its 32 imports to host functions and calls its exports through sysv_abi; not measured on a console. Found while testing Document::serialize against the same module.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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

🤖 Generated with Claude Code

…40 does

The module's engine starts with setSkipIgnorableWhiteSpace on, so a new
or re-initialized DocumentBuilder drops white space that is a node's only
text. This library started with every option off and kept it as text
nodes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

Nothing blocks this change; the focused code review found no verified defect.

What I ran

Reviewed head db7a57829394cb5b435ea1ea30dcfac18521b2a1. Read description.md, commits.md, manifest.json, diff.patch, both changed files, and the relevant ParseOptions definition and TextRun logic. No commands or tests were run.

Results

Check Result Note
Changed code review passed Default options set whitespace skipping
Tests not run Author reports eight focused tests pass

Findings

Blocking

None.

Non-blocking

None.

Not verified

The PR description reports native tests and firmware comparison, but these were not independently run or verified. Title behavior was not tested, as the author notes. files.json was not available; the manifest lists two changed files, both included and read. No files were excluded in the manifest.

To get this to a good state

Nothing is required.

@github-actions github-actions Bot added the prx label Nov 20, 2026

@PrivacyOnion PrivacyOnion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against db7a578293:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_xml_document_builder_tests built cleanly.
  • CTest (guest_xml_document_builder):
    1/1 Test #5528: guest_xml_document_builder .......   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceXml/src/DocumentBuilder.cpp reverted to main and the new tests kept, the suite fails:
    1/1 Test #5528: guest_xml_document_builder .......Subprocess aborted***Exception:   0.38 sec
    0% tests passed, 1 tests failed out of 1
    
    Restoring the change makes it pass again.
  • Code reading:
    • Verified struct BuilderState default initialization in DocumentBuilder.cpp line 32: ParseOptions options{false, true, false} sets skipWhiteSpace=true, matching firmware 13.40 offset 0x80 behaviour.
    • Verified BuilderParse options propagation: state->documentOptions takes state->options when not inProgress, preserving skipWhiteSpace across new documents parsed with the same builder.
    • Verified BuilderSetOption(BuilderOption::SkipIgnorableWhiteSpace, value) toggles state->options.skipWhiteSpace cleanly without side-effects or leaks.
    • Verified memory lifecycle in DocumentBuilder.cpp and GuestXmlDocumentBuilder.cpp: XmlHandle cleanup, Document destruction, and terminate/initialize cycles correctly release allocated resources and restore options.
    • Verified test coverage in GuestXmlDocumentBuilder.cpp: TestSkipIgnorableWhiteSpaceDefault thoroughly tests default skipping, explicitly disabling skipping, option persistence across multiple documents, and default reset upon builder terminate/re-initialize.

Looks Good To Me

@ycbuzi

ycbuzi commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Tested db7a578293 merged into main, with the whole ctest suite on each machine below. Nothing fails that does not also fail on main on the same machine.

  • Windows Server 2022 (GitHub-hosted runner), full build, WinLibs GCC 15.2.0: 99% tests passed, 3 tests failed out of 6522; 99% tests passed, 3 tests failed out of 6522. 3 of the failing tests fail on main too. run
  • Windows Server 2025 (GitHub-hosted runner), full build, WinLibs GCC 15.2.0: 100% tests passed, 0 tests failed out of 6522; 100% tests passed, 0 tests failed out of 6522. run

AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports.

@kiwe147

kiwe147 commented Nov 21, 2026

Copy link
Copy Markdown

Tested head db7a578293, applied with git apply on main fd4aeed483 together with the other 26 PRs of one batch (#24498, #17297, #21499, #21726, #22534, #12900, #17843, #22051, #22075, #23087, #23206, #23222, #23227, #13147, #17482, #21935, #17477, #18272, #22858, #22929, #23028, #23295, #23916, #24179, #24706, #12619). All applied without conflicts and the whole tree built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. GPUs: NVIDIA GeForce RTX 3080 (driver 621.24) and the AMD Radeon iGPU of the CPU (gfx1036, driver 32.0.21036.18). No validation layer. iGPU run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU="AMD Radeon", agc_/video tests only.

tests RTX 3080 iGPU
guest_xml_document_builder (1 test, matched by name to the test file this PR changes) all pass outside the iGPU subset

Whole batch: the full ctest -j 12 (6525 tests) on the RTX 3080 has 8 failing tests; the 4 that also fail on main fd4aeed483 are agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch, agc_storage_write_back_host_retile, and pr_overlap_names, which needs a newer Python than my 3.10. Intermittent in this run (pass when rerun alone, or known flaky): agc_driver_store_over_untracked. Traced to other PRs of the batch, each by reverting it and testing again: #18272 (guest_audio_out), #12900 (guest_user_service_initial_user_bounds); none is in this PR's area. Failing tests I could not trace to a single PR (reverting the likely candidates did not clear them): guest_content_search. The 2125 agc_/video tests on the iGPU have 2 failing: agc_driver_stencil_plane_memory, agc_driver_store_over_untracked (agc_driver_stencil_plane_memory also fails on main).

This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

This was referenced Nov 21, 2026
@oneandonlydean
oneandonlydean merged commit f3d126a into boykopovar:main Nov 25, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants