Skip to content

feat: read-only extension points for debugging tools - #442

Merged
ogorzalka merged 5 commits into
release/v13.35.3from
feat/debugbar-extension-points
Oct 8, 2026
Merged

ogorzalka merged 5 commits into
release/v13.35.3from
feat/debugbar-extension-points

Conversation

@ogorzalka

@ogorzalka ogorzalka commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Five read-only extension points that pollora/debugbar (and any other debugging tool) needs to show what Pollora did during a request. None of them mentions a debugger.

Changes

  • Which template answered — FrontendController records a TemplateResolution (template file, conditional tag, Blade view, index fallback, outcome) in the AnsweringTemplate singleton. Requests answered by Route::wp() or a Laravel route leave it empty, which is how a reader tells them apart. Works without WP_DEBUG, unlike TemplateMarker.
  • WordPressBooting event — dispatched by Bootstrap right before wp-settings.php loads, after the database constants. The last moment to act before WordPress builds its globals (e.g. swap in a profiling wpdb, which WordPress keeps when it already exists). Listen from a provider's register().
  • Discovery scan sources — DiscoveryCacheManager::scans() lists, per location, whether the structures came from this process's copy (memory), the persistent cache (cache) or a real scan (disk), with time and count. The context's hit/miss counters only knew about the in-process copy, so a cold and a warm persistent cache both read as a miss.
  • BindingResolved event — dispatched by BindingResolver for each binding resolved: source, field, attribute, post, time spent, whether this request's cache answered, whether a value came back. Only dispatched when a listener exists.
  • AssetManager::containers() — every asset container by name (theme, plugins, modules), so a tool can list where a page's assets come from.

Tests

  • FrontendControllerTest: condition + view recorded; index-fallback 404 recorded as not found; empty by default.
  • WordPressBootingEventTest: event dispatched before the settings file (run as WP-CLI so no WordPress install is needed).
  • DiscoveryCacheManagerSlowScanTest: disk vs memory; disk vs warm persistent cache.
  • BindingResolverTest: resolutions announced, cache hits flagged, empty values flagged.
  • AssetManagerContainersTest: containers listed by name.

Rector, Pint and PHPStan clean; type coverage 99.2 %. Locally 11 QueryException failures in Hook/Async and ModuleActivation exist on the base branch too (12 there), unrelated to this change.

Part of the Debugbar integration spec (changes 1, 2, 4, 6 and 7; pollora/debugbar launches with v13.35.3).

BindingResolved is dispatched for each binding resolved (source,
field, attribute, post, time, whether the request cache answered),
only when something listens. AssetManager::containers() lists every
asset container by name.
@ogorzalka
ogorzalka merged commit 390cb1f into release/v13.35.3 Oct 8, 2026
10 checks passed
@ogorzalka
ogorzalka deleted the feat/debugbar-extension-points branch October 8, 2026 16:26
@ogorzalka ogorzalka mentioned this pull request Oct 9, 2026
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.

1 participant