Issue #3586355: Avoid loading the full published catalog on the CCC overview page.
Description
Stops the CCC overview page from loading every published context item just to decide Getting Started UI flags.
Changes
- Add
AiContextScopeIndexService::hasPublishedGlobalItem()—LIMIT 1join on the scope index + published item data table. - Update
AiContextOverviewControllerto:- detect published items with a
range(0, 1)entity query usingaccessCheck(TRUE) - detect global items via the new scope-index existence check
- stop calling
loadMultiple()on the full published catalog
- detect published items with a
- Preserve existing overview cache metadata
(
ai_context_item_list,ai_context.agents,user.permissions). - Extend kernel + functional tests for the global / non-global Getting Started states.
No user-facing copy or settings behavior changes. No breaking API changes.
Testing instructions
- Install and configure ai_context, switch to this branch, and clear cache.
- With no published context items, visit
/admin/config/ai/context/overviewand confirm “There are no published context items.” - Create a non-global published context item and confirm “You have context, but no agent settings.”
- Create/publish a global context item and confirm “You have context items and agent settings.” without configuring agents.
- Delete/unpublish the global item, configure an agent assignment, and confirm the same configured Getting Started message still appears.
- Optional: with a large published catalog, confirm overview still loads quickly and does not hydrate all items.
- Rebuild caches if needed (
drush cr). No config import required.
Automated:
ddev phpunit --filter testHasPublishedGlobalItem web/modules/contrib/ai_context/tests/src/Kernel/AiContextScopeIndexTest.php
ddev phpunit --filter testOverviewPageContentStates web/modules/contrib/ai_context/tests/src/Functional/AiContextAdminSettingsTest.phpChecklist
- I have updated the MR title to use format:
Issue #1234: My issue title. - I have updated the MR description to include:
Closes #1234 - I have performed a self-review of my own code
- I have added or updated tests, or explained in the description why this change is not covered by tests
- I have written testing instructions and verified them locally
- I have noted any required post-merge steps (config imports, cache rebuilds, manual changes)
- This MR contains no breaking API or hook changes, or they are explicitly documented in the description
Not applicatable:
- I have updated documentation for any new or changed functionality
AI Compliance
Note
Check the one that best describes your usage, or leave all unchecked if AI was not significantly used.
-
AI Assisted Code
Mainly written by a human; AI used for autocomplete or partial generation under full human supervision. -
AI Generated Code
Mainly generated by AI, reviewed and approved by a human before this MR was created. -
Vibe Coded
Generated by AI and only functionally reviewed before this MR was created.
Closes #3586355 (closed)
Edited by Kristen Pol