Skip to content

Conversation

@rinatkhaziev
Copy link
Contributor

@rinatkhaziev rinatkhaziev commented Dec 1, 2025

Description

CleanShot 2025-12-17 at 12 42 22@2x

This pull request introduces several improvements and new features to the VIP Cache Manager, focusing on expanding cache purge capabilities, enhancing the CLI and dashboard interfaces, and improving test coverage and maintainability. The key changes include adding new purge functions for different cache scopes, updating the CLI to support these scopes, modernizing the API with deprecation notices for old functions, and strengthening the test suite.

API and Functionality Enhancements:

  • Added new functions to vip-cache-manager/api.php for purging specific cache scopes (site, origin, uploads, static files, private files), and marked the old wpcom_vip_* functions as deprecated in favor of the new wpvip_* versions. [1] [2] [3]

CLI Improvements:

  • Updated the WP-CLI command in wp-cli/vip-cache.php to support a --scope option, allowing users to target specific cache scopes (site, origin, uploads, static, private) for purging. Added input validation and improved confirmation messaging.
  • Refactored CLI purge logic to use the new scope actions and updated URL purge to use the new function signature.

Dashboard UI:

  • Added a new JavaScript file (vip-cache-manager/js/dashboard-widget.js) to enhance the dashboard widget, supporting dynamic UI updates and confirmation prompts for different purge actions.

Testing and Internal Maintenance:

  • Expanded the test suite in tests/test-vip-cache-manager.php to cover new special purge actions, added a data provider for these, and improved test isolation by resetting cache manager state in setUp and tearDown. [1] [2] [3]

Changelog Description

Added

  • WordPress Dashboard widget to clear edge cache (origin responses, VIP File Service uploads, static assets)

Pre-review checklist

Please make sure the items below have been covered before requesting a review:

  • This change works and has been tested locally or in Codespaces (or has an appropriate fallback).
  • This change works and has been tested on a sandbox.
  • This change has relevant unit tests (if applicable).
  • This change uses a rollout method to ease with deployment (if applicable - especially for large scale actions that require writes).
  • This change has relevant documentation additions / updates (if applicable).
  • I've created a changelog description that aligns with the provided examples.

Pre-deploy checklist

  • VIP staff: Ensure any alerts added/updated conform to internal standards (see internal documentation).

Steps to Test

@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

❌ Patch coverage is 5.83090% with 323 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.59%. Comparing base (ad368a2) to head (8d179cb).
⚠️ Report is 21 commits behind head on develop.

Files with missing lines Patch % Lines
vip-cache-manager/vip-cache-manager.php 6.99% 266 Missing ⚠️
wp-cli/vip-cache.php 0.00% 36 Missing ⚠️
vip-cache-manager/api.php 0.00% 21 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #6642      +/-   ##
=============================================
- Coverage      34.84%   34.59%   -0.25%     
- Complexity      5029     5073      +44     
=============================================
  Files            295      295              
  Lines          20746    20940     +194     
=============================================
+ Hits            7228     7244      +16     
- Misses         13518    13696     +178     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rinatkhaziev rinatkhaziev changed the title Remove Varnish support Remove Varnish support and implement class-based purges Dec 2, 2025
@rinatkhaziev
Copy link
Contributor Author

@copilot generate public facing documentation update.

Copy link
Contributor

Copilot AI commented Dec 2, 2025

@rinatkhaziev I've opened a new pull request, #6645, to work on those changes. Once the pull request is ready, I'll request review from you.

}

if ( 'site' === $scope && ! isset( $assoc_args['skip-confirm'] ) ) {
WP_CLI::confirm( "⚠️ You're about to invalidate Page Cache for the whole site, this can severely impact performance and stability for large sites. Are you sure?" );
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we maybe also change this line to be:

WP_CLI::confirm(
	sprintf(
		"⚠️ You're about to invalidate Page Cache for (%s). This can severely impact performance and stability for large sites. Are you sure?",
		trailingslashit( home_url() )
	)
);

Since it's still scoped by site, this will be useful to know which site.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion Wes

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
4.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

3 participants