ci: make package acceptance legacy-safe

This commit is contained in:
Peter Steinberger
2026-04-27 05:45:27 +01:00
parent 6987132aed
commit 748daa4857
9 changed files with 64 additions and 15 deletions

View File

@@ -312,5 +312,9 @@ WRAPPER
assert_entrypoint "$unit_path" "$npm_entry"
}
run_wrapper_flow
if "$npm_bin" gateway install --help 2>&1 | grep -q -- "--wrapper"; then
run_wrapper_flow
else
echo "Skipping wrapper persistence; package gateway install does not support --wrapper."
fi
'

View File

@@ -560,8 +560,9 @@ const path = require("node:path");
const indexPath = path.join(process.env.HOME, ".openclaw", "plugins", "installs.json");
const index = JSON.parse(fs.readFileSync(indexPath, "utf8"));
const installRecords = index.installRecords ?? index.records ?? {};
for (const id of ["marketplace-shortcut", "marketplace-direct"]) {
const record = index.installRecords?.[id];
const record = installRecords[id];
if (!record) throw new Error(`missing install record for ${id}`);
if (record.source !== "marketplace") {
throw new Error(`unexpected source for ${id}: ${record.source}`);
@@ -845,7 +846,8 @@ if (inspect.plugin?.id !== pluginId) {
const indexPath = path.join(process.env.HOME, ".openclaw", "plugins", "installs.json");
const index = JSON.parse(fs.readFileSync(indexPath, "utf8"));
const record = index.installRecords?.[pluginId];
const installRecords = index.installRecords ?? index.records ?? {};
const record = installRecords[pluginId];
if (!record) throw new Error(`missing ClawHub install record for ${pluginId}`);
if (record.source !== "clawhub") {
throw new Error(`unexpected ClawHub install source for ${pluginId}: ${record.source}`);
@@ -890,7 +892,8 @@ if ((list.plugins || []).some((entry) => entry.id === pluginId)) {
const indexPath = path.join(process.env.HOME, ".openclaw", "plugins", "installs.json");
const index = fs.existsSync(indexPath) ? JSON.parse(fs.readFileSync(indexPath, "utf8")) : {};
if (index.installRecords?.[pluginId]) {
const installRecords = index.installRecords ?? index.records ?? {};
if (installRecords[pluginId]) {
throw new Error(`ClawHub install record still present after uninstall: ${pluginId}`);
}

View File

@@ -45,11 +45,33 @@ tar -xzf "$package_tgz" -C "$git_root" --strip-components=1
# absent from the trimmed tarball install; that should not block update preflight.
node - <<'"'"'NODE'"'"'
const fs = require("node:fs");
const path = require("node:path");
const packageJsonPath = "/tmp/openclaw-git/package.json";
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
const fixtureUiBuildSource = `const fs=require("node:fs");fs.mkdirSync("dist/control-ui",{recursive:true});fs.writeFileSync("dist/control-ui/index.html","<!doctype html><title>fixture</title>\\n")`;
const fixtureUiBuildCommand = `node -e ${JSON.stringify(fixtureUiBuildSource)}`;
packageJson.pnpm = { ...packageJson.pnpm, allowUnusedPatches: true };
const nextPnpm = { ...packageJson.pnpm, allowUnusedPatches: true };
const patchedDependencies = nextPnpm.patchedDependencies;
if (
patchedDependencies &&
typeof patchedDependencies === "object" &&
!Array.isArray(patchedDependencies)
) {
const keptPatches = Object.fromEntries(
Object.entries(patchedDependencies).filter(([, patchFile]) => {
return (
typeof patchFile === "string" &&
fs.existsSync(path.resolve(path.dirname(packageJsonPath), patchFile))
);
}),
);
if (Object.keys(keptPatches).length > 0) {
nextPnpm.patchedDependencies = keptPatches;
} else {
delete nextPnpm.patchedDependencies;
}
}
packageJson.pnpm = nextPnpm;
packageJson.scripts = {
...packageJson.scripts,
build: "node -e \"console.log(\\\"fixture build skipped\\\")\"",