Skip to content

Update reprint.phar to v0.8.0 - #3248

Closed
adamziel wants to merge 11 commits into
trunkfrom
adamziel/update-reprint
Closed

Update reprint.phar to v0.8.0#3248
adamziel wants to merge 11 commits into
trunkfrom
adamziel/update-reprint

Conversation

@adamziel

@adamziel adamziel commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

AI assistance was used to run benchmark iterations, inspect dependency diffs, and draft this PR text. The pushed changes and benchmark results were manually reviewed.

Proposed Changes

  • Update the bundled apps/cli/lib/pull/reprint.phar from v0.1.46 to v0.8.0.
  • Use the v0.8.0 reprint release, whose php-toolkit dependencies were updated to matching wp-php-toolkit/* v0.8.0 packages before tagging.
  • Update Studio's exact PHP-WASM and Playground package pins from 3.1.33 to 3.1.34:
    • @php-wasm/node, @php-wasm/universal, @php-wasm/util
    • @wp-playground/blueprints, @wp-playground/cli, @wp-playground/common, @wp-playground/storage, @wp-playground/wordpress
  • Keep the package lock in sync for the CLI, Studio app, UI, common, and benchmark-site-editor workspaces.
  • Load the small imported-runtime PHP helper and the reprint child process through the shared @php-wasm/universal runtime registry. This avoids splitting runtime IDs between @php-wasm/node and @php-wasm/universal after the 3.1.34 package update.

Benchmark

Manual large Docker fixture:

  • WordPress 6.8.2-php8.3-apache + MariaDB 11.
  • Reprint exporter plugin v0.8.0.
  • 52,003 total posts and 154,002 postmeta rows, including generated posts, attachments, and default WordPress content.
  • 2,000 attachment database records.
  • Generated SQL: 262 MB. Resulting SQLite database: 223 MB.
  • Command: STUDIO_ENABLE_PULL_REPRINT=1 studio pull-reprint --url http://127.0.0.1:8199 --secret benchmark-secret --name <fresh-name> --verbose.
  • Fresh isolated HOME, DEV_CONFIG_DIR, and STUDIO_PROCESS_MANAGER_HOME for each run.
  • PHP-WASM/Playground packages pinned to exact 3.1.34.
  • SQLite database integration release v3.0.0-rc.3.

For the v0.8.0 run, the Docker WordPress container needed pdo_mysql installed for the exporter preflight. I also used short /tmp isolation paths to avoid Unix socket path length failures in the process manager.

Measure Current v0.1.46 Prior latest v0.7.4 New v0.8.0 Delta vs v0.7.4
Full studio pull-reprint wall time 2147.24 s 1779.59 s 336.20 s -1463.39 s (-82.2%)
Essential files 9 s 12 s 11 s -1 s
db-pull 9m21s 8m35s 1m56s -399 s (-77.5%)
db-apply 26m11s 20m43s 3m22s -1041 s (-83.7%)
Remaining files 1 s 4 s <1 s ~-3 s

Testing Instructions

  • npx eslint --fix apps/cli/package.json apps/ui/package.json tools/benchmark-site-editor/package.json
    • completed with package-file ignore warnings and no errors
  • npm run typecheck
  • npm test -- apps/cli/commands/tests/pull-reprint.test.ts
  • npm test -- apps/cli/lib/pull/runtime-start-options.test.ts apps/cli/commands/tests/pull-reprint.test.ts
  • npm run cli:build
  • php apps/cli/lib/pull/reprint.phar --version
    • v0.8.0
  • php apps/cli/dist/cli/reprint.phar --version
    • v0.8.0
  • node apps/cli/dist/cli/main.mjs --version
    • 1.9.0
  • Manual benchmark described above.

I also ran full npm test locally after a clean npm ci under Node 24.14.1; it still fails in this workspace on pre-existing environment-sensitive tests:

  • tools/common/lib/tests/chalk.test.ts because color output is disabled despite the test expecting ANSI escape sequences.
  • Electron import tests because the local Electron package reports that Electron was not installed correctly.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@adamziel
adamziel marked this pull request as ready for review April 26, 2026 21:13
/**
* Downloads the latest reprint.phar release from GitHub and saves it to
* apps/cli/lib/import/reprint.phar. Run manually or via `npm run update-reprint`.
* apps/cli/lib/pull/reprint.phar. Run manually or via `npm run update-reprint`.

@adamziel adamziel Apr 26, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We're not changing the path in this PR. This comment and OUTPUT_PATH below were off before.

adamziel added a commit to WordPress/reprint that referenced this pull request Apr 26, 2026
The perf-report bench provisions the `large-directory` e2e site, which
is a fresh `wp core install` with ~1 post. That means `db-pull` and
`db-apply` finished in milliseconds, and SQL-rewriter optimizations (the
kind in #158, #161, #163) didn't show up in the PR comment at all — the
diff was dominated by noise on `preflight`.

This pads the source DB with ~320k posts and ~720k postmeta rows before
timing, matching the dataset shape used in the Automattic/studio#3248
measurement that actually surfaced the SQL-rewriter speedups (db-apply
went from 431s to 134s on that dataset). With this in place, the next
perf comment on a SQL-rewriter PR should show the real delta instead of
single-digit milliseconds of jitter.

Seeding runs once per CI container, is idempotent (skipped if `wp_posts`
already has enough rows), and is tunable via `BENCH_SEED_POSTS` /
`BENCH_SEED_POSTMETA` if you want a smaller dataset for local iteration.
Per-stage timeout bumped to 900s and the workflow job timeout to 60 min
so the heavier stages fit on slow runners.
@wpmobilebot

wpmobilebot commented Apr 26, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing c1f31da vs trunk

app-size

Metric trunk c1f31da Diff Change
App Size (Mac) 1376.63 MB 1354.67 MB 21.96 MB 🟢 -1.6%

site-editor

Metric trunk c1f31da Diff Change
load 1581 ms 1538 ms 43 ms ⚪ 0.0%

site-startup

Metric trunk c1f31da Diff Change
siteCreation 8591 ms 8593 ms +2 ms ⚪ 0.0%
siteStartup 4920 ms 4921 ms +1 ms ⚪ 0.0%

Results are median values from multiple test runs.

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

@adamziel adamziel changed the title Update reprint.phar to v0.1.46 May 18, 2026
@adamziel adamziel changed the title Update reprint.phar to v0.7.4 May 20, 2026
@adamziel

Copy link
Copy Markdown
Contributor Author

Related issues

How AI was used in this PR

AI assistance was used to run benchmark iterations, inspect dependency diffs, and draft this PR text. The pushed changes and benchmark results were manually reviewed.

Proposed Changes

  • Update the bundled apps/cli/lib/pull/reprint.phar from v0.1.46 to v0.8.0.
  • Use the v0.8.0 reprint release, whose php-toolkit dependencies were updated to matching wp-php-toolkit/* v0.8.0 packages before tagging.
  • Update Studio's exact PHP-WASM and Playground package pins from 3.1.33 to 3.1.34:
    • @php-wasm/node, @php-wasm/universal, @php-wasm/util
    • @wp-playground/blueprints, @wp-playground/cli, @wp-playground/common, @wp-playground/storage, @wp-playground/wordpress
  • Keep the package lock in sync for the CLI, Studio app, UI, common, and benchmark-site-editor workspaces.
  • Load the small imported-runtime PHP helper through the shared @php-wasm/universal runtime registry. This avoids splitting runtime IDs between @php-wasm/node and @php-wasm/universal after the 3.1.34 package update.

Benchmark

Manual large Docker fixture:

  • WordPress 6.8.2-php8.3-apache + MariaDB 11.
  • Reprint exporter plugin v0.8.0.
  • 52,003 total posts and 154,002 postmeta rows, including generated posts, attachments, and default WordPress content.
  • 2,000 attachment database records.
  • Generated SQL: 262 MB. Resulting SQLite database: 223 MB.
  • Command: STUDIO_ENABLE_PULL_REPRINT=1 studio pull-reprint --url http://127.0.0.1:8199 --secret benchmark-secret --name <fresh-name> --verbose.
  • Fresh isolated HOME, DEV_CONFIG_DIR, and STUDIO_PROCESS_MANAGER_HOME for each run.
  • PHP-WASM/Playground packages pinned to exact 3.1.34.
  • SQLite database integration release v3.0.0-rc.3.

For the v0.8.0 run, the Docker WordPress container needed pdo_mysql installed for the exporter preflight. I also used short /tmp isolation paths to avoid Unix socket path length failures in the process manager.

Measure Current v0.1.46 Prior latest v0.7.4 New v0.8.0 Delta vs v0.7.4
Full studio pull-reprint wall time 2147.24 s 1779.59 s 336.20 s -1463.39 s (-82.2%)
Essential files 9 s 12 s 11 s -1 s
db-pull 9m21s 8m35s 1m56s -399 s (-77.5%)
db-apply 26m11s 20m43s 3m22s -1041 s (-83.7%)
Remaining files 1 s 4 s <1 s ~-3 s

Testing Instructions

  • npx eslint --fix apps/cli/package.json apps/ui/package.json tools/benchmark-site-editor/package.json
    • completed with package-file ignore warnings and no errors
  • npm run typecheck
  • npm test -- apps/cli/commands/tests/pull-reprint.test.ts
  • npm test -- apps/cli/lib/pull/runtime-start-options.test.ts apps/cli/commands/tests/pull-reprint.test.ts
  • npm run cli:build
  • php apps/cli/lib/pull/reprint.phar --version
    • v0.8.0
  • php apps/cli/dist/cli/reprint.phar --version
    • v0.8.0
  • node apps/cli/dist/cli/main.mjs --version
    • 1.9.0
  • Manual benchmark described above.

I also ran full npm test locally after a clean npm ci under Node 24.14.1; it still fails in this workspace on pre-existing environment-sensitive tests:

  • tools/common/lib/tests/chalk.test.ts because color output is disabled despite the test expecting ANSI escape sequences.
  • Electron import tests because the local Electron package reports that Electron was not installed correctly.

Pre-merge Checklist

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

Copy link
Copy Markdown
Contributor Author

Added AGENTS.md guidance in c1f31da0 documenting the rigor boundary for reprint URL rewriting work:

  • known structured formats must be parsed by their owning parser first;
  • only leaf text or intentionally unknown text should go to URLInTextProcessor;
  • no byte-level URL replacement, delimiter trimming, punctuation stripping, or format-specific guessing;
  • performance work should use native scanners, structured parser APIs, bounded caches, and measured hot-path reductions.

This reflects the rule being applied in the stacked reprint PR: WordPress/reprint#220

@wojtekn

wojtekn commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

@adamziel should we close it in favor of #3690 ?

@fredrikekelund

Copy link
Copy Markdown
Contributor

As @wojtekn already mentioned, the Reprint dependency is now installed by fetching the latest release from GitHub. I'm closing this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants