chore: prefix rename to desktop_mode_* + Plugin Check fixes - #76
Merged
Conversation
Add a phpcs.xml.dist at the repo root that:
- whitelists the prefixes the codebase has used since day one
(wp_desktop / desktop_mode / wpdc), eliminating ~96 false-positive
NonPrefixed{Hookname,Variable,Function}Found warnings without
renaming any documented public APIs
- excludes /extensions/ from the parent-plugin scan since each
extension ships as its own WP plugin with its own text domain,
prefixes, and ruleset (cleared the remaining ~50 false positives
that come from scanning extension internals against the parent's
text domain)
- sets the text-domain to "desktop-mode" so I18n checks have a
canonical reference
Annotate the legitimate raw-DB calls on the routines runs table with
phpcs:ignore + justifications:
- run-history.php: $wpdb->insert / get_results / query on the custom
routine_runs table — table name interpolation is safe (built from
$wpdb->prefix + a constant), caching deliberately skipped because
the rows are a write-heavy log and a real-time tail
- executor.php: rate-limit count query — fresh count every call by
design
Annotate the slow_db_query_meta_{key,value} false positives in
seed.php where the literal strings appear as field names in an
args_schema declaration / a result envelope, not as DB-query
arguments.
After this commit the report drops from ~207 issues to a small
handful that all live inside extensions/ and disappear when each
extension is scanned independently.
…mode_* Plugin Check's WordPress.NamingConventions.PrefixAllGlobals rule hard-codes a blocklist of reserved prefixes (`wp_`, `wordpress_`, `_`) that no plugin's `prefixes` allowlist can override. The codebase had ~60 hooks/filters and 3 registration functions using `wp_desktop_*` and `wp_register_desktop_*`, all flagged by Plugin Check. This is a breaking change to the public API — third-party plugins that integrated against the documented `wp_desktop_*` filter / action names need to update. The plugin is pre-1.0; doing the rename now costs less than after launch, and it aligns with wp.org's prefix convention going forward. Renames applied uniformly across PHP / TS / docs / tests: wp_desktop_<X> → desktop_mode_<X> wp_register_desktop_<X> → desktop_mode_register_<X> Preserved (intentionally untouched, do not collide with the regex): WP_DESKTOP_PRESENCE_OPTION (constant — uppercase) __WP_DESKTOP_MENU_PAYLOAD__ (template marker — uppercase) _wp_desktop_presence (DB option key — leading underscore) wp.desktop.* (JS API — dot-separated, not underscore) 39 files touched: 18 PHP, 4 TS, 12 docs, 5 tests, 1 phpcs config, plus 2 regenerated bundles under assets/js/. All checks pass — lint, tsc --noEmit, vitest (760/760), php -l, npm run build. Also drops the now-redundant `wp_desktop` / `wp-desktop` entries from phpcs.xml.dist's prefix allowlist (no callsites remain).
Plugin Check flags `phpcs.xml.dist` as `application_detected` (severity 8 ERROR) when it appears in the plugin zip. It's dev tooling — same class as `composer.json`, `package.json`, `vite.config.js`, and friends that already live under the export-ignore list. I forgot to add this line when introducing phpcs.xml.dist; this commit closes the gap. Verified via `git archive --worktree-attributes HEAD` that the file is now excluded from `bin/package.sh`-built zips.
…nd-db-annotations # Conflicts: # assets/js/routines.js # assets/js/routines.min.js # docs/README.md # docs/examples/register-routine-trigger.md # docs/hooks-reference.md # docs/routines-roadmap.md # docs/routines.md # includes/routines/ai-generate.php # includes/routines/api.php # includes/routines/bootstrap.php # includes/routines/cpt.php # includes/routines/executor.php # includes/routines/run-history.php # includes/routines/schema.php # includes/routines/seed.php # includes/routines/steps.php # includes/routines/triggers.php # includes/routines/window.php # src/routines/inspector.ts # src/routines/picker.ts # tests/phpunit/tests/routines.php
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.
Summary
wp_desktop_*hooks/filters (~60) andwp_register_desktop_*registration functions (3) todesktop_mode_*anddesktop_mode_register_*. WordPress's reserved-prefix blocklist (wp_,wordpress_,_) cannot be overridden via PHPCS config; the rename was the only path to Plugin Check compliance.phpcs.xml.distdeclaring valid prefixes + excludingextensions/from the parent-plugin scan (each extension is a separate plugin with its own ruleset).$wpdbcalls inincludes/routines/with caching/escape justifications.Plugin Check impact
Report went from 207 findings → 0 real findings. The single remaining warning (
missing_composer_json_file) is a false positive that only appears when scanning the source tree; it disappears againstbin/package.sh-builtdesktop-mode.zip(which is what wp.org reviewers actually scan —composer.jsonisexport-ignored, rootvendor/is gitignored).Breaking change details
wp_desktop_<x>filter/actiondesktop_mode_<x>wp_register_desktop_<x>functiondesktop_mode_register_<x>Applied uniformly across PHP, TS, docs, and tests (39 files).
Preserved (intentionally untouched):
WP_DESKTOP_PRESENCE_OPTIONconstant (uppercase, off the regex)__WP_DESKTOP_MENU_PAYLOAD__template marker (uppercase)_wp_desktop_presenceDB option key (leading underscore — renaming would lose user data without a migration)wp.desktop.*JS API (dot-separated, separate namespace, unaffected by the regex)Third-party plugins that integrated against the documented
wp_desktop_*filter / action names will need to update. The plugin is pre-1.0; doing this now costs less than after launch and aligns with wp.org's prefix convention going forward.Test plan
npm run lintclean./node_modules/.bin/tsc --noEmitcleannpm run test:jsclean (760/760)npm run buildcleanphp -lclean across all PHP filesbin/package.sh-builtdesktop-mode.zipand confirm 0 findings🤖 Generated with Claude Code