Automattic / Automattic/studio

CLI export exits successfully with invalid archive for large SQLite site

Open
#4,189 0 comments 0 reactions 0 assignees View on GitHub
[Status] Auto-allocated Bug YOLO
Dominant language
TypeScript
Stars
517
Forks
95
Avg merge
1d 22h
Merged PRs (30d)
162

Description

## Problem

While validating draft PR #3997 against a real, large Studio site before SQLite-to-MySQL conversion, the supported full-site export command exited successfully with no diagnostic but produced an invalid archive.

## Reproduction

Integration build: current `origin/trunk` plus PR #3997, commit `3e547db03` in a managed test worktree.

```sh
node apps/cli/dist/cli/main.mjs export
/Users/.../intelligence-chubes4-full.zip
--path /Users/.../intelligence-chubes4
--mode full
```

Source SQLite database size: `19,880,640,512` bytes.
Produced archive size: `8,440` bytes.

Validation:

```text
End-of-central-directory signature not found
unzip: cannot find zipfile directory
```

The command returned success and printed no warning/error. The source site remained unchanged.

## Expected

A successful export produces a readable full-site archive. Any interrupted, unsupported, capacity-limited, or failed export exits non-zero, removes/marks the partial artifact, and reports the failing phase with actionable diagnostics.

## Why this matters for #3997

`studio convert --to mysql` is intentionally being validated first against a clone with a verified rollback artifact. Silent export corruption makes the documented safe migration path appear ready when no usable rollback exists.

## Acceptance criteria

- Large SQLite full exports produce a valid archive or fail non-zero.
- Partial archives are never reported as successful.
- Export performs a final archive-integrity check before success.
- Regression coverage includes an interrupted/failed archive stream and bounded large-file behavior.

## AI assistance
- **AI assistance:** Yes
- **Tool(s):** OpenAI GPT-5.6 Sol via OpenCode
- **Used for:** Integrating #3997 with current trunk, running the migration preflight, and capturing deterministic export evidence.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the export command shown against a large SQLite site and trace the CLI entry point at apps/cli/dist/cli/main.mjs, including the archive-writing phase. Add regression coverage for interrupted or failed archive streams and bounded large-file behavior; done means valid archives succeed, failures exit non-zero with diagnostics, partial artifacts are not reported as successful, and final integrity is checked.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, sqlite, typescript
Domain
cli, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.