fix(qa-lab): version UI assets from repo root · openclaw/openclaw@fd13192
vincentkoc
·
2026-06-22
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -90,9 +90,12 @@ function listUiAssetFiles(rootDir: string, currentDir = rootDir): string[] {
|
90 | 90 | return files; |
91 | 91 | } |
92 | 92 | |
93 | | -export function resolveUiAssetVersion(overrideDir?: string | null): string | null { |
| 93 | +export function resolveUiAssetVersion( |
| 94 | +overrideDir?: string | null, |
| 95 | +repoRoot = process.cwd(), |
| 96 | +): string | null { |
94 | 97 | try { |
95 | | -const distDir = resolveUiDistDir(overrideDir); |
| 98 | +const distDir = resolveUiDistDir(overrideDir, repoRoot); |
96 | 99 | const indexPath = path.join(distDir, "index.html"); |
97 | 100 | if (!fs.existsSync(indexPath) || !fs.statSync(indexPath).isFile()) { |
98 | 101 | return null; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -11,6 +11,7 @@ import {
|
11 | 11 | writeQaLabServerError, |
12 | 12 | type QaLabServerStartParams, |
13 | 13 | } from "./lab-server.js"; |
| 14 | +import { resolveUiAssetVersion } from "./lab-server-ui.js"; |
14 | 15 | |
15 | 16 | const qaChannelMock = vi.hoisted(() => ({ |
16 | 17 | resolveAccount: vi.fn(), |
@@ -819,6 +820,12 @@ describe("qa-lab server", () => {
|
819 | 820 | expect(rootResponse.status).toBe(200); |
820 | 821 | expect(await rootResponse.text()).toContain("repo-root-ui"); |
821 | 822 | |
| 823 | +const versionResponse = await fetchWithRetry(`${lab.baseUrl}/api/ui-version`); |
| 824 | +expect(versionResponse.status).toBe(200); |
| 825 | +const versionPayload = (await versionResponse.json()) as { version?: string | null }; |
| 826 | +expect(versionPayload.version).toBe(resolveUiAssetVersion(null, repoRoot)); |
| 827 | +expect(versionPayload.version).toMatch(/^[0-9a-f]{12}$/); |
| 828 | + |
822 | 829 | const runnerCatalog = await waitForRunnerCatalog(lab.baseUrl); |
823 | 830 | expect(runnerCatalog.status).toBe("ready"); |
824 | 831 | const tempModel = runnerCatalog.real.find((model) => model.key === "anthropic/qa-temp-model"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -446,7 +446,7 @@ export async function startQaLabServer(
|
446 | 446 | "content-type": "application/json; charset=utf-8", |
447 | 447 | "cache-control": "no-store", |
448 | 448 | }); |
449 | | -res.end(JSON.stringify({ version: resolveUiAssetVersion(params?.uiDistDir) })); |
| 449 | +res.end(JSON.stringify({ version: resolveUiAssetVersion(params?.uiDistDir, repoRoot) })); |
450 | 450 | return; |
451 | 451 | } |
452 | 452 | if (req.method === "GET" && url.pathname === "/api/outcomes") { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。