Skip to content

Consolidate popup title projections into cached repository helper - #1340

Merged
danieliser merged 3 commits into
developfrom
agent/popup-title-projection-helper
Aug 13, 2026
Merged

Consolidate popup title projections into cached repository helper#1340
danieliser merged 3 commits into
developfrom
agent/popup-title-projection-helper

Conversation

@danieliser

@danieliser danieliser commented Aug 12, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds a standalone popup repository helper that projects only popup IDs and raw stored titles.
  • Updates popup select lists to request IDs first, then resolve titles through the cached helper.
  • Memoizes only ordered popup IDs so multilingual title filtering is reapplied on every select-list call.
  • Preserves legacy posts_results and the_posts title mutations through a compatibility fallback only when non-core query-result filters are active and filtering is not suppressed.
  • Preserves status/order aliases, empty-status defaults, raw punctuation, and multilingual customization through the dedicated popup_maker/popup_title_choices filter.
  • Avoids the_title formatting so stored popup titles are not mutated in the normal fast path.

Query behavior

  • Cold select-list fast path is bounded to two SQL queries.
  • Warm title-projection reads use the WordPress object cache and execute zero SQL queries.
  • WordPress's default comment-status the_posts callback does not disable the fast path.
  • Explicit suppress_filters=true keeps the raw projection path.
  • Cache keys rotate with the posts last_changed value, so title updates cannot return stale choices.

Validation

  • Current-develop full PHPUnit: 1,041 tests, 2,391 assertions, 16 skipped
  • Repository-focused PHPUnit: 6 tests, 14 assertions
  • Helper-focused PHPUnit: 10 tests, 16 assertions
  • PHPCS and changed-file PHPStan: pass
  • PHP syntax and git diff --check: pass
  • Pre-PR ablation confirmed the compatibility fallback is required: removing it fails both posts_results and the_posts mutation regressions
  • The normal two-query regression and suppressed-filter fast-path regression remain green

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 17986f37-ce8f-4c47-b7e0-051db3c1654a

📥 Commits

Reviewing files that changed from the base of the PR and between b7c18a3 and d132703.

📒 Files selected for processing (4)
  • classes/Helpers.php
  • classes/Services/Repository/Popups.php
  • tests/php/tests/PUM_Helpers_Test.php
  • tests/php/tests/Popups_Repository_Title_Choices_Test.php

Walkthrough

popup_selectlist() now validates query options, caches published popup IDs, and retrieves titles through the popups repository. The repository sanitizes IDs, caches title mappings, tracks post-cache changes, and applies a dedicated title-choice filter. Tests cover filtering, ordering, caching, and cache refresh behavior.

Changes

Popup title choice resolution

Layer / File(s) Summary
Cached popup title lookup
classes/Services/Repository/Popups.php, tests/php/tests/Popups_Repository_Title_Choices_Test.php
The repository validates and deduplicates popup IDs, retrieves popup titles from cached or queried post data, refreshes mappings after title changes, and applies popup_maker/popup_title_choices.
Popup select-list integration
classes/Helpers.php, tests/php/tests/PUM_Helpers_Test.php
popup_selectlist() validates arguments and statuses, applies query filters and ordering, retrieves cached published IDs, and resolves titles through the repository. Tests cover exclusions, defaults, ordering, query counts, and repeated filter application.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Mergeability Score: ⚪ Minimal · up to d1327

The PR centralizes popup title projection behind a cached helper while preserving existing filtering, ordering, aliases, defaults, and raw-title behavior. No actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant popup_selectlist
  participant PopupsRepository
  participant WordPressPosts
  Caller->>popup_selectlist: provide select-list arguments
  popup_selectlist->>WordPressPosts: query published popup IDs
  WordPressPosts-->>popup_selectlist: cached or queried popup IDs
  popup_selectlist->>PopupsRepository: request popup title choices
  PopupsRepository->>WordPressPosts: read or populate title mapping
  WordPressPosts-->>PopupsRepository: popup IDs and titles
  PopupsRepository-->>popup_selectlist: filtered title choices
  popup_selectlist-->>Caller: ordered popup choices
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: moving popup title resolution into a cached repository helper.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/popup-title-projection-helper

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 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8435e7c943

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread classes/Services/Repository/Popups.php Outdated
@danieliser
danieliser force-pushed the agent/popup-title-projection-helper branch from ee7b318 to 5ea8089 Compare August 13, 2026 02:08
@danieliser
danieliser force-pushed the agent/subscriber-created-index-perf branch from 3ad90bb to 4284bcd Compare August 13, 2026 02:08
@danieliser
danieliser changed the base branch from agent/subscriber-created-index-perf to develop August 13, 2026 02:09

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ea8089e9d

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread classes/Helpers.php Outdated
Comment thread classes/Helpers.php

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ea8089e9d

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread classes/Helpers.php Outdated
Comment thread classes/Helpers.php Outdated
@danieliser
danieliser force-pushed the agent/popup-title-projection-helper branch from d132703 to 698dd44 Compare August 13, 2026 02:37
@danieliser

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 698dd44a3a

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danieliser

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 4b6d812dd6

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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