From 9d5a0d409455c8b4fee630c24a81e13485767e96 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 2 May 2026 15:35:36 +0100 Subject: [PATCH] test: support legacy plugin cleanup package layout --- scripts/e2e/lib/upgrade-survivor/run.sh | 37 +++++++++++++------ .../package-acceptance-workflow.test.ts | 2 + 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/scripts/e2e/lib/upgrade-survivor/run.sh b/scripts/e2e/lib/upgrade-survivor/run.sh index e09d9817be9..2c9cc6aa026 100644 --- a/scripts/e2e/lib/upgrade-survivor/run.sh +++ b/scripts/e2e/lib/upgrade-survivor/run.sh @@ -269,17 +269,26 @@ plugin_deps_cleanup_plugins() { printf '%s\n' "${OPENCLAW_UPGRADE_SURVIVOR_PLUGIN_DEPS_CLEANUP_PLUGINS:-discord telegram}" } +plugin_deps_cleanup_plugin_dirs() { + local plugin="$1" + printf '%s\n' \ + "$(package_root)/dist/extensions/$plugin" \ + "$(package_root)/extensions/$plugin" +} + legacy_plugin_dependency_probe_paths() { local plugin="$1" local plugin_dir - plugin_dir="$(package_root)/dist/extensions/$plugin" + while IFS= read -r plugin_dir; do + printf '%s\n' \ + "$plugin_dir/node_modules" \ + "$plugin_dir/.openclaw-runtime-deps.json" \ + "$plugin_dir/.openclaw-runtime-deps-stamp.json" \ + "$plugin_dir/.openclaw-runtime-deps-copy-upgrade-survivor" \ + "$plugin_dir/.openclaw-install-stage-upgrade-survivor" \ + "$plugin_dir/.openclaw-pnpm-store" + done < <(plugin_deps_cleanup_plugin_dirs "$plugin") printf '%s\n' \ - "$plugin_dir/node_modules" \ - "$plugin_dir/.openclaw-runtime-deps.json" \ - "$plugin_dir/.openclaw-runtime-deps-stamp.json" \ - "$plugin_dir/.openclaw-runtime-deps-copy-upgrade-survivor" \ - "$plugin_dir/.openclaw-install-stage-upgrade-survivor" \ - "$plugin_dir/.openclaw-pnpm-store" \ "$(package_root)/.local/bundled-plugin-runtime-deps/$plugin-upgrade-survivor" \ "$OPENCLAW_STATE_DIR/.local/bundled-plugin-runtime-deps/$plugin-upgrade-survivor" \ "$OPENCLAW_STATE_DIR/plugin-runtime-deps/$plugin-upgrade-survivor" @@ -297,10 +306,15 @@ seed_legacy_plugin_dependency_debris() { local plugin for plugin in $(plugin_deps_cleanup_plugins); do local plugin_dir - plugin_dir="$(package_root)/dist/extensions/$plugin" - if [ ! -d "$plugin_dir" ]; then - continue - fi + plugin_dir="" + local candidate_dir + while IFS= read -r candidate_dir; do + if [ -d "$candidate_dir" ]; then + plugin_dir="$candidate_dir" + break + fi + done < <(plugin_deps_cleanup_plugin_dirs "$plugin") + [ -n "$plugin_dir" ] || continue found=1 mkdir -p \ "$plugin_dir/node_modules/openclaw-upgrade-survivor-dep" \ @@ -330,6 +344,7 @@ seed_legacy_plugin_dependency_debris() { if [ "$found" -ne 1 ]; then echo "plugin-deps-cleanup scenario could not find a packaged Discord or Telegram plugin directory" >&2 find "$(package_root)/dist" -maxdepth 3 -type d 2>/dev/null >&2 || true + find "$(package_root)/extensions" -maxdepth 2 -type d 2>/dev/null >&2 || true return 1 fi } diff --git a/test/scripts/package-acceptance-workflow.test.ts b/test/scripts/package-acceptance-workflow.test.ts index f262dc82acd..b961ddcd9a5 100644 --- a/test/scripts/package-acceptance-workflow.test.ts +++ b/test/scripts/package-acceptance-workflow.test.ts @@ -229,6 +229,8 @@ describe("package artifact reuse", () => { expect(packageJson).toContain("OPENCLAW_UPGRADE_SURVIVOR_PUBLISHED_BASELINE=1"); expect(publishedUpgradeSurvivor).toContain("validate_baseline_package_spec"); expect(publishedUpgradeSurvivor).toContain("openclaw@(beta|latest|"); + expect(publishedUpgradeSurvivor).toContain("plugin_deps_cleanup_plugin_dirs"); + expect(publishedUpgradeSurvivor).toContain('"$(package_root)/extensions/$plugin"'); expect(publishedUpgradeSurvivor).toContain("probe_gateway_endpoint"); expect(publishedUpgradeSurvivor).toContain( "assert_legacy_plugin_dependency_debris_before_doctor",