From d8fcaa8f6375aff59894fba241c020af9a363ee3 Mon Sep 17 00:00:00 2001 From: simoneschiavoi <314799283+simoneschiavoi@users.noreply.github.com> Date: Fri, 9 Oct 2026 14:23:13 +0200 Subject: [PATCH 1/2] test(e2e): accept aligned inference get columns in live switch target The live OpenClaw inference-switch target asserted exact single-space Provider and Model substrings against `nemoclaw inference get` output, but the CLI renders aligned label columns, so the target failed on terminal padding without a provider or inference change. Match the labeled fields with one-or-more-space tolerance instead; the exact rendering contract stays owned by src/lib/actions/inference-get.test.ts. Signed-off-by: simoneschiavoi <314799283+simoneschiavoi@users.noreply.github.com> --- test/e2e/live/openclaw-inference-switch.test.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/e2e/live/openclaw-inference-switch.test.ts b/test/e2e/live/openclaw-inference-switch.test.ts index 055ad7f9cbe..751c6523641 100644 --- a/test/e2e/live/openclaw-inference-switch.test.ts +++ b/test/e2e/live/openclaw-inference-switch.test.ts @@ -533,6 +533,10 @@ async function openclawGatewayPid(sandbox: SandboxClient, home: string): Promise return result.stdout.trim(); } +function escapeRegExp(value: string): string { + return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} + async function getRouteOutput(host: HostCliClient, home: string): Promise { return runNemoclaw(host, home, ["inference", "get"], { artifactName: "nemoclaw-inference-get-after-switch", @@ -1315,8 +1319,10 @@ test( const route = await getRouteOutput(host, home); expect(route.exitCode, resultText(route)).toBe(0); const plainRoute = stripAnsi(resultText(route)); - expect(plainRoute).toContain(`Provider: ${SWITCH_PROVIDER}`); - expect(plainRoute).toContain(`Model: ${SWITCH_MODEL}`); + // The CLI aligns the label columns; the exact rendering contract is owned by + // src/lib/actions/inference-get.test.ts, so accept one or more spaces here. + expect(plainRoute).toMatch(new RegExp(`Provider: +${escapeRegExp(SWITCH_PROVIDER)}\\b`)); + expect(plainRoute).toMatch(new RegExp(`Model: +${escapeRegExp(SWITCH_MODEL)}\\b`)); await assertOpenClawConfig(sandbox, home, { model: SWITCH_MODEL, inferenceApi: SWITCH_INFERENCE_API, From 5c2b5b5325181db6b0d340fc2b973712323c19bf Mon Sep 17 00:00:00 2001 From: simoneschiavoi <314799283+simoneschiavoi@users.noreply.github.com> Date: Fri, 9 Oct 2026 14:40:30 +0200 Subject: [PATCH 2/2] test(e2e): anchor inference get route values to line boundaries CodeRabbit review on #12911: word-boundary anchors let suffixed values pass because a hyphen already ends a word. Require each displayed value to end at a newline or end of output instead. Signed-off-by: simoneschiavoi <314799283+simoneschiavoi@users.noreply.github.com> --- test/e2e/live/openclaw-inference-switch.test.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/e2e/live/openclaw-inference-switch.test.ts b/test/e2e/live/openclaw-inference-switch.test.ts index 751c6523641..e6dea8ab0b7 100644 --- a/test/e2e/live/openclaw-inference-switch.test.ts +++ b/test/e2e/live/openclaw-inference-switch.test.ts @@ -1320,9 +1320,12 @@ test( expect(route.exitCode, resultText(route)).toBe(0); const plainRoute = stripAnsi(resultText(route)); // The CLI aligns the label columns; the exact rendering contract is owned by - // src/lib/actions/inference-get.test.ts, so accept one or more spaces here. - expect(plainRoute).toMatch(new RegExp(`Provider: +${escapeRegExp(SWITCH_PROVIDER)}\\b`)); - expect(plainRoute).toMatch(new RegExp(`Model: +${escapeRegExp(SWITCH_MODEL)}\\b`)); + // src/lib/actions/inference-get.test.ts, so accept one or more spaces here and + // require each displayed value to end at the line boundary. + expect(plainRoute).toMatch( + new RegExp(`Provider: +${escapeRegExp(SWITCH_PROVIDER)}(?:\\r?\\n|$)`), + ); + expect(plainRoute).toMatch(new RegExp(`Model: +${escapeRegExp(SWITCH_MODEL)}(?:\\r?\\n|$)`)); await assertOpenClawConfig(sandbox, home, { model: SWITCH_MODEL, inferenceApi: SWITCH_INFERENCE_API,