Skip to content

Add manifest-driven prep script for hosted data-heavy e2e fixtures#4152

Merged
gcsecsey merged 12 commits into
trunkfrom
gcsecsey/stu-1866-add-fixture-prep-script
Jul 14, 2026
Merged

Add manifest-driven prep script for hosted data-heavy e2e fixtures#4152
gcsecsey merged 12 commits into
trunkfrom
gcsecsey/stu-1866-add-fixture-prep-script

Conversation

@gcsecsey

@gcsecsey gcsecsey commented Jul 9, 2026

Copy link
Copy Markdown
Member

Related issues

How AI was used in this PR

Claude Code planned and implemented the change under my direction, and verified the script’s behaviors (download, idempotence, corruption self-heal, offline modes) against a local HTTP server and then against the live fixtures site. I reviewed the result.

Proposed Changes

The minimal backup fixtures live in the repo (#4057 / #4151) and deliberately stay there. They’re small, and keeping them in git means per-PR CI doesn't need network access. This PR is for the other tier: realistic, data-heavy backups that are too large to commit. These are currently fetched manually from a shared Drive folder.

Data-heavy artifacts now live in the media library of studioe2efixtures.wordpress.com, a dedicated site, and are fetched on demand:

  • test-fixtures/manifest.json pins each hosted artifact to a URL, byte size, and SHA-256 hashes. Adding a new fixture is a manifest-only PR.
  • npm run e2e:fixtures downloads whatever the manifest declares into gitignored test-fixtures/downloads/, verifying every hash. Runs are idempotent, corrupted files self-heal, and while a failed download only warns locally (affected tests skip), CI runs with --require and fails loudly.
  • WP.com media uploads accept .zip but reject .tar.gz/.wpress/.sql, so hosted artifacts are zip wrapped. The manifest records both the wrapper and inner hashes and the script verifies both.
  • Playwright runs the prep automatically via globalSetup. Buildkite runs it explicitly and caches downloads/ keyed on the manifest hash.
  • I added a small (327 B) smoke-test artifact hosted on the site, so this mechanism is exercised on this PR's CI run.

See it working

From this PR’s own CI (E2E Tests on mac-arm64, build 19149):

--- :inbox_tray: Prepare e2e fixtures
No cache entry found for 'studio-e2e-fixtures-b6165840e86d…'
> tsx ./scripts/prepare-e2e-fixtures.ts --require
pipeline-test.sql: downloading https://studioe2efixtures.wordpress.com/wp-content/uploads/2026/07/studio-fixture-pipeline-test-2026-07.zip
pipeline-test.sql: ready.
No existing cache entry for studio-e2e-fixtures-b6165840e86d… – storing in cache

--- :playwright: Run End To End Tests
pipeline-test.sql: already downloaded and verified — skipping.

Testing Instructions

  1. Run npm run e2e:fixtures
  2. Check that it downloads the smoke-test artifact from the live fixtures site, verifies both hashes, and unwraps it into test-fixtures/downloads/pipeline-test.sql.
  3. Run it again
  4. Check that it prints "already downloaded and verified — skipping"
  5. Corrupt the downloaded file (echo x >> test-fixtures/downloads/pipeline-test.sql) and run again to see it re-download.
  6. With a wrong hash in the manifest, the run reports the mismatch (and -- --require exits 1).

Pre-merge Checklist

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

@gcsecsey gcsecsey requested review from a team and gavande1 July 10, 2026 12:34
@gcsecsey gcsecsey marked this pull request as ready for review July 10, 2026 12:34
@gcsecsey gcsecsey requested a review from a team as a code owner July 10, 2026 12:34
Base automatically changed from gcsecsey/stu-1866-move-backup-fixtures to trunk July 10, 2026 12:35
Comment thread scripts/lib/prepare-e2e-fixtures.ts Outdated
Comment thread apps/studio/e2e/global-setup.ts Outdated
Comment thread apps/studio/e2e/import-formats.test.ts Outdated
Comment thread scripts/lib/prepare-e2e-fixtures.ts Outdated

@gavande1 gavande1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @gcsecsey for addressing the comments. Some tests are failing, but approving to unblock you.

@gcsecsey

Copy link
Copy Markdown
Member Author

Thanks @gcsecsey for addressing the comments. Some tests are failing, but approving to unblock you.

Thanks @gavande1, I've looked into the failing Performance metrics job, and it seems to have inherited the fixture download step from this PR. I'll push a fix for this.

@gcsecsey gcsecsey enabled auto-merge (squash) July 14, 2026 10:40
@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 4e0ea7f vs trunk

app-size

Metric trunk 4e0ea7f Diff Change
App Size (Mac) 1350.36 MB 1350.34 MB 0.02 MB ⚪ 0.0%

site-editor

Metric trunk 4e0ea7f Diff Change
load 1082 ms 1047 ms 35 ms ⚪ 0.0%

site-startup

Metric trunk 4e0ea7f Diff Change
siteCreation 7022 ms 6993 ms 29 ms ⚪ 0.0%
siteStartup 2360 ms 2365 ms +5 ms ⚪ 0.0%

Results are median values from multiple test runs.

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

@gcsecsey gcsecsey merged commit f6124f8 into trunk Jul 14, 2026
11 checks passed
@gcsecsey gcsecsey deleted the gcsecsey/stu-1866-add-fixture-prep-script branch July 14, 2026 11:03
gcsecsey added a commit that referenced this pull request Jul 14, 2026
## Related issues

- Related to
[STU-1866](https://linear.app/a8c/issue/STU-1866/shared-artifact-storage-for-import-data-heavy-fixtures)
(completes its last acceptance criterion: import tests updated) and
[STU-1870](https://linear.app/a8c/issue/STU-1870/migrate-import-export-tests)
- Stacked on #4152

## How AI was used in this PR

Claude Code seeded the source site's content, pre-flighted the artifact
through real CLI imports (which surfaced a platform drop-in bug — Linear
issue incoming), and implemented the rewire under my direction; I
reviewed the result.

## Proposed Changes

`import.test.ts`, the release-time test that imports a WordPress.com
Jetpack backup, was skipped in CI since it was written: its archive had
to be fetched by hand from a shared Drive folder, and the files there
went stale. The minimal fixture in `import-formats.test.ts` covers the
format's shape, this test's distinct job is catching drift in what
customer backups actually contain, so it needs a real, current artifact.

- The test consumes
`test-fixtures/downloads/coolbeans-jetpack-backup-2026-07.tar.gz`,
fetched by the #4152 pipeline from the fixtures site. Locally it still
skips with an actionable message when the file is absent; in CI the prep
step hard-fails first, so the silent-skip era ends.
- The backup is a genuine Jetpack Cloud export (149 MB, 51 per-table SQL
files incl. WooCommerce tables, full uploads tree, wpcomsh mu-plugins,
`__wp__` core dir) of **Cool Beans** (gcsecseywoa11.wpcomstaging.com), a
purpose-built public test site whose content is self-describing: a hero
post stating the site's purpose, encoding-test posts (ASCII and
UTF-8/emoji), a long-form truncation canary,
media/taxonomy/comment-thread tests, and nested pages.
- Assertions verify the imported site really serves the backup: blog
name + tagline in the page title, the custom theme's landing page
rendering, and the hero post resolving at its pretty permalink (which
also proves the permalink structure imported).
- The stale `apps/studio/e2e/imports/` directory, its P2-pointing
readme, and its `.gitignore` entries are removed.

## Verified end to end

- `npm run e2e:fixtures` downloads the wrapper from the live fixtures
site, verifies both SHA-256 hashes, unwraps; a second run verified-skips
both fixtures.
- Pre-flight of this exact artifact through the real CLI: import exits
0, `wp option get blogname` → `Cool Beans`, started site serves HTTP 200
with the full title, theme landing renders, hero permalink returns 200
with the checklist text — i.e., every assertion in this PR's test,
validated against the shipped artifact.

## Testing Instructions

1. `npm run e2e:fixtures` — downloads + verifies both hosted fixtures
(~150 MB).
2. This PR's e2e CI runs `import.test.ts` for real for the first time —
the E2E jobs are the authoritative proof (note: they now download the
artifact: mac/windows cache it keyed on the manifest, Linux fetches per
run).

## Pre-merge Checklist

- [ ] Have you checked for TypeScript, React or other console errors?
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.

3 participants