Repository navigation
Added the sync site export behind the selfServeArchives flag - #30054
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: QUIET Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run @tryghost/admin:test:acceptance |
✅ Succeeded | 7m 21s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-08-20 11:32:41 UTC
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 31b9f21aa7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## generalize-export-filename #30054 +/- ##
==============================================================
+ Coverage 75.31% 75.56% +0.25%
==============================================================
Files 1625 1630 +5
Lines 145064 145473 +409
Branches 17985 18142 +157
==============================================================
+ Hits 109248 109928 +680
+ Misses 34814 34517 -297
- Partials 1002 1028 +26
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
no ref The settings shell and the shared `components/`, `hooks/`, `utils/`, `data/`, `assets/` and `providers/` now live directly under `settings/`, leaving only `advanced/` in `settings/app/` until the PRs touching it land (#30018, #30019, #29916, #30054, #30099, #30110, #28368). Big diff, but ~300 of the 325 files are import-line rewrites; the substantive changes are the lint-debt fixes the move surfaces: - shell files grouped in `settings/layout/`: `app.tsx` (provider tree), `main-content.tsx`, `sidebar.tsx`, `settings-sections.tsx` (was `components/settings.tsx`); root `settings.tsx` route entry unchanged - contexts split the way admin's other contexts are — hooks + context in `*-context.ts`, provider component in its own file — for global data, settings app, confirmations, scroll sections; `withErrorBoundary` → `with-error-boundary.tsx` - `loadKoenig` → `components/koenig-loader.ts`; the untyped `@tryghost/koenig-lexical` bundle gets a minimal `KoenigLexicalModule` type instead of `any` - `@tryghost/limit-service` and `@tryghost/nql` get typed ambient declarations in `vite-env.d.ts` (clears ~25 `no-unsafe-*` in `use-limiter`) - `iframe-buffering` reuses `utils/debounce`; `TopLevelGroup.saveState` uses the framework's `SaveState`; the usual `void`-wrapping of async handlers
0619b5b to
285c158
Compare
ref https://linear.app/ghost/issue/GVA-921/1-click-export-uxui With the selfServeArchives flag on, "Export data" now really downloads a full site archive: GET /ghost/api/admin/exports/download/ streams one zip composed in-process from the same services the five standalone export endpoints call — content JSON, members CSV, post analytics CSV, per-theme zips, routes and redirects. Everything except media, which stays reserved for the host (async) mode. Every artifact restores through an existing import surface, proven by a round-trip e2e test against the real import endpoints. The zip streams while it is built, so memory stays flat and the download starts immediately; a component that fails to acquire is skipped and logged, since headers are already on the wire. Streaming entries tie their lifecycle to the archive in both directions so a dropped DB connection cannot hang the response and a client disconnect cannot pin a DB connection or leak staged temp files. The dialog downloads through the fetch-based blob helper so it can show a real downloaded state, surface errors, and cancel.
The catalog convention is exact pins, and pinning to 8.0.0 keeps a single archiver copy in the tree, deduped with the same version @tryghost/zip already depends on. A caret range could drift to a newer 8.x on a future install, splitting the tree into two copies and drifting from the hand-written type declarations in ghost/core.
The done state fires once the zip blob has been handed to the browser's download manager, but users with 'Ask where to save each file' enabled still see the save dialog after that point — so 'Export downloaded' could appear before (or without) the file landing anywhere. 'Export complete' stays truthful in both cases: the export and transfer really are finished, only the save location may still be pending.
ghost/core is the only workspace consumer, so declaring the exact version directly keeps the catalog for genuinely shared dependencies. The resolved version is unchanged and stays deduped with the copy @tryghost/zip depends on.
285c158 to
4c50013
Compare

closes https://linear.app/ghost/issue/GVA-917
Implements the sync delivery mode of the one-click data export, building on the mockup that landed in #29915 and the four behaviour-preserving refactors below this PR in the stack. With the
selfServeArchiveslabs flag on, "Export data" now really downloads a full site archive:GET /ghost/api/admin/exports/download/streams one zip composed of content JSON, members CSV, post analytics CSV, per-theme zips, and routes/redirects — everything except media, which stays reserved for the host (async) mode that isn't part of this PR (its dialog branch remains mocked).How the zip is composed
The orchestrator calls the same services the five standalone export endpoints call — no HTTP self-calls, no background jobs, no duplicated controller logic:
flowchart LR UI["Export data dialog"] -- "GET /exports/download/?components=…" --> C["exports controller"] C --> SE["SiteExporter (services/exports)"] SE -- "membersService.export({limit:'all'})" --> M["members.csv"] SE -- "postsService.export({limit:'all'})" --> A["post-analytics.csv"] SE -- "doExport()" --> J["export.json"] SE -- "themeStorage.zipToFile()" --> T["themes/{name}.zip"] SE -- "routeSettings / customRedirects" --> R["routes.yaml + redirects.yaml"] M & A & J & T & R --> Z["archiver zip → streamed response"]Decisions worth reviewing:
export.jsonis byte-identical to the/db/download and themes are the exact zips the theme upload accepts, so every piece of the bundle restores through existing import surfaces — proven by a round-trip e2e test that re-imports each artifact through the real import endpoints.db.exportContent(Owner/Administrator only) instead of minting a new permission + migration: a site export contains everything a database export contains, so the same gate applies — and it's a superset of every composed component's own requirement.selfServeArchiveslabs flag, and that flag is the whole gate — no config capability signal for deploy skew at this stage. If the flag graduates, feature detection can come back with the GA work.archiverbecomes a direct dependency of ghost/core, but adds no new code to the tree:@tryghost/zipalready pins the same[email protected]internally, and its own file-basedcompress/extractAPI can't stream a zip into an HTTP response.Testing it locally
pnpm dev, then in Ghost Admin enable Settings → Labs → Private features → Self-serve archives (developer experiments must be on).export.jsonimports via the universal importer,members.csvvia the members importer,themes/*.zipvia theme upload,routes.yaml/redirects.yamlvia their uploads.main.Automated tests
SiteExporterunit tests cover the failure paths: component skipping, partial themes, mid-stream teardown, client-abort cleanup.drain, deadlocking any streamed body larger than the write buffer.