Skip to content

fix(runtime): preserve complete XML content - #10125

Open
OskarEichler wants to merge 3 commits into
electron-userland:masterfrom
OskarEichler:codex/complete-xml-parsing
Open

OskarEichler wants to merge 3 commits into
electron-userland:masterfrom
OskarEichler:codex/complete-xml-parsing

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Summary

  • append successive text and CDATA events instead of overwriting content
  • close the strict SAX parser so truncated documents are rejected
  • reject documents without a root element explicitly
  • add mixed-content and malformed-document regressions

Why

SAX may split one element value across text/CDATA events. Keeping only the last event silently truncated content such as release notes. Calling only write() also skipped end-of-document validation, allowing unclosed XML through.

Verification

  • TEST_FILES=xmlTest corepack pnpm ci:test
  • TEST_FILES=updateUtilTest corepack pnpm ci:test (23 GitHub provider tests)
  • corepack pnpm compile
  • corepack pnpm ci:validate
  • git diff --check

Breaking changes

Malformed or rootless XML that was previously returned as incomplete data now throws a parsing error.

@changeset-bot

changeset-bot Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 125bd73

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
builder-util-runtime Patch
app-builder-lib Patch
builder-util Patch
dmg-builder Patch
electron-builder Patch
electron-publish Patch
electron-updater Patch
electron-builder-squirrel-windows Patch
electron-forge-maker-appimage Patch
electron-forge-maker-nsis-web Patch
electron-forge-maker-nsis Patch
electron-forge-maker-snap Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The focused implementation correctly addresses the parsing defects with appropriate regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Updates XML parsing to preserve segmented content and reject incomplete documents.

Changes:

  • Accumulates text and CDATA values.
  • Finalizes SAX parsing and validates root presence.
  • Adds regression tests and a patch changeset.
File Description
packages/​builder-util-runtime/​src/​xml.ts Fixes content accumulation and document validation.
test/​src/​xmlTest.ts Tests mixed content and malformed XML.
.changeset/​complete-xml-parsing.md Records the runtime patch.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@mmaietta

Copy link
Copy Markdown
Collaborator

@OskarEichler can you please investigate/resolve the pkg scripts test snapshot failure? Seems directly corresponding to this PR
Error: Snapshot pkg scripts 4 mismatched

@OskarEichler

Copy link
Copy Markdown
Contributor Author

@mmaietta Updated pkg scripts 4 in 125bd73 to include the XML whitespace now preserved by parseXml. The follow-up changes only that snapshot: 17 whitespace content lines.

I verified the XML assertion without snapshot-update mode by temporarily making the preceding payload assertion soft and running only pkg scripts; the XML snapshot matched. The temporary instrumentation was restored. The normal macArchive run remains blocked earlier by a local AppleDouble (._*) payload-list mismatch in pkg scripts 3, unrelated to XML; I excluded those payload changes. Compile and the three XML unit tests also passed during validation.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants