runs: list survives a damaged run record (#1551)

Row 82 round 2, owner Rocko, candidate manifest dbf36e92 on 876f1ffe.
Approved by Filbert (27650); Sage's gate green 02:05-02:09Z.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-11 21:13:56 -05:00
co-authored by Claude Opus 5.5
parent 0e6c944bd9
commit 0a9692aebd
3 changed files with 40 additions and 7 deletions
+7 -6
View File
@@ -470,18 +470,19 @@ function readRuns(read) {
function listRuns() {
const resolved = loadConfig();
for (const { runId, result } of readRuns(() => listRunRecords(resolved.dataRoot))) {
// An incomplete or unreadable run record (result null) reports as unknown.
// An incomplete or unreadable run record (result null) reports as unknown,
// and so does each field of a damaged one that isn't a string.
let status = "unknown";
let taskId = "-";
let workspace = "-";
let session = "-";
if (result) {
status = result.status;
taskId = result.taskId;
workspace = result.workspace ?? "-";
session = result.session ?? "-";
if (typeof result.status === "string") status = result.status;
if (typeof result.taskId === "string") taskId = result.taskId;
if (typeof result.workspace === "string") workspace = result.workspace;
if (typeof result.session === "string") session = result.session;
}
process.stdout.write(`${runId} ${status.padEnd(9)} task=${taskId.padEnd(18)} ws=${String(workspace).padEnd(10)} session=${session}\n`);
process.stdout.write(`${runId} ${status.padEnd(9)} task=${taskId.padEnd(18)} ws=${workspace.padEnd(10)} session=${session}\n`);
}
}