generated from coulomb/repo-seed
chore: close overview counts and review reliability workplans
This commit is contained in:
@@ -31,8 +31,8 @@ export function isOpenWorkstream(status) {
|
||||
return OPEN_WORKSTREAM_STATUSES.includes(normalizeWorkstreamStatus(status));
|
||||
}
|
||||
|
||||
export function isStalledWorkstream(w, staleDays = 7) {
|
||||
const staleAt = new Date(Date.now() - staleDays * 24 * 60 * 60 * 1000);
|
||||
export function isStalledWorkstream(w) {
|
||||
const staleAt = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
|
||||
const openTasks = (w.todo ?? 0) + (w.progress ?? 0) + (w.wait ?? 0);
|
||||
return ["active", "blocked"].includes(normalizeWorkstreamStatus(w.status))
|
||||
&& new Date(w.updated_at) < staleAt
|
||||
|
||||
@@ -225,7 +225,7 @@ function _workstreamsForMode(mode, rows) {
|
||||
return allRows.filter(w => normalizeWorkstreamStatus(w.status) === modeValue);
|
||||
}
|
||||
if (modeValue === "needs_review") return allRows.filter(needsReviewWorkstream);
|
||||
if (modeValue === "stalled") return allRows.filter(isStalledWorkstream);
|
||||
if (modeValue === "stalled") return allRows.filter(w => isStalledWorkstream(w));
|
||||
|
||||
const since = _timeCutoff(modeValue);
|
||||
if (!since) return allRows.filter(w => normalizeWorkstreamStatus(w.status) === "active");
|
||||
|
||||
45
dashboard/test/workplan-status.test.mjs
Normal file
45
dashboard/test/workplan-status.test.mjs
Normal file
@@ -0,0 +1,45 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
import {isStalledWorkstream} from "../src/components/workplan-status.js";
|
||||
|
||||
test("stalled workstream predicate is safe to pass to Array.filter", () => {
|
||||
const realNow = Date.now;
|
||||
Date.now = () => new Date("2026-06-07T15:00:00Z").getTime();
|
||||
|
||||
try {
|
||||
const rows = [
|
||||
{
|
||||
title: "stale active",
|
||||
status: "active",
|
||||
updated_at: "2026-05-20T12:00:00Z",
|
||||
done: 1,
|
||||
progress: 1,
|
||||
todo: 0,
|
||||
wait: 0,
|
||||
},
|
||||
{
|
||||
title: "fresh active",
|
||||
status: "active",
|
||||
updated_at: "2026-06-06T12:00:00Z",
|
||||
done: 1,
|
||||
progress: 1,
|
||||
todo: 0,
|
||||
wait: 0,
|
||||
},
|
||||
{
|
||||
title: "stale finished",
|
||||
status: "finished",
|
||||
updated_at: "2026-05-20T12:00:00Z",
|
||||
done: 2,
|
||||
progress: 0,
|
||||
todo: 0,
|
||||
wait: 0,
|
||||
},
|
||||
];
|
||||
|
||||
assert.deepEqual(rows.filter(isStalledWorkstream).map(w => w.title), ["stale active"]);
|
||||
} finally {
|
||||
Date.now = realNow;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user