Performance: 20x fewer field-lookup queries, screen-gated heavy assets, 4MB lighter zip#466
Draft
cbravobernal wants to merge 9 commits into
Draft
Performance: 20x fewer field-lookup queries, screen-gated heavy assets, 4MB lighter zip#466cbravobernal wants to merge 9 commits into
cbravobernal wants to merge 9 commits into
Conversation
PHPUnit 2261 -> 2788 tests (+527, +2074 assertions) covering previously untested flows: public template API (get_field/update_field/have_rows row API), upgrade migrations, revision save/restore, local JSON/fields/meta, Meta storage backends, ACF_Data, validation, options pages, abilities (incl. schema-robustness repros), blocks PHP (registration/render/ bindings), AJAX handlers, Site Health, and misc functions. Jest 772 -> 946 tests (+174) for the hooks system, core utilities, serialization, the legacy compatibility layer, and unload warnings. E2E: +4 tests (options page UI lifecycle, field group duplication, user profile fields), a REST purge utility plugin for suite isolation, and fixes for two order/timing-dependent specs (abilities-fields, url preview race). Known-behavior findings are documented in-test with NOTE comments and left unfixed to keep this change purely additive. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… screens PHP runtime (measured in wp-env, cache-less host): - Prime sibling field definitions when a field key resolves: get_field() across a 50-field template drops from 101 SQL queries / ~17ms to 5 queries / ~2.8ms. Opt-out via acf/prime_field_group_fields filter; per-field load_field filters unchanged. - Decode each local JSON file once per request instead of 4x: 44ms -> 16ms at 200 files. - Per-request cache for acf_get_option_meta() LIKE queries, invalidated via core added/updated/deleted_option hooks. - acf_decode_taxonomy_term(): raw term_taxonomy SQL -> get_term(). - Early-bail block save parsing when no block types are registered. - Enqueue the escaped-html notice script only when the notice renders. - Memoize the WP version check in acf_is_using_datastore(). Assets: - Load scf-bindings only in block editor contexts; it previously pulled the full wp-editor dependency stack onto classic admin pages and public front-end acf_form() pages. - Gate command-palette scripts on wp-commands being enqueued (stops React + wp-components loading on every classic admin page on WP <=6.8). - Drop wp-polyfill dependency from all bundles (webpack injectPolyfill). - Fix pro CSS min suffix: production shipped unminified acf-pro-input.css. - Gate admin-only acf-pro-ui-options-page script with is_admin(). - Fix acf-dark stylesheet 404 (wrong path since the build move). - Exclude assets/src and source maps from the release zip (-4.2MB). Verified: 2788 PHPUnit / 946 Jest / 253 E2E tests green, PHPStan clean, zero tests modified. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PHP 7.4 raises E_NOTICE for undefined array keys (PHP 8 raises E_WARNING) and the notice is not converted to a Throwable, so the try/catch capture never fired. Capture via an explicit error handler covering both error types instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…est.step structure - scf-test-get-field-user.php reads ?scf_test_user_id (absint-validated), falling back to the queried author, removing the user_1 assumption; user-profile-fields.spec.ts derives the real admin ID via /users/me. - Purge endpoint renamed to /purge-internal-posts to match what it deletes; single shared purgeScfInternalPosts() helper in field-helpers.js replaces four duplicated copies. - Large lifecycle tests restructured with test.step() (duplication, options page, post-type integration flow) with small local helpers for repeated workflows; assertions unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Seeded, CI-reproducible fuzz/property tests (SCF_FUZZ_ITERATIONS to crank locally; failing seed + input embedded in assertion messages): - PHP (tests/php/includes/fuzz/): post-id decoding, value round-trips, validation, the JSON schema validator, local JSON file ingestion, block.json registration, and escaping/sanitization helpers — including a security property that acf_maybe_unserialize() never instantiates real objects (verified: object-injection payloads decode only to __PHP_Incomplete_Class placeholders). - JS (tests/js/fuzz/): acf.serialize, flexible-content normalization, and escaping utilities under a seeded PRNG. Adds 27 PHPUnit + 5 Jest tests (~3s). Crashes surfaced on hostile input are documented in-test with NOTE comments (generators constrained) and reported for follow-up issues; no source was modified. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…et-optimizations # Conflicts: # tests/php/includes/fuzz/test-fuzz-schema-validator.php
This was referenced Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the highest-impact, lowest-risk items from a measured performance audit. All changes are behavior-identical: the full battery (PHPUnit / Jest / E2E / PHPStan) passes without modifying a test.
PHP runtime
includes/acf-field-functions.php):get_field()over a 50-field template drops from ~101 SQL queries / ~17ms to ~5 / ~2.8ms on cache-less hosts. Opt-out viaacf/prime_field_group_fields.includes/local-json.php): ~44ms → ~16ms at 200 files.acf_get_option_meta()with invalidation via core option hooks. (Note: this PR keeps theesc_like()escaping that landed ontrunkin Use esc_like() when building option-meta LIKE patterns #462 — the cache wraps that hardened query, it does not revert it.)acf_decode_taxonomy_term(): raw SQL →get_term().acf_is_using_datastore().Assets / enqueue
scf-bindingsmoved toenqueue_block_editor_assets(was pulling the wp-editor stack onto classic admin + front-endacf_formpages).wp-commandsbeing enqueued.wp-polyfillfrom all handles (webpackinjectPolyfill).acf-pro-ui-options-pagewithis_admin().acf-darkstylesheet 404.assets/src+ source maps): −4.2 MB.Verification (on this branch, merged up to current
trunk)composer test:php: OK (2823 tests).npm run test:unit: 951.composer test:phpstan: clean.esc_likeregression test from Use esc_like() when building option-meta LIKE patterns #462 passes here (security fix preserved through the merge).Use of AI Tools
Authored by Claude Code (Claude Fable 5) under human direction.