Skip to content

Consolidate the Spotlight open path - #25991

Open
crazytonyli wants to merge 3 commits into
task/spotlight-index-fixesfrom
task/spotlight-open-path-cleanup
Open

Consolidate the Spotlight open path#25991
crazytonyli wants to merge 3 commits into
task/spotlight-index-fixesfrom
task/spotlight-open-path-cleanup

Conversation

@crazytonyli

@crazytonyli crazytonyli commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Description

Opening a Spotlight result currently uses separate callback-based paths for WP.com and self-hosted posts, with duplicate navigation logic for posts and pages.

This PR:

  1. Makes SearchIdentifierGenerator.decomposeFromUniqueIdentifier(_:) reject malformed and unknown identifiers.
  2. Adds AbstractPost.SearchIdentifier to resolve the exact site and post for WP.com and self-hosted sites.
  3. Routes Spotlight results through openItem(withUniqueIdentifier:), with shared post and page navigation. It opens cached posts immediately, fetches missing posts, and rejects trashed posts.

Testing instructions

  • Open published and draft posts and pages from Spotlight on WP.com and self-hosted sites.
  • Open a Spotlight result for a post that is not cached locally.
  • Verify invalid or stale Spotlight results do not navigate or crash.

…ifier type

Identifiers arrive from the system through Spotlight activities, so the
composite format cannot be assumed. Decomposition now returns nil for a
malformed identifier or an unknown item type instead of indexing past the
end of the components. A post identifier type parses a post's composite
identifier into its site domain and post ID, and resolves the site by WP.com
ID or xmlrpc URL and the cached post from it.
Route every Spotlight tap through one async open method that resolves the
identifier, fetches the post from the cache first and the network second,
refuses trashed posts, and reports whether anything was put on screen. The
activity handler validates the identifier up front and dispatches the open,
so a malformed identifier is rejected instead of misrouted. Post and page
navigation share one method, and the Reader helpers return a result instead
of taking failure closures.
@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.
1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@crazytonyli crazytonyli changed the title task/spotlight open path cleanup Consolidate the Spotlight open path Sep 4, 2026
@crazytonyli
crazytonyli requested a review from jkmassel September 4, 2026 01:28
@crazytonyli crazytonyli added this to the 27.3 milestone Sep 4, 2026
@crazytonyli
crazytonyli marked this pull request as ready for review September 4, 2026 01:29
@wpmobilebot

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 Number34374
VersionPR #25991
Bundle IDcom.jetpack.alpha
Commit4d8ee7c
Installation URL7taeb88e14s7g
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
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 Number34374
VersionPR #25991
Bundle IDorg.wordpress.alpha
Commit4d8ee7c
Installation URL26pum17qb0tkg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

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.

3 participants