Skip to content

Update SwiftSoup from 2.7.5 to 2.13.6#25811

Merged
jkmassel merged 4 commits into
trunkfrom
jkmassel/update-swiftsoup
Jul 22, 2026
Merged

Update SwiftSoup from 2.7.5 to 2.13.6#25811
jkmassel merged 4 commits into
trunkfrom
jkmassel/update-swiftsoup

Conversation

@jkmassel

Copy link
Copy Markdown
Contributor

Description

Bumps SwiftSoup from 2.7.5 to 2.13.6 (latest).

This silences the one warning our cross-platform swift test job still emits:

warning: 'swiftsoup': found 4 file(s) which are unhandled
    .../SwiftSoup/Sources/InfoMac.plist
    .../SwiftSoup/Sources/InfoWatchOS.plist
    .../SwiftSoup/Sources/Info.plist
    .../SwiftSoup/Sources/InfotvOS.plist

The warning comes from SwiftSoup's own manifest — at 2.7.5 its Sources/ directory carries four stray Info*.plist files that the package neither declares as resources nor excludes. Upstream removed them in 2.8.2, so any release past our pin clears it; this takes us to the latest.

  • No breaking API changes across 2.82.13.6. The only floor change is Swift 5.9+ (we're on Swift 6). Every call site we have — parse, parseBodyFragment, clean, and Element/Elements/Comment/Entities — is unchanged.
  • Behavior deltas to be aware of — both covered by the existing tests below: 2.13 added XML auto-detection to parse(), and 2.12 adjusted the clean() sanitizer (CSS-property whitelisting, URL-whitespace handling).
  • Diff is SwiftSoup-only — Modules/Package.swift plus the two committed Package.resolved files. No other dependency moved.

This is deliberately split from the separate swift test warning cleanup (the remaining first-party warnings) so the shared HTML-parsing bump gets its own review and test pass.

Testing instructions

  • swift test (cross-platform package) — 128 tests pass and the swiftsoup unhandled-files warning is gone. This recompiles WordPressShared and runs the Gutenberg excerpt-generator suite against 2.13.6.
  • CI — WordPress + Jetpack iOS builds (the full app build wasn't run locally; this workspace isn't bootstrapped for it).
  • CI — Unit Tests exercise every SwiftSoup call site against 2.13.6:
    • ReaderPostParserTests — Reader post parsing (parse, clean, select)
    • ContentExtractorTestsWordPressIntelligence content extraction
    • GutenbergGalleryUploadProcessorTests — block-editor gallery upload (parseBodyFragment)
    • ReaderPostTests / ReaderPostMappingTests

Related

Removes the `'swiftsoup': found 4 file(s) which are unhandled` warning
emitted during `swift test`. Upstream dropped the four stray `Info*.plist`
files from the package's `Sources/` directory in 2.8.2, so any release past
our pin resolves it — this takes us to the latest, 2.13.6.

No breaking API changes across 2.8–2.13.6 (Swift 5.9+ floor, satisfied). Our
usage — `parse`, `parseBodyFragment`, `clean`, `Element`/`Elements`/`Comment`/
`Entities` — is unchanged.
@jkmassel
jkmassel requested a review from crazytonyli July 22, 2026 05:04
@jkmassel jkmassel added the dependencies Pull requests that update a dependency file label Jul 22, 2026
@jkmassel jkmassel added this to the 27.2 milestone Jul 22, 2026
@jkmassel
jkmassel enabled auto-merge July 22, 2026 05:05
@wpmobilebot

wpmobilebot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number33334
VersionPR #25811
Bundle IDorg.wordpress.alpha
Commit3bd8aa3
Installation URL7rk3gprmom848
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number33334
VersionPR #25811
Bundle IDcom.jetpack.alpha
Commit3bd8aa3
Installation URL4tscma59dc44g
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

Copy link
Copy Markdown
Contributor

🤖 Build Failure Analysis

This build has failures. Claude has analyzed them - check the build annotations for details.

`SwiftSoup` 2.12+ serializes unchanged nodes from a cached slice of the
original source, so the `attr()` mutations the media upload processors
make on nested elements weren't reflected in the output — only the mutated
node is marked dirty, not its ancestors, so `body.html()` re-emitted stale
bytes and uploaded media kept their local `file://` URLs and temp IDs.

`GutenbergContentParser.html()` now replaces each top-level element with a
copy to force a fresh render of the mutated subtrees, while emitting the
surrounding comment/text nodes (Gutenberg block delimiters) from their
original bytes. Output is byte-for-byte identical to the previous behavior.
All Gutenberg upload processor tests pass on 2.13.6.
@jkmassel
jkmassel added this pull request to the merge queue Jul 22, 2026
Extends the existing suite with the coverage the SwiftSoup 2.13.6 fix
relies on but that was missing. The prior element-mutation test only
mutates a top-level node, whose change survives serialization even with
the 2.12+ regression; the new tests mutate nested and deeply-nested
elements, which are the paths that actually broke.

Also pins the serialization contract that shifts across SwiftSoup
versions — void-element normalization, entity / raw-text / preformatted /
unicode fidelity, `html()` idempotence — and the malformed-JSON and
sorted-key attribute handling.
@jkmassel
jkmassel removed this pull request from the merge queue due to a manual request Jul 22, 2026
Moves the SwiftSoup-based Gutenberg code — `GutenbergContentParser`, the
`GutenbergProcessor` protocol, and the image/gallery/file upload
processors — out of the app target into a new `GutenbergProcessors`
module so its tests run under `swift test` on macOS instead of a full
iOS app build. The Aztec-based processors stay in the app; they depend on
UIKit and can't run cross-platform.

Wiring is entirely in Package.swift, no project changes: the module is
added to `keystoneDependencies` (how the app links it), a cross-platform
test target is added to the root package, and the target is registered in
the unit-test plan. `PostCoordinator` is the only consumer.

Runs via `swift test --filter GutenbergProcessorsTests`.
@dangermattic

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ This PR is larger than 500 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

jkmassel added a commit that referenced this pull request Jul 23, 2026
Relocate the String.hash guard test from KeystoneTests to WordPressSharedTests
so it runs under `swift test` at the repo root. #25811 moved the other Gutenberg
tests into GutenbergProcessorsTests but left this one behind — it asserts a
Swift String hash value and has no processor dependency. Drops the vestigial
`@testable import WordPress`.
jkmassel added a commit that referenced this pull request Jul 23, 2026
Relocate the String.hash guard test from KeystoneTests to WordPressSharedTests
so it runs under `swift test` at the repo root. #25811 moved the other Gutenberg
tests into GutenbergProcessorsTests but left this one behind — it asserts a
Swift String hash value and has no processor dependency. Drops the vestigial
`@testable import WordPress`.
jkmassel added a commit that referenced this pull request Jul 23, 2026
Relocate the String.hash guard test from KeystoneTests to WordPressSharedTests
so it runs under `swift test` at the repo root. #25811 moved the other Gutenberg
tests into GutenbergProcessorsTests but left this one behind — it asserts a
Swift String hash value and has no processor dependency. Drops the vestigial
`@testable import WordPress`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file [Type] Tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants