Boost: continue Critical CSS generation when a single provider fails unexpectedly#49554
Boost: continue Critical CSS generation when a single provider fails unexpectedly#49554kraftbj wants to merge 1 commit into
Conversation
…ne provider errors unexpectedly Previously, any error other than SuccessTargetError thrown while generating Critical CSS for a single provider was re-thrown, aborting generation for all remaining providers and discarding their results. Now such errors are recorded as that provider's errors (via the existing set-provider-errors data-sync action, using the UnknownError type the UI already understands), and generation continues with the remaining providers. Truly global failures (e.g. the generator library failing to load) still abort the run, and SuccessTargetError handling is unchanged. Fixes #38217 https://claude.ai/code/session_01PgpTrtTCH4hpz6Krh3ssho
Code Coverage SummaryCoverage changed in 1 file.
Full summary · PHP report · JS report Coverage check overridden by
Coverage tests to be added later
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
If you have questions about anything, reach out in #jetpack-developers for guidance! Boost plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Fixes #38217
Proposed changes
SuccessTargetError) occurs while generating CSS for one provider, record it as that provider's error via the existingset-provider-errorsdata-sync action (UnknownErrortype) and continue with the remaining providers — instead of re-throwing, which unwound the whole run, set the global state toerror, and discarded the run for all remaining providers even though completed providers' CSS was already saved server-side.stepsFailedaccounting so the existingcritical_css_failure/critical_css_successTracks events remain accurate; the per-providercritical_css_failureevent is still recorded.signal.aborted), matching the previous swallow-on-abort behavior.SuccessTargetError(per-URL failures) handling,ProviderCssSaveErrorhandling, and the global hard-failure path when the generator library fails to load.isFatalError()still reports a fatal error when no provider succeeded, so the all-failed UX is preserved. No PHP changes needed —Critical_CSS_State::maybe_set_generated()already flips overall status togeneratedonce no provider is pending.Related product discussion/links
Does this pull request change what data or activity we track or use?
No. (Existing Tracks events unchanged; the per-provider failure event already carried
provider_key.)Testing instructions
generateCriticalCSSfor one provider key, or by temporarily corrupting one provider's URL in thejetpack_boost_ds_critical_css_stateoption.jetpack_boost_ds_critical_css_stateshows the failing provider withstatus: error, the restsuccess, overallgenerated; the front end serves critical CSS for successful providers.SuccessTargetErrorrecommendation; blocking thejetpack-critical-css-genchunk still produces the global error state; cancelling mid-run produces no spurious provider errors.https://claude.ai/code/session_01PgpTrtTCH4hpz6Krh3ssho
Generated by Claude Code