fix: remove v0.2 caserun runtime fallback
This commit is contained in:
@@ -9,6 +9,9 @@ import { artifactsFromKeilStatusForTest, extractKeilJobId, jobStatusCommandForTe
|
||||
|
||||
const SUBJECT_COMMIT_ID = "df7a4e6e551fa90d64bde5537cc000f89d63dd20";
|
||||
const SUBJECT_REPO_LOCAL_PATH = "F:\\Work\\HWLAB-CASE-F103";
|
||||
const TEST_RUNTIME_API_URL = "http://api.test";
|
||||
const TEST_RUNTIME_WEB_URL = "http://web.test";
|
||||
const TEST_RUNTIME_ENV = { HWLAB_RUNTIME_API_URL: TEST_RUNTIME_API_URL, HWLAB_RUNTIME_WEB_URL: TEST_RUNTIME_WEB_URL };
|
||||
|
||||
test("hwlab-cli case prepare copies a case hwpod-spec into isolated run state", async () => {
|
||||
const root = await mkdtempCaseRoot();
|
||||
@@ -24,7 +27,7 @@ test("hwlab-cli case prepare copies a case hwpod-spec into isolated run state",
|
||||
await writeFile(path.join(caseDir, "hwpod-spec.yaml"), hwpodSpecText(), "utf8");
|
||||
|
||||
const requests: any[] = [];
|
||||
const result = await runHwlabCli(["case", "prepare", "d601-f103-v2-compile", "--case-repo", caseRepo, "--run-id", "run-test"], { cwd, now: () => "2026-06-05T00:00:00.000Z", fetchImpl: subjectWorktreeFetch(requests) });
|
||||
const result = await runHwlabCli(["case", "prepare", "d601-f103-v2-compile", "--case-repo", caseRepo, "--run-id", "run-test"], { cwd, now: () => "2026-06-05T00:00:00.000Z", env: TEST_RUNTIME_ENV, fetchImpl: subjectWorktreeFetch(requests) });
|
||||
|
||||
assert.equal(result.exitCode, 0);
|
||||
assert.equal(result.payload.action, "case.prepare.prepare");
|
||||
@@ -57,6 +60,40 @@ test("hwlab-cli case prepare copies a case hwpod-spec into isolated run state",
|
||||
}
|
||||
});
|
||||
|
||||
test("case prepare requires an explicit v0.3 runtime API URL", async () => {
|
||||
const root = await mkdtempCaseRoot();
|
||||
const caseRepo = path.join(root, "hwlab-case-registry");
|
||||
const cwd = path.join(root, "hwlab");
|
||||
try {
|
||||
await createCaseRepo(caseRepo, "d601-f103-v2-compile");
|
||||
await mkdir(cwd, { recursive: true });
|
||||
|
||||
const result = await runHwlabCli(["case", "prepare", "d601-f103-v2-compile", "--case-repo", caseRepo], { cwd, now: () => "2026-06-05T00:00:00.000Z" });
|
||||
|
||||
assert.equal(result.exitCode, 1);
|
||||
assert.equal(result.payload.error.code, "caserun_runtime_api_url_required");
|
||||
} finally {
|
||||
await rm(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("case prepare rejects the removed v0.2 runtime API URL", async () => {
|
||||
const root = await mkdtempCaseRoot();
|
||||
const caseRepo = path.join(root, "hwlab-case-registry");
|
||||
const cwd = path.join(root, "hwlab");
|
||||
try {
|
||||
await createCaseRepo(caseRepo, "d601-f103-v2-compile");
|
||||
await mkdir(cwd, { recursive: true });
|
||||
|
||||
const result = await runHwlabCli(["case", "prepare", "d601-f103-v2-compile", "--case-repo", caseRepo], { cwd, now: () => "2026-06-05T00:00:00.000Z", env: { HWLAB_RUNTIME_API_URL: "http://74.48.78.17:19667" } });
|
||||
|
||||
assert.equal(result.exitCode, 1);
|
||||
assert.equal(result.payload.error.code, "caserun_removed_v02_runtime_url");
|
||||
} finally {
|
||||
await rm(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("case prepare rejects legacy subject repo/ref without a local repo path and commit id", async () => {
|
||||
const root = await mkdtempCaseRoot();
|
||||
const caseRepo = path.join(root, "hwlab-case-registry");
|
||||
@@ -70,7 +107,7 @@ test("case prepare rejects legacy subject repo/ref without a local repo path and
|
||||
await writeFile(path.join(caseDir, "case.json"), JSON.stringify({ contractVersion: "hwpod-case-v1", caseId: "legacy-case", hwpodSpec: "hwpod-spec.yaml", subject: { repo: "git@github.com:pikasTech/D601-HWLAB.git", ref: "main" } }, null, 2), "utf8");
|
||||
await writeFile(path.join(caseDir, "hwpod-spec.yaml"), hwpodSpecText(), "utf8");
|
||||
|
||||
const result = await runHwlabCli(["case", "prepare", "legacy-case", "--case-repo", caseRepo], { cwd, now: () => "2026-06-05T00:00:00.000Z", fetchImpl: subjectWorktreeFetch([]) });
|
||||
const result = await runHwlabCli(["case", "prepare", "legacy-case", "--case-repo", caseRepo], { cwd, now: () => "2026-06-05T00:00:00.000Z", env: TEST_RUNTIME_ENV, fetchImpl: subjectWorktreeFetch([]) });
|
||||
|
||||
assert.equal(result.exitCode, 1);
|
||||
assert.equal(result.payload.error.code, "subject_repo_local_path_required");
|
||||
@@ -90,7 +127,7 @@ test("case prepare uses the new registry by default and refuses the removed hwpo
|
||||
await createCaseRepo(removedRepo, caseId);
|
||||
await mkdir(cwd, { recursive: true });
|
||||
|
||||
const defaultResult = await runHwlabCli(["case", "prepare", caseId, "--run-id", "run-default"], { cwd, now: () => "2026-06-05T00:00:00.000Z", fetchImpl: subjectWorktreeFetch([]) });
|
||||
const defaultResult = await runHwlabCli(["case", "prepare", caseId, "--run-id", "run-default"], { cwd, now: () => "2026-06-05T00:00:00.000Z", env: TEST_RUNTIME_ENV, fetchImpl: subjectWorktreeFetch([]) });
|
||||
assert.equal(defaultResult.exitCode, 0);
|
||||
assert.equal(defaultResult.payload.caseRepo, newRepo);
|
||||
|
||||
@@ -123,7 +160,7 @@ test("case prompt previews the real assembled prompt in Chinese without starting
|
||||
}, null, 2), "utf8");
|
||||
await writeFile(path.join(caseDir, "hwpod-spec.yaml"), hwpodSpecText(), "utf8");
|
||||
|
||||
const result = await runHwlabCli(["case", "prompt", "d601-f103-v2-prompt-preview", "--case-repo", caseRepo, "--run-id", "run-prompt-preview"], { cwd, now: () => "2026-06-08T00:00:00.000Z" });
|
||||
const result = await runHwlabCli(["case", "prompt", "d601-f103-v2-prompt-preview", "--case-repo", caseRepo, "--run-id", "run-prompt-preview"], { cwd, now: () => "2026-06-08T00:00:00.000Z", env: TEST_RUNTIME_ENV });
|
||||
|
||||
assert.equal(result.exitCode, 0);
|
||||
assert.equal(result.payload.action, "case.prompt");
|
||||
@@ -190,6 +227,7 @@ test("case run start returns immediately and status/result/logs are short pollin
|
||||
], {
|
||||
cwd,
|
||||
now: () => "2026-06-05T00:00:00.000Z",
|
||||
env: TEST_RUNTIME_ENV,
|
||||
startProcess: async (input) => {
|
||||
workerArgs = input.args;
|
||||
await writeFile(input.stdoutPath, "worker accepted\n", "utf8");
|
||||
@@ -328,7 +366,6 @@ test("case run orchestrates agent prompt, diff capture, and compile evidence wit
|
||||
hwpodSpec: "hwpod-spec.yaml",
|
||||
subject: { repoLocalPath: SUBJECT_REPO_LOCAL_PATH, commitId: SUBJECT_COMMIT_ID, subdir: "projects/01_baseline" },
|
||||
agentTask: { workspace: "subjectWorktree", prompt: "请通过 HWPOD 做一个很小的源码修改。", timeoutMs: 234000, pollIntervalMs: 10 },
|
||||
runtime: { apiUrl: "http://api.test", webUrl: "http://web.test" }
|
||||
}, null, 2), "utf8");
|
||||
await writeFile(path.join(caseDir, "hwpod-spec.yaml"), hwpodSpecText(), "utf8");
|
||||
|
||||
@@ -367,7 +404,7 @@ test("case run orchestrates agent prompt, diff capture, and compile evidence wit
|
||||
await writeFile(path.join(runDir, "worker.stderr.log"), "", "utf8");
|
||||
sawAgentRunningState = true;
|
||||
},
|
||||
env: { HWLAB_API_KEY: "hwl_live_test_case_agent_key" },
|
||||
env: { ...TEST_RUNTIME_ENV, HWLAB_API_KEY: "hwl_live_test_case_agent_key" },
|
||||
runProcess: async (command) => {
|
||||
runProcessCalls.push(command);
|
||||
const gitArgs = command.slice(1);
|
||||
@@ -594,6 +631,11 @@ test("case run archives rendered trace transcript when finalResponse is null", a
|
||||
{ traceId: "trc_final_null", seq: 2, label: "item/commandExecution:completed", type: "tool_call", toolName: "commandExecution", status: "completed", command: "/bin/sh -lc 'hwpod build --spec .hwlab/hwpod-spec.yaml'", stdoutSummary: "build completed", exitCode: 0, createdAt: "2026-06-06T00:00:02.000Z" },
|
||||
{ traceId: "trc_final_null", seq: 3, label: "agentrun:terminal:failed", type: "result", terminal: true, status: "failed", message: "Error running remote compact task: unexpected status 404 Not Found", createdAt: "2026-06-06T00:00:03.000Z" }
|
||||
],
|
||||
rows: [
|
||||
{ rowId: "trace-assistant:1", seq: 1, tone: "source", header: "00:00:01 助手消息", body: "我先检查当前 HWPOD。" },
|
||||
{ rowId: "tool:build", seq: 2, tone: "ok", header: "00:00:02 ok commandExecution", bodyFormat: "text", body: "hwpod build --spec .hwlab/hwpod-spec.yaml\nstdout:\nbuild completed\nexitCode=0" },
|
||||
{ rowId: "trace-terminal:3", seq: 3, tone: "blocked", header: "00:00:03 终止失败", terminal: true, body: "Error running remote compact task: unexpected status 404 Not Found" }
|
||||
],
|
||||
error: { message: "Error running remote compact task: unexpected status 404 Not Found" }
|
||||
};
|
||||
const evidence = {
|
||||
@@ -604,7 +646,7 @@ test("case run archives rendered trace transcript when finalResponse is null", a
|
||||
autoEvaluation: false,
|
||||
status: "recorded",
|
||||
subject: run.subject,
|
||||
agent: { traceId: "trc_final_null", sessionId: "ses_final_null", conversationId: "cnv_final_null", threadId: "thread-final-null", providerProfile: "deepseek", projectId: "prj_hwpod_workbench", promptSha256: "prompt-sha" },
|
||||
agent: { traceId: "trc_final_null", baseUrl: TEST_RUNTIME_WEB_URL, sessionId: "ses_final_null", conversationId: "cnv_final_null", threadId: "thread-final-null", providerProfile: "deepseek", projectId: "prj_hwpod_workbench", promptSha256: "prompt-sha" },
|
||||
agentTrace: run.agentTrace,
|
||||
agentDiff: run.agentDiff,
|
||||
hwpod: { source: "case-run-runner-post-agent-compile-check", exitCode: 0 },
|
||||
@@ -705,7 +747,7 @@ test("case aggregate writes one registry markdown entry without grading or broad
|
||||
runId,
|
||||
runDir: "/root/hwlab-v02/.state/hwlab-cli/caserun/case04-completed-run",
|
||||
caseRepo,
|
||||
apiUrl: "http://74.48.78.17:19667",
|
||||
apiUrl: TEST_RUNTIME_API_URL,
|
||||
compileOnly: true,
|
||||
createdAt: "2026-06-08T00:00:00.000Z",
|
||||
completedAt: "2026-06-08T00:10:00.000Z",
|
||||
|
||||
Reference in New Issue
Block a user