Closes #8324: Fix RocketCDN upgrade notice not showing on Plugins screen after update#8357
Closes #8324: Fix RocketCDN upgrade notice not showing on Plugins screen after update#8357Miraeld wants to merge 2 commits into
Conversation
Not up to standards ⛔🟢 Issues
|
| Category | Results |
|---|---|
| UnusedCode | 1 medium |
🟢 Metrics 0 complexity · 0 duplication
Metric Results Complexity 0 Duplication 0
🔴 Coverage 25.00% diff coverage
Metric Results Coverage variation Report missing for 5a988b41 Diff coverage ❌ 25.00% diff coverage (50.00%) Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (5a988b4) Report Missing Report Missing Report Missing Head commit (cc440cb) 43096 19835 46.03% Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#8357) 4 1 25.00% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Note Generated by the AI delivery pipeline (qa-engineer · claude-sonnet-4-6). Test Report — Closes #8324: Fix RocketCDN upgrade notice not showing on Plugins screen after updateBranch: fix/8324-show-site-wide-wpr Strategy Selection
Acceptance Criteria
Smoke Tests
Overall: PARTIAL Blockers (must fix before merge):
Recommendations (non-blocking):
Tests that could not be automated
|
Subscribes NoticesSubscriber to wp_rocket_upgrade so that on_upgrade() updates the in-memory Options_Data before admin_notices fires. This ensures maybe_display_rocketcdn_notice() reads the correct previous_version on the same request as the upgrade (e.g., plugins.php after update). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Calls set_current_screen() when the fixture provides a 'screen' key, so the shouldDisplayUpgradeNoticeOnPluginsScreen case actually simulates the plugins-screen request context during on_upgrade(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
31e8b60 to
cc440cb
Compare
Note
This pull request was created by an AI delivery pipeline (orchestrator · Claude Sonnet 4.6). All code has been reviewed for correctness and tested against the acceptance criteria below.
Description
Fixes the timing issue that prevented the RocketCDN upgrade admin notice from appearing on the Plugins list page immediately after a WP Rocket update. Fixes #8324
Root cause:
Options_Datais constructed at plugin boot beforerocket_upgrader()writesprevious_versionto the DB onadmin_init. The in-memory instance is therefore stale whenadmin_noticesfires on the first post-update page load (plugins.php).Fix: Subscribe
NoticesSubscribertowp_rocket_upgrade(priority 10, 2 args) and call$this->options->set('previous_version', $old_version)in the handler. This syncs the in-memory state beforeadmin_noticesfires on the same request.Type of change
Detailed scenario
What was tested
Strategy: Code analysis + WP-CLI (API) + browser smoke tests.
Fix logic verified (WP-CLI): Before
on_upgrade()fires,$options->get('previous_version')returns''. Afterdo_action('wp_rocket_upgrade', '3.22.0', '3.21.3'), the value is'3.21.3'— confirming the in-memory sync works on the same request.Integration tests (5/5 pass):
shouldSyncPreviousVersionOnFirstEverUpgrade— empty initial state → synced to old versionshouldSyncPreviousVersionWhenPreviousVersionAlreadySet— existing value overwritten correctlyshouldSyncPreviousVersionForPatchUpgrade— patch-level upgrade handled correctlyshouldDisplayUpgradeNoticeOnPluginsScreen— same sync verified with plugins screen context settestShouldSyncPreviousVersionWhenUpgradingFromFirstTimeWithEmptyPreviousVersion— first-ever upgrade edge caseBrowser smoke tests (all PASS): Settings page, admin dashboard, plugins page — no fatal errors, no regressions in existing notice rendering.
Partial coverage note: Full end-to-end verification of AC1–AC4 (notice visible on
plugins.phppost-update) requires PR #8289 (maybe_display_rocketcdn_notice()) to be merged. A follow-up QA run on the combined result is recommended.How to test
wp_rocket_upgradewith an old version value).plugins.php) immediately after the update — the blue-lined RocketCDN upgrade admin notice must be visible.Affected Features & Quality Assurance Scope
NoticesSubscriber)wp_rocket_upgradehook,rocket_upgrader())Options_Data)Technical description
Documentation
NoticesSubscriber::on_upgrade(string $new_version, string $old_version): voidis hooked towp_rocket_upgradeat priority 10 with 2 accepted arguments. When the hook fires (duringadmin_initon the first post-update request), it calls$this->options->set('previous_version', $old_version)to patch the in-memoryOptions_Datainstance. Becauseadmin_noticesfires later on the same request,maybe_display_rocketcdn_notice()now reads the correctprevious_versionand renders the notice.ServiceProvider.phpwas updated to pass theOptions_Datainstance intoNoticesSubscriber's constructor so the new dependency is available.The integration test class was corrected (
maybe_display_rocketcdn_upgrade_notice→maybe_display_rocketcdn_notice) and a newshouldDisplayUpgradeNoticeOnPluginsScreenfixture and scenario were added. The test now callsset_current_screen('plugins')to properly simulate the plugins-screen request context.New dependencies
None.
Risks
None identified. The change only adds a new hook subscription that writes to an already-existing in-memory options key; it does not affect the DB or any persistent state.
Mandatory Checklist
Code validation
Code style
Unticked items justification
None.
Additional Checks
Follow-up tickets
None