Skip to content

Sync: preserve Pressable metadata in reconciliation fallback#4078

Open
gcsecsey wants to merge 1 commit into
trunkfrom
stu-1944-preserve-pressable-sync-support
Open

Sync: preserve Pressable metadata in reconciliation fallback#4078
gcsecsey wants to merge 1 commit into
trunkfrom
stu-1944-preserve-pressable-sync-support

Conversation

@gcsecsey

@gcsecsey gcsecsey commented Jul 3, 2026

Copy link
Copy Markdown
Member

Related issues

How AI was used in this PR

Claude investigated the issue, helped reduce it against WPCom with a test Pressable site, and implemented the fix.

Proposed Changes

When the Sync tab loads, Studio refreshes connected-site metadata from page 1 of /me/sites and fetches any connected site missing from that page individually via rest/v1.1 /sites/{id}. The single-site endpoint never returns hosting_provider_guess or environment_type, these are wpcom decorations that exist only on the /me/sites endpoints, even when explicitly requested via fields. Because Pressable support is derived from hosting_provider_guess, a successful fallback response reclassified a known Pressable site as unsupported (and could misfile staging sites), and reconciliation persisted that downgrade. Accounts with more than one page of sites, eg. the 80-site agency in STU-1977, hit this on every Sync tab load.

  • The supplemental fetch now falls back to the stored connected site's isPressable / staging metadata when the response lacks those fields, instead of recomputing sync support from incomplete data.
  • Deletion and permission changes are still detected from the response, only the missing provider metadata is preserved, so a genuinely deleted site or lost permissions still downgrade correctly.
  • A jetpack counterpart (adding hosting_provider_guess/environment_type to the single-site endpoint) is being prepared separately, this guard protects all reconciliation paths regardless.

Testing Instructions

  1. Run the unit tests: npm test -- apps/studio/src/modules/sync/lib/tests/build-supplemental-sync-site.test.ts
  2. Manual verification (the bug needs a connected Pressable site that is NOT on page 1 of /me/sites):
    1. Connect a local site to a Pressable site on an account with 20+ sites (or temporarily lower perPage in apps/studio/src/stores/sync/wpcom-sites.ts to force the fallback).
    2. Reload the Sync tab.
    3. Before this change: the connected site shows "appears to be deleted or is currently unreachable" and its stored record flips to syncSupport: "unsupported", isPressable: false in ~/.studio/app.json. After: it stays recognized as a connected Pressable site and remains syncable.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing ca17908 vs trunk

app-size

Metric trunk ca17908 Diff Change
App Size (Mac) 1345.48 MB 1345.48 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk ca17908 Diff Change
load 762 ms 1119 ms +357 ms 🔴 46.9%

site-startup

Metric trunk ca17908 Diff Change
siteCreation 6495 ms 6496 ms +1 ms ⚪ 0.0%
siteStartup 1861 ms 1862 ms +1 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

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.

2 participants