fix(matrix): clarify QA CLI artifact directory

This commit is contained in:
Gustavo Madeira Santana
2026-04-25 16:01:25 -04:00
parent 2c8a3df03d
commit 5ee1c086db
3 changed files with 9 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
import { describe, expect, it } from "vitest";
import {
formatMatrixQaCliCommand,
@@ -36,7 +36,7 @@ describe("Matrix QA CLI runtime", () => {
});
it("prefers the ESM OpenClaw CLI entrypoint when present", async () => {
const root = await mkdtemp(path.join(tmpdir(), "matrix-qa-cli-entry-"));
const root = await mkdtemp(path.join(resolvePreferredOpenClawTmpDir(), "matrix-qa-cli-entry-"));
try {
await mkdir(path.join(root, "dist"));
await writeFile(path.join(root, "dist", "index.mjs"), "");
@@ -47,7 +47,9 @@ describe("Matrix QA CLI runtime", () => {
});
it("can preserve expected non-zero CLI output for negative scenarios", async () => {
const root = await mkdtemp(path.join(tmpdir(), "matrix-qa-cli-nonzero-"));
const root = await mkdtemp(
path.join(resolvePreferredOpenClawTmpDir(), "matrix-qa-cli-nonzero-"),
);
try {
await mkdir(path.join(root, "dist"));
await writeFile(

View File

@@ -320,11 +320,11 @@ export async function createMatrixQaOpenClawCliRuntime(params: {
OPENCLAW_STATE_DIR: stateDir,
};
return {
artifactDir,
configPath,
dispose: async () => {
await rm(rootDir, { force: true, recursive: true });
},
rootDir: artifactDir,
run: async (
args: string[],
opts: { allowNonZero?: boolean; timeoutMs: number },

View File

@@ -286,10 +286,10 @@ async function writeMatrixQaCliArtifacts(params: {
result: MatrixQaCliRunResult;
runtime: MatrixQaCliRuntime;
}) {
await mkdir(params.runtime.rootDir, { mode: 0o700, recursive: true });
await mkdir(params.runtime.artifactDir, { mode: 0o700, recursive: true });
const safe = params.label.replace(/[^A-Za-z0-9_-]/g, "-");
const stdoutPath = path.join(params.runtime.rootDir, `${safe}.stdout.txt`);
const stderrPath = path.join(params.runtime.rootDir, `${safe}.stderr.txt`);
const stdoutPath = path.join(params.runtime.artifactDir, `${safe}.stdout.txt`);
const stderrPath = path.join(params.runtime.artifactDir, `${safe}.stderr.txt`);
await Promise.all([
writeFile(stdoutPath, redactMatrixQaCliOutput(params.result.stdout), { mode: 0o600 }),
writeFile(stderrPath, redactMatrixQaCliOutput(params.result.stderr), { mode: 0o600 }),