Skip to content

Conversation

@bindlegirl
Copy link
Contributor

@bindlegirl bindlegirl commented Jan 16, 2026

Refactors External_Storage to remove the unused Error_Handler integration and introduces a host-agnostic provider-based error reporting system. Storage providers can now optionally implement error handling methods to report errors to their own monitoring systems.

Related CONNECT-81

Proposed changes:

External_Storage (class-external-storage.php)

  • Added static cache ($logged_events) to prevent duplicate logging within the same request
  • Removed Error_Handler integration (was never used in production)
  • Removed should_report_for_environment() method
  • Updated should_report_empty_state() to support provider customization
  • Added provider delegation via optional handle_error_event() method
  • Added support for optional get_empty_state_delay_threshold() provider method
  • Changed default empty state delay from 10 minutes to 5 minutes

Storage Provider Interface (interface-storage-provider.php)

  • Added comprehensive documentation for required and optional methods
  • Documented handle_error_event($event_type, $key, $details, $environment) optional method
  • Documented get_empty_state_delay_threshold() optional method with support for 0 (immediate reporting)

Error_Handler (class-error-handler.php)

  • Marked external_storage_empty and external_storage_error codes as deprecated

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

  • Code review
  • Make sure the connection is still working when this branch is loaded on WoA test site.

@bindlegirl bindlegirl self-assigned this Jan 16, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 16, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the remove/remove-deprecate-error-handling-external-storage branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack remove/remove-deprecate-error-handling-external-storage
bin/jetpack-downloader test jetpack-mu-wpcom-plugin remove/remove-deprecate-error-handling-external-storage

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions
Copy link
Contributor

github-actions bot commented Jan 16, 2026

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jan 16, 2026
@jp-launch-control
Copy link

jp-launch-control bot commented Jan 16, 2026

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/connection/src/class-external-storage.php 34/69 (49.28%) 17.95% -22 💚

Full summary · PHP report · JS report

@bindlegirl bindlegirl marked this pull request as ready for review January 19, 2026 09:32
Copilot AI review requested due to automatic review settings January 19, 2026 09:32
@bindlegirl bindlegirl removed the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jan 19, 2026
Copy link
Contributor

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 deprecates the Error_Handler integration in External_Storage as phase 1 of enabling proper error handling. The changes introduce a static cache to prevent duplicate logging within the same request and add deprecation notices for methods that will be replaced by a provider-based error reporting mechanism.

Changes:

  • Add static cache to External_Storage to prevent duplicate event logging within the same request
  • Deprecate Error_Handler integration methods (should_report_for_environment, should_report_empty_state) and disable remote error reporting
  • Mark external_storage_empty and external_storage_error codes as deprecated in Error_Handler

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
projects/packages/connection/src/class-external-storage.php Adds static cache for logged events, deprecates Error_Handler integration methods, and disables remote error reporting
projects/packages/connection/src/class-error-handler.php Marks external storage error codes as deprecated
projects/packages/connection/tests/php/External_Storage_Test.php Updates tests to reset static cache in tearDown and adds test for static cache behavior
projects/packages/connection/changelog/remove-remove-deprecate-error-handling-external-storage Adds changelog entry for the deprecation

…-error-handling-external-storage

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings January 19, 2026 09:37
Copy link
Contributor

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

Copilot AI review requested due to automatic review settings January 19, 2026 13:11
Copy link
Contributor

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@bindlegirl bindlegirl changed the title Connection: Deprecate Error_Handler integration in External_Storage Connection: Replace Error_Handler use in External_Storage Jan 19, 2026
@bindlegirl bindlegirl requested a review from Copilot January 19, 2026 13:35
@bindlegirl bindlegirl added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it and removed [Type] Janitorial labels Jan 19, 2026
Copy link
Contributor

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Connection [Status] In Progress [Tests] Includes Tests [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants