From f5225da0ca83a6b78446325aa230368bed9ad4cc Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 08:47:48 +0000 Subject: [PATCH 1/2] Fix flaky update-check tests comparing last_checked timestamps The "List plugins" and "wp theme list does a force check" scenarios compared the update transient's last_checked value before and after a forced update check. last_checked has one-second resolution, so when both checks ran within the same second the value was unchanged and the "should not contain" assertion failed. Seed last_checked with a fixed old timestamp before the comparison so a forced refresh always produces a different value. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UWTd5pdhYygFrCQ5Cm3EMH --- features/plugin.feature | 9 +++++++-- features/theme.feature | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/features/plugin.feature b/features/plugin.feature index e6b04a0f..5483bd55 100644 --- a/features/plugin.feature +++ b/features/plugin.feature @@ -357,8 +357,13 @@ Feature: Manage WordPress plugins Automattic """ - When I run `wp eval "echo get_site_transient('update_plugins')->last_checked;"` - Then save STDOUT as {LAST_UPDATED} + When I run `wp eval "set_site_transient( 'update_plugins', (object) array_merge( (array) get_site_transient( 'update_plugins' ), array( 'last_checked' => 1000000000 ) ) );"` + And I run `wp eval "echo get_site_transient('update_plugins')->last_checked;"` + Then STDOUT should be: + """ + 1000000000 + """ + And save STDOUT as {LAST_UPDATED} When I run `wp plugin list --skip-update-check` Then STDOUT should not be empty diff --git a/features/theme.feature b/features/theme.feature index ff1c35ac..b4ffb452 100644 --- a/features/theme.feature +++ b/features/theme.feature @@ -262,8 +262,13 @@ Feature: Manage WordPress themes When I run `wp theme list` Then STDOUT should not be empty - When I run `wp eval "echo get_site_transient( 'update_themes' )->last_checked;"` - Then save STDOUT as {LAST_UPDATED} + When I run `wp eval "set_site_transient( 'update_themes', (object) array_merge( (array) get_site_transient( 'update_themes' ), array( 'last_checked' => 1000000000 ) ) );"` + And I run `wp eval "echo get_site_transient( 'update_themes' )->last_checked;"` + Then STDOUT should be: + """ + 1000000000 + """ + And save STDOUT as {LAST_UPDATED} When I run `wp theme list --skip-update-check` Then STDOUT should not be empty From c823fa891875e074cf2e79ec491250750a4b0743 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 09:37:16 +0000 Subject: [PATCH 2/2] Seed last_checked with a future timestamp in update-check tests A stale last_checked lets an unforced wp_update_plugins()/wp_update_themes() refresh the transient, so the tests would still pass if list stopped deleting the transient before refreshing. A future timestamp keeps an unforced check from refreshing it, so only a forced check changes the value. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UWTd5pdhYygFrCQ5Cm3EMH --- features/plugin.feature | 7 ++----- features/theme.feature | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/features/plugin.feature b/features/plugin.feature index 5483bd55..8d481659 100644 --- a/features/plugin.feature +++ b/features/plugin.feature @@ -357,12 +357,9 @@ Feature: Manage WordPress plugins Automattic """ - When I run `wp eval "set_site_transient( 'update_plugins', (object) array_merge( (array) get_site_transient( 'update_plugins' ), array( 'last_checked' => 1000000000 ) ) );"` + When I run `wp eval "set_site_transient( 'update_plugins', (object) array_merge( (array) get_site_transient( 'update_plugins' ), array( 'last_checked' => time() + DAY_IN_SECONDS ) ) );"` And I run `wp eval "echo get_site_transient('update_plugins')->last_checked;"` - Then STDOUT should be: - """ - 1000000000 - """ + Then STDOUT should be a number And save STDOUT as {LAST_UPDATED} When I run `wp plugin list --skip-update-check` diff --git a/features/theme.feature b/features/theme.feature index b4ffb452..5b975188 100644 --- a/features/theme.feature +++ b/features/theme.feature @@ -262,12 +262,9 @@ Feature: Manage WordPress themes When I run `wp theme list` Then STDOUT should not be empty - When I run `wp eval "set_site_transient( 'update_themes', (object) array_merge( (array) get_site_transient( 'update_themes' ), array( 'last_checked' => 1000000000 ) ) );"` + When I run `wp eval "set_site_transient( 'update_themes', (object) array_merge( (array) get_site_transient( 'update_themes' ), array( 'last_checked' => time() + DAY_IN_SECONDS ) ) );"` And I run `wp eval "echo get_site_transient( 'update_themes' )->last_checked;"` - Then STDOUT should be: - """ - 1000000000 - """ + Then STDOUT should be a number And save STDOUT as {LAST_UPDATED} When I run `wp theme list --skip-update-check`