Skip to content

[POC] Smart Cache Integration w/ UI #248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft

Conversation

josephfusco
Copy link
Member

@josephfusco josephfusco commented Jun 11, 2025

CleanShot 2025-06-12 at 11 56 32@2x
CleanShot 2025-06-12 at 11 53 24@2x
CleanShot 2025-06-12 at 11 53 45@2x
CleanShot 2025-06-12 at 11 55 25@2x
CleanShot 2025-06-12 at 11 55 58@2x

@josephfusco josephfusco changed the title Poc smart cache POC - Smart Cache Integration Jun 11, 2025
Copy link

ℹ️ Download the wp-graphql-headless-webhooks plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

ℹ️ Download the wp-graphql-headless-webhooks plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

ℹ️ Download the wp-graphql-headless-webhooks plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

ℹ️ Download the wp-graphql-headless-webhooks plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

ℹ️ Download the wp-graphql-headless-webhooks plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

ℹ️ Download the wp-graphql-headless-webhooks plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

ℹ️ Download the wp-graphql-headless-webhooks plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

ℹ️ Download the wp-graphql-headless-webhooks plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

ℹ️ Download the wp-graphql-headless-webhooks plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

Copy link

ℹ️ Download the wp-graphql-headless-webhooks plugin artifact from this workflow run (see the 'Artifacts' section at the bottom).

@josephfusco josephfusco requested a review from Copilot June 12, 2025 15:57
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a proof-of-concept integration for Smart Cache events into the WPGraphQL Webhooks plugin, consolidating cache purge events to avoid webhook spam. Key changes include removing an outdated cleanup script, adding Smart Cache event support (via a new SmartCacheEventHandler), and updating admin views and REST endpoints to support the new integration.

Reviewed Changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
scripts/cleanup-wp-env.sh Removed an obsolete cleanup script.
scripts/clean.sh Updated environment clean-up logic to remove wp-env state directories.
plugins/wp-graphql-headless-webhooks/src/Repository/WebhookRepository.php Modified allowed events and improved HTTP method validation.
plugins/wp-graphql-headless-webhooks/src/Events/SmartCacheEventHandler.php Added a handler that consolidates Smart Cache events before triggering webhooks.
plugins/wp-graphql-headless-webhooks/src/Events/WebhookEventManager.php Integrated the new Smart Cache event handler into the webhook event management.
Remaining plugin files (Admin views, assets, configuration) Updated to support new REST endpoints, admin UI integration, and overall Smart Cache integration.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (3)

plugins/wp-graphql-headless-webhooks/src/Events/SmartCacheEventHandler.php:47

  • Consider type-hinting the webhook_trigger_callback parameter as callable to improve type safety and clarity.
public function __construct( $webhook_trigger_callback ) {

plugins/wp-graphql-headless-webhooks/src/Events/WebhookEventManager.php:37

  • Ensure that the signature and expected parameters of the trigger_webhooks method match the requirements of SmartCacheEventHandler's callback usage.
$this->smart_cache_handler = new SmartCacheEventHandler( [ $this, 'trigger_webhooks' ] );

scripts/clean.sh:7

  • [nitpick] Confirm that removing the entire '~/.wp-env' directory (instead of its contents) is the intended behavior in environments with multiple configurations.
rm -rf ~/.wp-env

@josephfusco josephfusco changed the title POC - Smart Cache Integration [POC] Smart Cache Integration w/ UI Jun 12, 2025
Base automatically changed from feat-webhooks-isr-example to main June 13, 2025 11:24
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