Skip to content

feat: move the debugger and DB viewer into a presence-debugger plugin - #760

Merged
josephfusco merged 7 commits into
WordPress:mainfrom
aldorizona10-glitch:move-debugger-to-plugin
Oct 7, 2026
Merged

josephfusco merged 7 commits into
WordPress:mainfrom
aldorizona10-glitch:move-debugger-to-plugin

Conversation

@aldorizona10-glitch

@aldorizona10-glitch aldorizona10-glitch commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Closes #732. Builds on the split started in #558/#554 — this takes the debugger out of the bundle, as the issue describes.

Follows plugins/presence-scenes: a new plugins/presence-debugger plugin with its own load.php header, Requires Plugins: presence-api, README, .distignore, and a release-please entry. The tools stay WP_DEBUG-only.

What moved

The two files move unchanged (git mv, 100% rename):

  • includes/debugger-admin-bar.php → presence-debugger/debugger-admin-bar.php
  • includes/db-viewer.php → presence-debugger/db-viewer.php
  • tests/test-debugger-admin-bar.php → presence-debugger/tests/ (only its require path changed)

They keep the presence-api text domain they already had — those strings only show under WP_DEBUG and were deliberately kept out of the translation template, so the move adds no new domain for translators. There's no uninstall.php: neither tool writes an option, transient or cron event.

Loader

presence-api.php drops its WP_DEBUG block. The new load.php re-registers the exact same hooks, under the same guard, on plugins_loaded once wp_get_presence() exists:

if ( ! ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ) {
	return;
}
// … require the two files + the same add_action/add_filter calls.

Exclusion lists & release config

  • plugins/presence-api/.distignore, phpunit.xml.dist coverage, and codecov.yml drop the two old includes/*.php paths; codecov.yml now ignores plugins/presence-debugger/**. scripts/check-debug-exclusions.sh now checks that the two coverage lists agree (phpunit.xml.dist == codecov.yml) on the remaining always-excluded includes/*.php files; the .distignore comparison is gone, since no includes/*.php lines remain there.
  • release-please-config.json gets a presence-debugger package (initial-version 0.1.0) and the root package excludes its path; .release-please-manifest.json seeds 0.1.0. scripts/sync-versions.sh already handles "every other package" generically, so it finds the new load.php header on its own.
  • presence-scenes' debugger test is repointed to the new location; the test bootstrap loads the new plugin (before presence-scenes, matching plugin load order).

Playground demo

Both playground-preview and playground-main-build now build presence-debugger.zip next to presence-api.zip and publish it, and the four preview blueprints plus blueprint-scenes.json install it as a second plugin (the two multisite blueprints network-activate it after presence-api). The schema-validate step now requires exactly one presence-debugger.zip alongside presence-api.zip, and the publish transform rewrites its URL too, so the preview demo and the README's Presence Scenes demo show the debugger again. The wordpress.org blueprint.json (released presence-api + the debugger from the pinned tag) is untouched until the next release.

Verification

Locally I ran scripts/check-debug-exclusions.sh (passes) and validated the JSON. PHPUnit/PHPCS/PHPStan/php -l run here in CI.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus
Used for: Working through this review — drafting the call-site notes that explain the debugger's use of presence-api internals, and the tooling and Playground wiring (phpcs/phpstan/wp-env, the exclusions check, the preview/main-build workflows and the blueprints). I reviewed the diff, ran the checks locally, and take responsibility for the result.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props aldorza, joefusco.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

🛝 WordPress Playgrounds

Built from df9aed9

Post locks RTC Settings
Single site Launch post locks, single site Launch RTC, single site Launch settings, single site
Multisite Launch post locks, multisite Launch RTC, multisite Launch network settings, multisite

github-actions Bot added a commit that referenced this pull request Oct 6, 2026

@josephfusco josephfusco left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for picking this up. Keeping the hook names and load order means presence-scenes still works: in wp-env its assets load right after the debugger's, and Presence API keeps running with presence-debugger deactivated.

#732 also asks about the private functions. The debugger calls wp_presence_room_rows(), wp_presence_get_timeout(), wp_presence_has_table() and wp_presence_fragment_request(), and the DB viewer calls wp_presence_has_table(). Each needs a public equivalent, or a short note on why the call stays. The asset versions can keep WP_PRESENCE_VERSION.

.wp-env.json doesn't list ./plugins/presence-debugger, so npm run env:start no longer shows the debugger. phpcs.xml.dist and phpstan.neon.dist don't scan plugins/presence-debugger/ either. The moved files pass both, so add the path to each.

blueprint-scenes.json installs the preview-main zip, which won't carry the debugger after this merges, so the README's Presence Scenes demo would lose it along with the scene ticket. On your Playground question, please handle it here: zip plugins/presence-debugger in both playground workflows next to presence-api.zip, and install it as a second plugin in the preview blueprints and blueprint-scenes.json. The wordpress.org blueprint.json can wait for the next release.

In check-debug-exclusions.sh, .distignore has no includes/*.php lines left, so the distignore comparison can go instead of getting || true. The header needs updating too, since it says "two places" and then lists three. The comments added to the two workflows and make-pot.sh describe what used to happen. The workflow ones can go, and the make-pot.sh paragraph can go back to its first sentence.

Please add an AI disclosure to the description, or "None" if you didn't use any.

@josephfusco josephfusco added [Type] Enhancement A suggestion for improvement of an existing feature [Area] Infrastructure Issues for the repository infrastructure [Area] Admin UI Issues for the admin UI integrations labels Oct 6, 2026
The WP_DEBUG-only admin-bar debugger and the ?presence-db=1 table viewer
move out of Presence API into their own plugin, plugins/presence-debugger,
following plugins/presence-scenes. The files move unchanged: presence-api
drops its WP_DEBUG loader block and the new plugin's load.php registers the
same hooks under the same WP_DEBUG + `Requires Plugins: presence-api` guard,
so a normal site still loads nothing.

- release-please: new presence-debugger package (0.1.0) and root exclude-path
- coverage: the three exclusion lists (.distignore / phpunit.xml.dist /
  codecov.yml) and check-debug-exclusions.sh updated for the new location
- presence-scenes' debugger test repointed to the moved file
- Playground preview/main-build no longer inject the moved files

Closes WordPress#732
…strap

Matches the alphabetical order WordPress loads the plugins in, so the test
environment mirrors a real site.
@josephfusco
josephfusco force-pushed the move-debugger-to-plugin branch from 8227d3a to df9aed9 Compare October 6, 2026 15:22
github-actions Bot added a commit that referenced this pull request Oct 6, 2026
@aldorizona10-glitch

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review — addressed all of it.

Private functions. Kept the calls and documented each at the call site, since the public API doesn't cover what a debug tool needs:

  • wp_presence_has_table() (both files) — guards on the table existing. wp_presence_is_available() also requires recording to be on, which would hide stored rows when it's switched off.
  • wp_presence_room_rows() — the debugger shows the reserved bookkeeping rows that the public wp_get_presence() deliberately drops.
  • wp_presence_get_timeout() — reports the resolved TTL after the wp_presence_default_ttl filter; there's no public getter for it.
  • wp_presence_fragment_request() — reads the Heartbeat payload under the same key the surfaces in presence-ping.js register.

Happy to promote any of these to the public API instead if you'd rather not have the debugger lean on internals.

Tooling. .wp-env.json now lists ./plugins/presence-debugger (before presence-scenes, matching load order), and phpcs.xml.dist / phpstan.neon.dist scan plugins/presence-debugger/ with its tests excluded, as presence-scenes does. Asset versions keep WP_PRESENCE_VERSION.

check-debug-exclusions.sh. Dropped the .distignore comparison — no includes/*.php lines remain there — instead of papering it over with || true. The header now says two places and lists the two it actually checks (phpunit.xml.dist and codecov.yml).

Stale comments. Removed from both playground workflows, and the make-pot.sh paragraph is back to its first sentence.

Playground (done in this PR). Both workflows now build presence-debugger.zip next to presence-api.zip and publish it (preview-main and the per-PR branch); the four preview blueprints plus blueprint-scenes.json install it as a second plugin, and the two multisite blueprints network-activate it after presence-api. The schema-validate step now requires exactly one presence-debugger.zip alongside presence-api.zip, and the publish transform rewrites its URL too. The wordpress.org blueprint.json is untouched.

PR template. Added the AI disclosure section below.

@josephfusco josephfusco left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I pushed 1e0e259 to finish this off. Removing the debugger file from includes/ would have broken the WordPress.org demo in 0.16.0, so the demo now installs plugins/presence-debugger from the release tag, and sync-versions.sh moves that tag forward with each release. I also cut the comments about the move and shortened the private-function notes to one sentence each.

@josephfusco
josephfusco merged commit 7577905 into WordPress:main Oct 7, 2026
30 checks passed
@josephfusco josephfusco added this to the 0.16.0 milestone Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Area] Admin UI Issues for the admin UI integrations [Area] Infrastructure Issues for the repository infrastructure [Type] Enhancement A suggestion for improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move the debugger and DB viewer into their own plugin

2 participants