Skip to content

Refactor lazy admin component registry - #1403

Open
danieliser wants to merge 1 commit into
developfrom
refactor/admin-component-registry
Open

danieliser wants to merge 1 commit into
developfrom
refactor/admin-component-registry

Conversation

@danieliser

Copy link
Copy Markdown
Member

Summary

  • replace branching request setup with explicit post-type and page component maps
  • key page routing by definition keys so filtered/translated slugs remain safe
  • derive upsell context from the same mappings to prevent drift
  • preserve lazy loading and characterize existing third-party page behavior

Evidence

  • focused PHPUnit after rebase: 26 tests, 134 assertions
  • PHPCS: 2 changed files clean
  • agent baseline before rebase: full PHPUnit 1,203 tests / 2,998 assertions, no failures; PHPStan clean
  • included-file bootstrap evidence was byte-identical before and after on unrelated and settings admin screens

No public/filterable registry API is added.

@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 50 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 9a92e1c6-510d-474c-9766-6ef67c9324f9

📥 Commits

Reviewing files that changed from the base of the PR and between 21e59a1 and f6f282c.

📒 Files selected for processing (2)
  • classes/Admin.php
  • tests/php/tests/PUM_Admin_Loader_Test.php

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-11T01:16:38.932940Z f6f282c New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Replace the chain of conditionals in PUM_Admin::init_request_components()
with two explicit maps: post types to their editor components, and page
definition keys to their screen components. Matching stays keyed on page
definition keys rather than slugs, since slugs are filterable and
translated per site.

Extract the upsell context test into request_has_upsell_context(), which
now derives the popup/popup_theme check from the post type map instead of
repeating the literal list, so the two cannot drift apart.

Behavior is unchanged. Registered pages without a screen component of
their own, including Help & Support and pages added by other plugins
through pum_admin_pages, continue to initialize upsells. Lazy loading is
preserved: included-class evidence on an unrelated admin screen and on
the settings screen is identical before and after.

Expand PUM_Admin_Loader_Test with a request matrix covering each post
type and page match, non-matching admin screens, overlapping post type
and page requests, pages that match upsells without a screen component,
and non-array page slugs. Screen components are asserted through their
registered hooks rather than class_exists, because the lazy save hooks
autoload PUM_Admin_Popups and PUM_Admin_Themes during bootstrap.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@danieliser
danieliser force-pushed the refactor/admin-component-registry branch from ffc91d5 to f6f282c Compare September 11, 2026 01:15
@danieliser

Copy link
Copy Markdown
Member Author

The first CI pass exposed a PHP 7.4-only edge that the agent’s PHP 8 local run missed: pum_typenow() can be non-string, and PHP 7.4 rejects that value as an array_key_exists() key. Updated the branch with the same defensive string guard as the legacy strict-match behavior, then reran the focused suite (26 tests / 134 assertions) and PHPCS clean. Checks are restarting on f6f282c.

This branch has not been deployed

No deployments
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