perf(ci): unblock node compat and trim runtime compat test

This commit is contained in:
Peter Steinberger
2026-04-22 06:30:59 +01:00
parent dc4e97472d
commit 0a670a058d
4 changed files with 127 additions and 52 deletions

View File

@@ -244,17 +244,6 @@ jobs:
runNode
? [
{ check_name: "checks-node-channels", runtime: "node", task: "channels" },
...(isPush
? [
{
check_name: "checks-node-compat-node22",
runtime: "node",
task: "compat-node22",
node_version: "22.18.0",
cache_key_suffix: "node22",
},
]
: []),
]
: [],
),
@@ -914,12 +903,7 @@ jobs:
fail-fast: false
matrix: ${{ fromJson(needs.preflight.outputs.checks_matrix) }}
steps:
- name: Skip compatibility lanes on pull requests
if: github.event_name == 'pull_request' && matrix.task == 'compat-node22'
run: echo "Skipping push-only lane on pull requests."
- name: Checkout
if: github.event_name != 'pull_request' || matrix.task != 'compat-node22'
shell: bash
env:
CHECKOUT_REPO: ${{ github.repository }}
@@ -968,7 +952,6 @@ jobs:
exit 1
- name: Setup Node environment
if: github.event_name != 'pull_request' || matrix.task != 'compat-node22'
uses: ./.github/actions/setup-node-env
with:
node-version: "${{ matrix.node_version || '24.x' }}"
@@ -976,7 +959,7 @@ jobs:
install-bun: "false"
- name: Configure Node test resources
if: (github.event_name != 'pull_request' || matrix.task != 'compat-node22') && matrix.runtime == 'node' && (matrix.task == 'test' || matrix.task == 'channels' || matrix.task == 'compat-node22')
if: matrix.runtime == 'node' && (matrix.task == 'test' || matrix.task == 'channels')
env:
TASK: ${{ matrix.task }}
run: |
@@ -1004,7 +987,6 @@ jobs:
path: src/canvas-host/a2ui/
- name: Run ${{ matrix.task }} (${{ matrix.runtime }})
if: github.event_name != 'pull_request' || matrix.task != 'compat-node22'
env:
TASK: ${{ matrix.task }}
NODE_OPTIONS: --max-old-space-size=6144
@@ -1018,19 +1000,89 @@ jobs:
channels)
pnpm test:channels
;;
compat-node22)
pnpm build
pnpm ui:build
node openclaw.mjs --help
node openclaw.mjs status --json --timeout 1
pnpm test:build:singleton
;;
*)
echo "Unsupported checks task: $TASK" >&2
exit 1
;;
esac
checks-node-compat:
permissions:
contents: read
name: checks-node-compat-node22
needs: [preflight]
if: needs.preflight.outputs.run_node == 'true' && github.event_name == 'push'
runs-on: ${{ github.repository == 'openclaw/openclaw' && 'blacksmith-16vcpu-ubuntu-2404' || 'ubuntu-24.04' }}
timeout-minutes: 60
steps:
- name: Checkout
shell: bash
env:
CHECKOUT_REPO: ${{ github.repository }}
CHECKOUT_SHA: ${{ github.sha }}
CHECKOUT_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
workdir="$GITHUB_WORKSPACE"
auth_header="$(printf 'x-access-token:%s' "$CHECKOUT_TOKEN" | base64 | tr -d '\n')"
reset_checkout_dir() {
mkdir -p "$workdir"
find "$workdir" -mindepth 1 -maxdepth 1 -exec rm -rf {} +
}
checkout_attempt() {
local attempt="$1"
reset_checkout_dir
git init "$workdir" >/dev/null
git config --global --add safe.directory "$workdir"
git -C "$workdir" remote add origin "https://github.com/${CHECKOUT_REPO}"
git -C "$workdir" config gc.auto 0
timeout --signal=TERM 30s git -C "$workdir" \
-c protocol.version=2 \
-c "http.https://github.com/.extraheader=AUTHORIZATION: basic ${auth_header}" \
fetch --no-tags --prune --no-recurse-submodules --depth=1 origin \
"+${CHECKOUT_SHA}:refs/remotes/origin/ci-target" || return 1
git -C "$workdir" checkout --force --detach "$CHECKOUT_SHA" || return 1
test -f "$workdir/.github/actions/setup-node-env/action.yml" || return 1
echo "checkout attempt ${attempt}/2 succeeded"
}
for attempt in 1 2; do
if checkout_attempt "$attempt"; then
exit 0
fi
echo "checkout attempt ${attempt}/2 failed"
sleep $((attempt * 5))
done
echo "checkout failed after 2 attempts" >&2
exit 1
- name: Setup Node environment
uses: ./.github/actions/setup-node-env
with:
node-version: "22.18.0"
cache-key-suffix: "node22"
install-bun: "false"
- name: Configure Node test resources
run: echo "OPENCLAW_VITEST_MAX_WORKERS=2" >> "$GITHUB_ENV"
- name: Run Node 22 compatibility
env:
NODE_OPTIONS: --max-old-space-size=6144
run: |
pnpm build
pnpm ui:build
node openclaw.mjs --help
node openclaw.mjs status --json --timeout 1
pnpm test:build:singleton
checks-node-core-test-nondist-shard:
permissions:
contents: read

View File

@@ -38,6 +38,25 @@ describe("setup promotion helpers", () => {
expect(getBundledChannelPluginMock).not.toHaveBeenCalled();
});
it("keeps WhatsApp static promotion cheap even when named accounts already exist", () => {
const keys = resolveSingleAccountKeysToMove({
channelKey: "whatsapp",
channel: {
accounts: {
work: { enabled: true },
},
dmPolicy: "allowlist",
allowFrom: ["+15551234567"],
groupPolicy: "allowlist",
groupAllowFrom: ["group-123"],
},
});
expect(keys).toEqual(["dmPolicy", "allowFrom", "groupPolicy", "groupAllowFrom"]);
expect(getLoadedChannelPluginMock).toHaveBeenCalledWith("whatsapp");
expect(getBundledChannelPluginMock).not.toHaveBeenCalled();
});
it("loads bundled setup only for non-static migration keys", () => {
getBundledChannelPluginMock.mockReturnValue({
setup: {

View File

@@ -49,10 +49,18 @@ type ChannelSetupPromotionSurface = {
}) => string | undefined;
};
const BUNDLED_CHANNELS_WITHOUT_SETUP_PROMOTION_SURFACE = new Set(["whatsapp"]);
function getChannelSetupPromotionSurface(
channelKey: string,
opts?: { loadBundledFallback?: boolean },
): ChannelSetupPromotionSurface | null {
if (
opts?.loadBundledFallback &&
BUNDLED_CHANNELS_WITHOUT_SETUP_PROMOTION_SURFACE.has(channelKey)
) {
return getLoadedChannelPlugin(channelKey)?.setup ?? null;
}
const setup =
getLoadedChannelPlugin(channelKey)?.setup ??
(opts?.loadBundledFallback ? getBundledChannelPlugin(channelKey)?.setup : undefined);

View File

@@ -2,10 +2,10 @@ import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { loadConfig } from "./config.js";
import { applyRuntimeLegacyConfigMigrations } from "../commands/doctor/shared/runtime-compat-api.js";
import { createConfigIO } from "./io.js";
import { normalizeExecSafeBinProfilesInConfig } from "./normalize-exec-safe-bin.js";
import { withTempHomeConfig } from "./test-helpers.js";
import type { OpenClawConfig } from "./types.openclaw.js";
async function withTempHome(run: (home: string) => Promise<void>): Promise<void> {
const home = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-config-"));
@@ -115,34 +115,30 @@ describe("config io paths", () => {
expect(cfg.agents?.list?.[0]?.tools?.exec?.safeBinTrustedDirs).toEqual(["/ops/bin"]);
});
it("moves WhatsApp shared access defaults into accounts.default during loadConfig() runtime compat", async () => {
await withTempHomeConfig(
{
channels: {
whatsapp: {
enabled: true,
dmPolicy: "allowlist",
allowFrom: ["+15550001111"],
groupPolicy: "open",
groupAllowFrom: [],
accounts: {
work: {
enabled: true,
authDir: "/tmp/wa-work",
},
},
},
},
},
async () => {
const loaded = loadConfig();
expect(loaded.channels?.whatsapp?.accounts?.default).toMatchObject({
it("moves WhatsApp shared access defaults into accounts.default during runtime compat", () => {
const migrated = applyRuntimeLegacyConfigMigrations({
channels: {
whatsapp: {
enabled: true,
dmPolicy: "allowlist",
allowFrom: ["+15550001111"],
groupPolicy: "open",
groupAllowFrom: [],
});
accounts: {
work: {
enabled: true,
authDir: "/tmp/wa-work",
},
},
},
},
);
});
const next = migrated.next as OpenClawConfig | null;
expect(next?.channels?.whatsapp?.accounts?.default).toMatchObject({
dmPolicy: "allowlist",
allowFrom: ["+15550001111"],
groupPolicy: "open",
groupAllowFrom: [],
});
});
});