New packages/runs reads run records, result.json, the release pointer
and the activation log without writing, pruning or following a link out
of the data root. mosaic-task.mjs list and show use it, so a malformed
result.json or a run that is a regular file no longer crashes them.
Deliberate deltas are listed in the README.
Rocko built it. Round 1 (ed3c5392) was approved with notes by Darkwing
(27115) and Filbert (27116); round 2 (2727198f, tests and wording only)
was approved by Darkwing (27123) and Filbert (27124). Sage's gate on
c9a25a47 plus the candidate: runs 41/0, queue 148/0, webui 22/0,
conversation 182/0 (181/1 in the full run on the K12 cgroup timing
test under load, 182/0 alone), control-board 124/0, every
scripts/test-*.sh 0 failed (task 98/0 with Docker, 26/0 without).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
61 lines
1.8 KiB
JavaScript
61 lines
1.8 KiB
JavaScript
import fs from "node:fs";
|
|
import os from "node:os";
|
|
import path from "node:path";
|
|
|
|
// A fresh scratch directory for one test, removed after it. Returns
|
|
// { dir, dataRoot, outside }: the data root and a sibling outside it.
|
|
export function scratch(t) {
|
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "mosaic-runs-test-"));
|
|
t.after(() => fs.rmSync(dir, { recursive: true, force: true }));
|
|
const dataRoot = path.join(dir, "data");
|
|
const outside = path.join(dir, "outside");
|
|
fs.mkdirSync(dataRoot);
|
|
fs.mkdirSync(outside);
|
|
return { dir, dataRoot, outside };
|
|
}
|
|
|
|
export function write(file, content) {
|
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
fs.writeFileSync(file, typeof content === "string" ? content : `${JSON.stringify(content)}\n`);
|
|
}
|
|
|
|
// A listing of every path under dir with its type, size, mtime and link
|
|
// target, to show that a reader changed nothing.
|
|
export function tree(dir) {
|
|
const lines = [];
|
|
const walk = (current) => {
|
|
for (const name of fs.readdirSync(current).sort()) {
|
|
const file = path.join(current, name);
|
|
const stat = fs.lstatSync(file);
|
|
const link = stat.isSymbolicLink() ? fs.readlinkSync(file) : "";
|
|
lines.push(`${path.relative(dir, file)} ${stat.mode} ${stat.size} ${stat.mtimeMs} ${link}`);
|
|
if (stat.isDirectory()) walk(file);
|
|
}
|
|
};
|
|
walk(dir);
|
|
return lines.join("\n");
|
|
}
|
|
|
|
export const RESULT = {
|
|
runVersion: 1,
|
|
runId: "r-20260101T000000Z-aaaaaa",
|
|
taskId: "t-one",
|
|
missionId: null,
|
|
status: "succeeded",
|
|
reason: null,
|
|
request: "hi",
|
|
response: "hi",
|
|
expectedExact: null,
|
|
workspace: null,
|
|
tools: null,
|
|
session: null,
|
|
sessionForkFrom: null,
|
|
exitCode: 0,
|
|
signal: null,
|
|
provider: "zai",
|
|
model: "m",
|
|
startedAt: "2026-01-01T00:00:00.000Z",
|
|
finishedAt: "2026-01-01T00:00:01.000Z",
|
|
durationMs: 1000,
|
|
};
|