Skip to content

Agentic UI: Create site from import - #4249

Merged
bcotrim merged 9 commits into
trunkfrom
make-agentic-import-retryable
Jul 22, 2026
Merged

Agentic UI: Create site from import#4249
bcotrim merged 9 commits into
trunkfrom
make-agentic-import-retryable

Conversation

@bcotrim

@bcotrim bcotrim commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Related issues

  • N/A

How AI was used in this PR

Codex helped inspect the existing import paths, implement the end-to-end increment, and add focused tests. I reviewed the changes and manually exercised the local-web workflow, including failure, rollback, retry, and light/dark states.

Proposed Changes

  • Add an Import from a backup option to Add a site that opens the system file picker or accepts a dropped backup, including SQL, and pre-fills an editable site name.
  • Extend the legacy desktop Add Site import flow to accept SQL backups, matching the existing import backend support.
  • Make imports safely retryable by retaining the selected file, resolving or uploading it on every attempt, and using collision-safe temporary paths.
  • Keep the Electron IPC and local-web import behavior aligned, roll back a newly created site after an import failure, and open the usable site after a successful import.
  • Show accessible progress, prevent duplicate actions and navigation only while work is active, and provide phase-specific failure guidance with retry and replacement-file actions.

Testing Instructions

  1. Open Add a site, choose or drop a supported backup, and confirm the setup form opens directly.
  2. Confirm the suggested name is sensible and editable.
  3. Import a malformed backup and confirm the new local site is removed, the selected backup remains available, and the failure state offers Retry import and Choose another backup.
  4. Retry and confirm a fresh uploaded path is used.
  5. Confirm Close, Back, and duplicate submission are blocked only while the import is active.
  6. In the legacy desktop Add Site flow, choose Import from a backup and confirm a .sql file is accepted.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@bcotrim bcotrim self-assigned this Jul 17, 2026
@bcotrim bcotrim changed the title Make agentic site imports retryable Jul 17, 2026
bcotrim added 5 commits July 17, 2026 19:48
…retryable

# Conflicts:
#	apps/studio/src/modules/add-site/components/options.tsx
…retryable

# Conflicts:
#	apps/ui/src/data/core/connectors/ipc/index.ts
#	apps/ui/src/data/core/connectors/local/index.ts
#	apps/ui/src/data/core/types.ts
@bcotrim
bcotrim marked this pull request as ready for review July 22, 2026 08:19
@bcotrim
bcotrim requested review from nightnei and sejas July 22, 2026 08:20
@wpmobilebot

wpmobilebot commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 741002a vs trunk

app-size

Metric trunk 741002a Diff Change
App Size (Mac) 1361.99 MB 1361.93 MB 0.06 MB ⚪ 0.0%

site-editor

Metric trunk 741002a Diff Change
load 1080 ms 1079 ms 1 ms ⚪ 0.0%

site-startup

Metric trunk 741002a Diff Change
siteCreation 7000 ms 6982 ms 18 ms ⚪ 0.0%
siteStartup 2352 ms 2355 ms +3 ms ⚪ 0.0%

Results are median values from multiple test runs.

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

@sejas sejas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I tested the PR importing new sites and during the onboarding flow and everything worked fine. I also tested with broken imports and the error is visible to users.

Onboarding:

Image

Importing Progress:

Image

Error import:

Image
const [ picked, setPicked ] = useState< PickedBackup | null >( null );
const [ pickError, setPickError ] = useState< string | null >( null );
const [ submitError, setSubmitError ] = useState( '' );
const [ selectedFile ] = useState< File | null >( takePendingBackup );

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

My agent recommends splitting this code between useState and useEffect, but I couldn't reproduce any issue with the existing code.

const [ selectedFile ] = useState< File | null >( peekPendingBackup );
useEffect( () => {
	clearPendingBackup();
}, [] );
@bcotrim
bcotrim enabled auto-merge (squash) July 22, 2026 20:01
@bcotrim
bcotrim merged commit 9f1fae2 into trunk Jul 22, 2026
13 checks passed
@bcotrim
bcotrim deleted the make-agentic-import-retryable branch July 22, 2026 20:28
@bcotrim bcotrim mentioned this pull request Jul 30, 2026
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants