Performance: screen-gate assets, cache hot paths, asset bug fixes#471
Draft
cbravobernal wants to merge 2 commits into
Draft
Performance: screen-gate assets, cache hot paths, asset bug fixes#471cbravobernal wants to merge 2 commits into
cbravobernal wants to merge 2 commits into
Conversation
Lower-risk half of the performance audit (sibling-field priming is split into its own PR for focused review). Everything here is behavior-identical or a straight bug fix. PHP runtime: - Per-request cache for acf_get_option_meta(), invalidated via core option hooks (keeps the esc_like() hardening from #462; the cache wraps it). - Decode each local JSON file once per request instead of 4x. - acf_decode_taxonomy_term(): raw SQL -> get_term(). - Early bail in the blocks save path when no block types are registered. - Gate the escaped-html notice script to when the notice renders. - Memoize the WP version check in acf_is_using_datastore(). Assets / enqueue: - Move scf-bindings to enqueue_block_editor_assets (was pulling the wp-editor stack onto classic admin + front-end acf_form pages). - Gate command-palette scripts on wp-commands being enqueued. - Drop wp-polyfill from all handles (webpack injectPolyfill). - Fix pro CSS min suffix (production shipped unminified CSS). - Gate acf-pro-ui-options-page with is_admin(). - Fix acf-dark stylesheet 404. - Trim release zip (exclude assets/src + source maps): -4.2 MB. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Carry trunk's WP 6.7 guard into the block-editor bindings enqueue and also match Bindings_Editor's enable_block_bindings setting gate, so the client never registers the acf/field source when the server doesn't; add a regression test for the disabled setting. - Guard acf_decode_taxonomy_term() against get_term() returning a truthy WP_Error (ambiguous shared terms, unregistered taxonomies). - Enqueue the escaped-HTML notice assets at render time inside maybe_show_escaped_html_notice() — the script is footer-loaded, so this keeps the notice and its JS paired on the one request that shows it and drops the duplicate should-show evaluation. - Back the Local JSON decode cache with a registered store (resettable, visible to store tooling), skip missing files without warnings, and clearstatcache() after writes/deletes so same-request re-reads see fresh contents. - Register acf-dark through the central asset patterns instead of a hand-built path (the pattern drift is what caused the 404 this PR fixes). - Revert the no-op WP-version memoization in acf_is_using_datastore(). - Rename the new option-meta flush helper to the scf_ prefix and stamp new symbols @SInCE SCF 6.9.2. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
cbravobernal
force-pushed
the
perf/runtime-asset-safe
branch
from
July 2, 2026 16:35
b6aef22 to
57a545d
Compare
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.
Lower-risk half of the performance audit, split out from #466 so it can be reviewed and merged without waiting on multilingual testing. The sibling-field priming (the one change that touches the field-value load path and interacts with WPML/Polylang/ACFML) is in its companion PR. Everything here is behavior-identical or a straight bug fix.
PHP runtime
acf_get_option_meta(), invalidated via core option hooks. Keeps theesc_like()hardening from Use esc_like() when building option-meta LIKE patterns #462 — the cache wraps that query, it does not revert it.includes/local-json.php): ~44ms → ~16ms at 200 files. The cache lives in a registered store (resettable in tests/long processes), skips missing files, andsave_file()/delete_file()callclearstatcache()so same-request re-reads see fresh contents.acf_decode_taxonomy_term(): raw SQL →get_term(), hardened againstget_term()returning a truthyWP_Error(ambiguous shared terms / unregistered taxonomies).Assets / enqueue
scf-bindingsmoved toenqueue_block_editor_assets(was pulling the wp-editor stack onto classic admin + front-endacf_formpages). The new path keeps trunk's WP 6.7+ guard and now also honors theenable_block_bindingssetting (matchingBindings_Editor), so the client never registers theacf/fieldsource when the server doesn't — with a regression test.wp-commandsbeing enqueued.wp-polyfillfrom all handles (webpackinjectPolyfill). Compiled assets are gitignored and rebuilt at release (bin/prepare-release.php), so this takes effect on the next release build.acf-pro-ui-options-pagewithis_admin().acf-darkstylesheet 404 by registering it through the central asset path patterns (the hand-built path drifting from the build layout is what caused the 404).assets/src+ source maps): −4.2 MB.Verification
composer test:php: OK (2846 tests, 21612 assertions).npm run test:unit: 951.composer test:phpstan: clean.@since SCF 6.9.2; new functions use thescf_prefix.See #466 (superseded by this PR + the sibling-priming PR).
Use of AI Tools
Initial implementation by Claude Code (Claude Fable 5) under human direction; split, reviewed and revised by Claude Code (Claude Opus 4.8); multi-agent review findings (bindings gating, WP_Error hardening, notice render-time enqueue, store-backed JSON cache, conventions) addressed by Claude Code (Claude Fable 5). All changes human-reviewed.