From 4a4a5082888944025762476fa1e04e040f19fc38 Mon Sep 17 00:00:00 2001 From: Shakker Date: Wed, 16 Sep 2026 11:44:37 +0100 Subject: [PATCH] chore: remove obsolete OCM-98 reproduction tools --- scripts/ocm-98-db-meta.mjs | 33 ---- scripts/reproduce-ocm-98.sh | 311 ------------------------------------ 2 files changed, 344 deletions(-) delete mode 100644 scripts/ocm-98-db-meta.mjs delete mode 100755 scripts/reproduce-ocm-98.sh diff --git a/scripts/ocm-98-db-meta.mjs b/scripts/ocm-98-db-meta.mjs deleted file mode 100644 index 8d63af37..00000000 --- a/scripts/ocm-98-db-meta.mjs +++ /dev/null @@ -1,33 +0,0 @@ -import { DatabaseSync } from "node:sqlite"; - -const [databasePath, field] = process.argv.slice(2); -if (!databasePath) { - throw new Error("usage: node scripts/ocm-98-db-meta.mjs [field]"); -} - -const database = new DatabaseSync(databasePath, { readOnly: true }); -try { - const userVersionRow = database.prepare("PRAGMA user_version").get(); - const metadata = database - .prepare( - "SELECT schema_version AS schemaVersion, app_version AS appVersion, created_at AS createdAt, updated_at AS updatedAt FROM schema_meta WHERE meta_key = 'primary'", - ) - .get(); - const result = { - userVersion: Number(userVersionRow?.user_version ?? 0), - schemaVersion: Number(metadata?.schemaVersion ?? 0), - appVersion: metadata?.appVersion ?? null, - createdAt: metadata?.createdAt ?? null, - updatedAt: metadata?.updatedAt ?? null, - }; - if (field) { - if (!(field in result)) { - throw new Error(`unknown field: ${field}`); - } - process.stdout.write(`${result[field] ?? "null"}\n`); - } else { - process.stdout.write(`${JSON.stringify(result, null, 2)}\n`); - } -} finally { - database.close(); -} diff --git a/scripts/reproduce-ocm-98.sh b/scripts/reproduce-ocm-98.sh deleted file mode 100755 index 7011d7a9..00000000 --- a/scripts/reproduce-ocm-98.sh +++ /dev/null @@ -1,311 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -current_ocm=${1:?usage: reproduce-ocm-98.sh } -legacy_ocm=${2:?usage: reproduce-ocm-98.sh } -evidence_root=${3:?usage: reproduce-ocm-98.sh } -fixture_root="$evidence_root/fixture" -seed_home="$fixture_root/seed-home" -seed_state="$seed_home/.openclaw" -seed_checkout="$fixture_root/source-checkout" -seed_acpx="$seed_state/npm/projects/fixture/node_modules/@openclaw/acpx" -npm_cache="$fixture_root/npm-cache" -db_meta_script="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/scripts/ocm-98-db-meta.mjs" - -mkdir -p "$evidence_root" "$seed_state/state" "$seed_state/workspace" "$npm_cache" -mkdir -p "$seed_checkout/dist/extensions/codex" -mkdir -p "$seed_checkout/extensions/whatsapp-target" -mkdir -p "$seed_acpx" - -resolved_evidence_root=$(realpath -m "$evidence_root") -resolved_fixture_root=$(realpath -m "$fixture_root") -case "$resolved_fixture_root" in - "$resolved_evidence_root"/*) ;; - *) - echo "fixture root escaped evidence root" >&2 - exit 1 - ;; -esac -if [ "$resolved_fixture_root" = "$(realpath -m "$HOME")" ]; then - echo "fixture root must not equal the runner home" >&2 - exit 1 -fi - -printf '{"id":"codex","name":"Credential-free fixture"}\n' \ - > "$seed_checkout/dist/extensions/codex/openclaw.plugin.json" -printf '{"id":"whatsapp","name":"Credential-free fixture"}\n' \ - > "$seed_checkout/extensions/whatsapp-target/openclaw.plugin.json" -printf '{"id":"acpx","name":"Credential-free fixture"}\n' \ - > "$seed_acpx/openclaw.plugin.json" -ln -s whatsapp-target "$seed_checkout/extensions/whatsapp-link" - -write_fixture_config() { - cat > "$seed_state/openclaw.json" < "$evidence_root/fixture-config.redacted.json" <<'EOF' -{ - "agents": { - "defaults": { "workspace": "/seed-home/.openclaw/workspace" }, - "list": [ - { - "id": "main", - "workspace": "/seed-home/.openclaw/workspace" - } - ] - }, - "plugins": { - "load": { - "paths": ["/source-checkout/extensions/whatsapp-link"] - }, - "entries": { - "codex": { "enabled": true }, - "whatsapp": { "enabled": true } - }, - "installs": { - "acpx": { - "source": "npm", - "installPath": "/seed-home/.openclaw/npm/projects/fixture/node_modules/@openclaw/acpx" - }, - "codex": { - "source": "path", - "sourcePath": "/source-checkout/dist/extensions/codex", - "installPath": "/source-checkout/dist/extensions/codex" - }, - "whatsapp": { - "source": "path", - "sourcePath": "/source-checkout/extensions/whatsapp-link", - "installPath": "/source-checkout/extensions/whatsapp-link" - } - } - } -} -EOF - -printf '%s\n' \ - HOME \ - USERPROFILE \ - OCM_HOME \ - OPENCLAW_HOME \ - OPENCLAW_STATE_DIR \ - OPENCLAW_CONFIG_PATH \ - OCM_ACTIVE_ENV \ - OCM_ACTIVE_ENV_ROOT \ - OPENCLAW_PROFILE \ - STATE_DIRECTORY \ - TMPDIR \ - > "$evidence_root/environment-variable-names.txt" - -{ - printf 'evidenceRoot=\n' - printf 'fixtureRoot=/fixture\n' - printf 'sourceState=/seed-home/.openclaw\n' - printf 'agents.defaults.workspace=/seed-home/.openclaw/workspace\n' - printf 'agents.list[main].workspace=/seed-home/.openclaw/workspace\n' - printf 'plugins.load.paths[0]=/source-checkout/extensions/whatsapp-link\n' - printf 'plugins.installs.acpx.source=npm\n' - printf 'plugins.installs.acpx.installPath=/seed-home/.openclaw/npm/projects/fixture/node_modules/@openclaw/acpx\n' - printf 'plugins.installs.codex.source=path\n' - printf 'plugins.installs.codex.sourcePath=/source-checkout/dist/extensions/codex\n' - printf 'plugins.installs.codex.installPath=/source-checkout/dist/extensions/codex\n' - printf 'plugins.installs.whatsapp.source=path\n' - printf 'plugins.installs.whatsapp.sourcePath=/source-checkout/extensions/whatsapp-link\n' - printf 'plugins.installs.whatsapp.installPath=/source-checkout/extensions/whatsapp-link\n' - printf 'whatsapp.symlinkTarget=%s\n' "$(readlink "$seed_checkout/extensions/whatsapp-link")" -} > "$evidence_root/path-manifest.txt" - -env -i \ - HOME="$seed_home" \ - PATH="$PATH" \ - OPENCLAW_HOME="$seed_home" \ - OPENCLAW_STATE_DIR="$seed_state" \ - OPENCLAW_CONFIG_PATH="$seed_state/openclaw.json" \ - npm_config_cache="$npm_cache" \ - npm view openclaw@2026.8.1-beta.1 version dist.tarball dist.integrity --json \ - > "$evidence_root/openclaw-2026.8.1-beta.1-package.json" - -env -i \ - HOME="$seed_home" \ - PATH="$PATH" \ - OPENCLAW_HOME="$seed_home" \ - OPENCLAW_STATE_DIR="$seed_state" \ - OPENCLAW_CONFIG_PATH="$seed_state/openclaw.json" \ - npm_config_cache="$npm_cache" \ - npm view openclaw@2026.8.1-beta.2 version dist.tarball dist.integrity --json \ - > "$evidence_root/openclaw-2026.8.1-beta.2-package.json" - -stable_prefix="$fixture_root/stable-prefix" -env -i \ - HOME="$seed_home" \ - PATH="$PATH" \ - OPENCLAW_HOME="$seed_home" \ - OPENCLAW_STATE_DIR="$seed_state" \ - OPENCLAW_CONFIG_PATH="$seed_state/openclaw.json" \ - npm_config_cache="$npm_cache" \ - npm install \ - --prefix "$stable_prefix" \ - --omit=dev \ - --no-save \ - --package-lock=false \ - openclaw@2026.8.1-beta.1 \ - > "$evidence_root/stable-fixture-install.log" 2>&1 - -seed_database="$seed_state/state/openclaw.sqlite" -if [ ! -f "$seed_database" ]; then - echo "stable package did not create the credential-free state database" >&2 - exit 1 -fi -node "$db_meta_script" "$seed_database" > "$evidence_root/seed-schema6.json" -seed_version=$(node "$db_meta_script" "$seed_database" userVersion) -if [ "$seed_version" != "6" ]; then - echo "expected the beta.1 fixture to use schema 6; got $seed_version" >&2 - exit 1 -fi -# Keep the package-created schema intact. This is a native schema-6 migration -# comparison, not an attempted reconstruction of the historical schema-7 home. -write_fixture_config -node "$db_meta_script" "$seed_database" > "$evidence_root/seed-before.json" - -run_lane() { - lane_name=$1 - ocm_binary=$2 - environment_mode=$3 - expected_change=$4 - lane_root="$evidence_root/$lane_name" - lane_home="$lane_root/home" - lane_state="$lane_home/.openclaw" - lane_database="$lane_state/state/openclaw.sqlite" - lane_config="$lane_state/openclaw.json" - lane_ocm_home="$lane_root/ocm" - lane_tmp="$lane_root/tmp" - lane_service_state="$lane_root/source-service-state" - lane_service_marker="$lane_service_state/plugin-runtime-deps/sentinel" - mkdir -p "$lane_home" "$lane_ocm_home" "$lane_tmp" - mkdir -p "$(dirname "$lane_service_marker")" - printf 'caller service state\n' > "$lane_service_marker" - cp -a "$seed_home/." "$lane_home/" - - node "$db_meta_script" "$lane_database" > "$lane_root/before.json" - sha256sum "$lane_database" > "$lane_root/before.sha256" - sha256sum "$lane_config" > "$lane_root/before-config.sha256" - before_hash=$(cut -d ' ' -f 1 "$lane_root/before.sha256") - before_config_hash=$(cut -d ' ' -f 1 "$lane_root/before-config.sha256") - before_service_hash=$(sha256sum "$lane_service_marker" | cut -d ' ' -f 1) - before_version=$(node "$db_meta_script" "$lane_database" userVersion) - if [ "$before_version" != "6" ]; then - echo "$lane_name did not start at the package-created schema 6" >&2 - exit 1 - fi - - if [ "$environment_mode" = "caller" ]; then - printf 'env -i HOME=/%s/home OCM_HOME=/%s/ocm TMPDIR=/%s/tmp PATH= STATE_DIRECTORY=/%s/source-service-state runtime install --version 2026.8.1-beta.2 --json\n' \ - "$lane_name" "$lane_name" "$lane_name" "$lane_name" > "$lane_root/command.txt" - env -i \ - HOME="$lane_home" \ - OCM_HOME="$lane_ocm_home" \ - TMPDIR="$lane_tmp" \ - PATH="$PATH" \ - STATE_DIRECTORY="$lane_service_state" \ - "$ocm_binary" runtime install --version 2026.8.1-beta.2 --json \ - > "$lane_root/ocm.stdout.json" 2> "$lane_root/ocm.stderr.txt" - elif [ "$environment_mode" = "explicit" ]; then - postinstall_home="$lane_root/postinstall-home" - postinstall_state="$postinstall_home/.openclaw" - mkdir -p "$postinstall_state" - printf 'env -i HOME=/%s/home OCM_HOME=/%s/ocm TMPDIR=/%s/tmp PATH= OPENCLAW_HOME=/%s/postinstall-home OPENCLAW_STATE_DIR=/%s/postinstall-home/.openclaw OPENCLAW_CONFIG_PATH=/%s/postinstall-home/.openclaw/openclaw.json STATE_DIRECTORY=/%s/postinstall-home/.openclaw runtime install --version 2026.8.1-beta.2 --json\n' \ - "$lane_name" "$lane_name" "$lane_name" "$lane_name" "$lane_name" "$lane_name" "$lane_name" \ - > "$lane_root/command.txt" - env -i \ - HOME="$lane_home" \ - OCM_HOME="$lane_ocm_home" \ - TMPDIR="$lane_tmp" \ - PATH="$PATH" \ - OPENCLAW_HOME="$postinstall_home" \ - OPENCLAW_STATE_DIR="$postinstall_state" \ - OPENCLAW_CONFIG_PATH="$postinstall_state/openclaw.json" \ - STATE_DIRECTORY="$postinstall_state" \ - "$ocm_binary" runtime install --version 2026.8.1-beta.2 --json \ - > "$lane_root/ocm.stdout.json" 2> "$lane_root/ocm.stderr.txt" - else - echo "$lane_name has unknown environment mode: $environment_mode" >&2 - exit 1 - fi - - node "$db_meta_script" "$lane_database" > "$lane_root/after.json" - sha256sum "$lane_database" > "$lane_root/after.sha256" - sha256sum "$lane_config" > "$lane_root/after-config.sha256" - after_hash=$(cut -d ' ' -f 1 "$lane_root/after.sha256") - after_config_hash=$(cut -d ' ' -f 1 "$lane_root/after-config.sha256") - after_version=$(node "$db_meta_script" "$lane_database" userVersion) - after_service_hash=missing - if [ -f "$lane_service_marker" ]; then - after_service_hash=$(sha256sum "$lane_service_marker" | cut -d ' ' -f 1) - fi - - if [ "$expected_change" = "source" ]; then - if [ "$after_version" != "8" ] || [ "$before_hash" = "$after_hash" ] || \ - [ "$before_service_hash" = "$after_service_hash" ]; then - echo "$lane_name did not reproduce the source mutation" >&2 - exit 1 - fi - result="reproduced-source-mutation" - else - if [ "$after_version" != "6" ] || [ "$before_hash" != "$after_hash" ] || \ - [ "$before_config_hash" != "$after_config_hash" ] || \ - [ "$before_service_hash" != "$after_service_hash" ]; then - echo "$lane_name control source changed unexpectedly" >&2 - exit 1 - fi - result="source-unchanged" - fi - - printf '{\n "lane": "%s",\n "environmentMode": "%s",\n "expectedChange": "%s",\n "result": "%s",\n "beforeVersion": %s,\n "afterVersion": %s,\n "sourceHashChanged": %s,\n "sourceConfigHashChanged": %s,\n "sourceServiceStateChanged": %s\n}\n' \ - "$lane_name" \ - "$environment_mode" \ - "$expected_change" \ - "$result" \ - "$before_version" \ - "$after_version" \ - "$([ "$before_hash" = "$after_hash" ] && printf false || printf true)" \ - "$([ "$before_config_hash" = "$after_config_hash" ] && printf false || printf true)" \ - "$([ "$before_service_hash" = "$after_service_hash" ] && printf false || printf true)" \ - > "$lane_root/result.json" -} - -run_lane v0.2.32 "$legacy_ocm" caller source -run_lane fixed-current "$current_ocm" caller unchanged -run_lane explicit-path-control "$legacy_ocm" explicit unchanged - -printf 'OCM #98 clean-room reproduction completed.\n' > "$evidence_root/complete.txt"