mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 12:30:44 +00:00
test(package): cover stale source plugin shadows
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
This commit is contained in:
committed by
Peter Steinberger
parent
112924b113
commit
0fc8afeac9
@@ -8,6 +8,7 @@ const SCENARIOS = new Set([
|
||||
"bootstrap-persona",
|
||||
"plugin-deps-cleanup",
|
||||
"configured-plugin-installs",
|
||||
"stale-source-plugin-shadow",
|
||||
"tilde-log-path",
|
||||
"versioned-runtime-deps",
|
||||
]);
|
||||
@@ -355,6 +356,13 @@ function assertStateSurvived() {
|
||||
assert(actual === contents, `${fileName} was changed during update/doctor`);
|
||||
}
|
||||
}
|
||||
if (scenario === "stale-source-plugin-shadow") {
|
||||
const staleRoot = path.join(stateDir, "extensions", "opik-openclaw");
|
||||
assert(
|
||||
fs.existsSync(path.join(staleRoot, "src", "index.ts")),
|
||||
"source-only plugin shadow fixture missing",
|
||||
);
|
||||
}
|
||||
if (scenario === "versioned-runtime-deps") {
|
||||
if (stage === "baseline") {
|
||||
return;
|
||||
|
||||
@@ -286,6 +286,47 @@ configured_plugin_installs_enabled() {
|
||||
[ "$SCENARIO" = "configured-plugin-installs" ]
|
||||
}
|
||||
|
||||
source_only_plugin_shadow_enabled() {
|
||||
[ "$SCENARIO" = "stale-source-plugin-shadow" ]
|
||||
}
|
||||
|
||||
seed_source_only_plugin_shadow() {
|
||||
source_only_plugin_shadow_enabled || return 0
|
||||
|
||||
local shadow_root="$OPENCLAW_STATE_DIR/extensions/opik-openclaw"
|
||||
mkdir -p "$shadow_root/src"
|
||||
cat >"$shadow_root/package.json" <<'JSON'
|
||||
{
|
||||
"name": "@opik/opik-openclaw",
|
||||
"version": "0.0.0-upgrade-survivor",
|
||||
"openclaw": {
|
||||
"extensions": ["./src/index.ts"]
|
||||
}
|
||||
}
|
||||
JSON
|
||||
cat >"$shadow_root/openclaw.plugin.json" <<'JSON'
|
||||
{
|
||||
"id": "opik-openclaw",
|
||||
"activation": {
|
||||
"onStartup": false
|
||||
},
|
||||
"configSchema": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {}
|
||||
}
|
||||
}
|
||||
JSON
|
||||
cat >"$shadow_root/src/index.ts" <<'TS'
|
||||
export default {
|
||||
id: "opik-openclaw",
|
||||
name: "Source-only Opik shadow",
|
||||
register() {},
|
||||
};
|
||||
TS
|
||||
echo "Seeded source-only plugin shadow: $shadow_root"
|
||||
}
|
||||
|
||||
configure_configured_plugin_install_fixture_registry() {
|
||||
configured_plugin_installs_enabled || return 0
|
||||
|
||||
@@ -785,6 +826,7 @@ phase validate-baseline-config validate_baseline_config
|
||||
phase install-baseline-plugin-dependencies install_baseline_plugin_dependencies
|
||||
phase seed-legacy-plugin-dependency-debris seed_legacy_plugin_dependency_debris
|
||||
phase assert-legacy-plugin-dependency-debris assert_legacy_plugin_dependency_debris_present
|
||||
phase seed-source-only-plugin-shadow seed_source_only_plugin_shadow
|
||||
phase assert-baseline assert_baseline_state
|
||||
phase seed-legacy-runtime-deps-symlink seed_legacy_runtime_deps_symlink
|
||||
phase resolve-candidate resolve_candidate_version
|
||||
|
||||
@@ -75,6 +75,7 @@ const UPGRADE_SURVIVOR_SCENARIOS = [
|
||||
"bootstrap-persona",
|
||||
"plugin-deps-cleanup",
|
||||
"configured-plugin-installs",
|
||||
"stale-source-plugin-shadow",
|
||||
"tilde-log-path",
|
||||
"versioned-runtime-deps",
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user