From 683549b17f05ddd05f51956e456b6faf6af20ea1 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 2 May 2026 00:44:26 +0100 Subject: [PATCH] fix: tolerate update migration pre-doctor cleanup --- scripts/e2e/lib/upgrade-survivor/run.sh | 26 ++++++++++++++++--- .../package-acceptance-workflow.test.ts | 6 +++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/scripts/e2e/lib/upgrade-survivor/run.sh b/scripts/e2e/lib/upgrade-survivor/run.sh index 4594296508b..a638d152eca 100644 --- a/scripts/e2e/lib/upgrade-survivor/run.sh +++ b/scripts/e2e/lib/upgrade-survivor/run.sh @@ -342,6 +342,15 @@ seed_legacy_plugin_dependency_debris() { assert_legacy_plugin_dependency_debris_present() { plugin_deps_cleanup_enabled || return 0 + local found + found="$(legacy_plugin_dependency_debris_count)" + if [ "$found" -eq 0 ]; then + echo "plugin-deps-cleanup scenario did not create legacy plugin dependency debris" >&2 + return 1 + fi +} + +legacy_plugin_dependency_debris_count() { local found=0 local plugin for plugin in $(plugin_deps_cleanup_plugins); do @@ -352,9 +361,18 @@ assert_legacy_plugin_dependency_debris_present() { fi done < <(legacy_plugin_dependency_probe_paths "$plugin") done - if [ "$found" -ne 1 ]; then - echo "plugin-deps-cleanup scenario did not create legacy plugin dependency debris" >&2 - return 1 + printf '%s\n' "$found" +} + +assert_legacy_plugin_dependency_debris_before_doctor() { + plugin_deps_cleanup_enabled || return 0 + + local found + found="$(legacy_plugin_dependency_debris_count)" + if [ "$found" -eq 0 ]; then + echo "Legacy plugin dependency debris was already removed before doctor; post-doctor cleanup assertion will verify it stays gone." + else + echo "Legacy plugin dependency debris survived update and will be cleaned by doctor." fi } @@ -657,7 +675,7 @@ phase assert-baseline assert_baseline_state phase seed-legacy-runtime-deps-symlink seed_legacy_runtime_deps_symlink phase resolve-candidate resolve_candidate_version phase update-candidate update_candidate -phase assert-legacy-plugin-dependency-debris-before-doctor assert_legacy_plugin_dependency_debris_present +phase assert-legacy-plugin-dependency-debris-before-doctor assert_legacy_plugin_dependency_debris_before_doctor phase doctor run_doctor phase assert-legacy-plugin-dependency-debris-cleaned assert_legacy_plugin_dependency_debris_cleaned phase assert-legacy-runtime-deps-symlink-repaired assert_legacy_runtime_deps_symlink_repaired diff --git a/test/scripts/package-acceptance-workflow.test.ts b/test/scripts/package-acceptance-workflow.test.ts index d38e4faa1d8..7247dc28828 100644 --- a/test/scripts/package-acceptance-workflow.test.ts +++ b/test/scripts/package-acceptance-workflow.test.ts @@ -214,6 +214,12 @@ describe("package artifact reuse", () => { expect(publishedUpgradeSurvivor).toContain("validate_baseline_package_spec"); expect(publishedUpgradeSurvivor).toContain("openclaw@(beta|latest|"); expect(publishedUpgradeSurvivor).toContain("probe_gateway_endpoint"); + expect(publishedUpgradeSurvivor).toContain( + "assert_legacy_plugin_dependency_debris_before_doctor", + ); + expect(publishedUpgradeSurvivor).toContain( + "Legacy plugin dependency debris was already removed before doctor", + ); expect( publishedUpgradeSurvivor.indexOf('validate_baseline_package_spec "$baseline_spec"'), ).toBeLessThan(