Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions pm-stack/aggregator/src/sources/live.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,8 @@ const normTitle = (s: string): string =>
* - repeats inside the section itself (the same task lined up under
* two goals, or twice under one) emit once, keyed by first ref,
* else by normalized title.
* Only parseRef-accepted refs participate; invalid candidates are logged
* and otherwise behave as absent.
* Tasks with no ref anywhere still emit (title only, no GitHub link).
*/
export function inFlightBoardItems(section: OrchestrationSection, existing: BoardItem[]): BoardItem[] {
Expand All @@ -628,10 +630,16 @@ export function inFlightBoardItems(section: OrchestrationSection, existing: Boar
if (item.linedUpStatus !== "in-progress" && item.linedUpStatus !== "queued" && item.linedUpStatus !== "blocked")
continue;
const refs: RefKey[] = [];
const add = (ref: RefKey) => {
const add = (ref: unknown) => {
if (!isValidRef(ref)) {
console.error(
`[board] WARNING: dropping invalid in-flight ref ${JSON.stringify(ref)} for task ${item.id}`,
);
return;
}
if (!refs.includes(ref)) refs.push(ref);
};
if (item.ref) add(item.ref);
if (item.ref !== undefined && item.ref !== null && item.ref !== "") add(item.ref);
for (const ref of titleRefs(item.title)) add(ref);
const remainingRefs = refs.filter((ref) => !existingRefs.has(ref));
if (refs.length > 0 && remainingRefs.length === 0) continue;
Expand Down
92 changes: 90 additions & 2 deletions pm-stack/aggregator/test/board-in-flight.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test";
import type { BoardItem, GhItem, OrchestrationSection, Provenance } from "../src/model.ts";
import { describe, expect, spyOn, test } from "bun:test";
import type { BoardItem, GhItem, OrchestrationSection, Provenance, RefKey } from "../src/model.ts";
import { renderBoard } from "../src/render.ts";
import { inFlightBoardItems, titleRefs } from "../src/sources/live.ts";

Expand Down Expand Up @@ -89,7 +89,7 @@
titleRefs(
"nix #889 blocked on developing-today-forks/kaneo#42; openchamber #492 mirrors https://github.com/developing-today/opencode/issues/927",
),
).toEqual([

Check failure on line 92 in pm-stack/aggregator/test/board-in-flight.test.ts

View workflow job for this annotation

GitHub Actions / aggregator + projector + dispatch + python suites

error: expect(received).toEqual(expected)

[ "developing-today/opencode#927", "developing-today-forks/kaneo#42", "dezren39/nix#889", - "developing-today/openchamber#492", + "developing-today-forks/openchamber#492", ] - Expected - 1 + Received + 1 at <anonymous> (/home/runner/work/code/code/pm-stack/aggregator/test/board-in-flight.test.ts:92:7)
"developing-today/opencode#927",
"developing-today-forks/kaneo#42",
"dezren39/nix#889",
Expand Down Expand Up @@ -130,6 +130,94 @@
);
expect(out).toHaveLength(1);
expect(out[0].links).toEqual([{ ref: "developing-today/code#958", relation: "tracks" }]);
expect(out[0].repo).toBe("developing-today/code");
});

test("a goal-id ref is dropped and the task remains title-only with a trace", () => {
const trace = spyOn(console, "error").mockImplementation(() => {});
try {
const out = inFlightBoardItems(
section([task("Goal-level planning", "in-progress", { ref: "goal_a243772844c3" as RefKey })]),
[],
);

expect(out).toHaveLength(1);
expect(out[0].repo).toBe("");
expect(out[0].links).toEqual([]);
expect(trace).toHaveBeenCalledWith(expect.stringContaining("dropping invalid in-flight ref"));
} finally {
trace.mockRestore();
}
});

test("a non-string ref is dropped and the task remains title-only", () => {
const trace = spyOn(console, "error").mockImplementation(() => {});
try {
const out = inFlightBoardItems(
section([task("Numeric external ref", "queued", { ref: 12345 as unknown as RefKey })]),
[],
);

expect(out).toHaveLength(1);
expect(out[0].repo).toBe("");
expect(out[0].links).toEqual([]);
expect(trace).toHaveBeenCalledWith(expect.stringContaining("dropping invalid in-flight ref"));
} finally {
trace.mockRestore();
}
});

test("a bare-number ref is dropped and the task remains title-only", () => {
const trace = spyOn(console, "error").mockImplementation(() => {});
try {
const out = inFlightBoardItems(
section([task("Bare-number external ref", "queued", { ref: "812" as RefKey })]),
[],
);

expect(out).toHaveLength(1);
expect(out[0].repo).toBe("");
expect(out[0].links).toEqual([]);
expect(trace).toHaveBeenCalledWith(expect.stringContaining("dropping invalid in-flight ref"));
} finally {
trace.mockRestore();
}
});

test("an unsafe title-derived GitHub number is dropped", () => {
const trace = spyOn(console, "error").mockImplementation(() => {});
try {
const out = inFlightBoardItems(section([task("code #9007199254740992 needs follow-up", "queued")]), []);

expect(out).toHaveLength(1);
expect(out[0].repo).toBe("");
expect(out[0].links).toEqual([]);
expect(trace).toHaveBeenCalledWith(expect.stringContaining("dropping invalid in-flight ref"));
} finally {
trace.mockRestore();
}
});

test("a poisoned ref does not hide healthy tasks in the same lane", () => {
const trace = spyOn(console, "error").mockImplementation(() => {});
try {
const out = inFlightBoardItems(
section([
task("Healthy linked work", "in-progress", { ref: "developing-today/code#958" }),
task("Poisoned title-only work", "queued", { ref: "goal_a243772844c3" as RefKey }),
]),
[],
);

expect(out.map((item) => item.title)).toEqual(["Healthy linked work", "Poisoned title-only work"]);
expect(out[0].repo).toBe("developing-today/code");
expect(out[0].links).toEqual([{ ref: "developing-today/code#958", relation: "tracks" }]);
expect(out[1].repo).toBe("");
expect(out[1].links).toEqual([]);
expect(trace).toHaveBeenCalledWith(expect.stringContaining("dropping invalid in-flight ref"));
} finally {
trace.mockRestore();
}
});

test("dedupes matched refs and ref-less title matches against Kaneo cards", () => {
Expand All @@ -156,7 +244,7 @@
]);

expect(out).toHaveLength(1);
expect(out[0].links.map((link) => link.ref)).toEqual(["developing-today/openchamber#492"]);

Check failure on line 247 in pm-stack/aggregator/test/board-in-flight.test.ts

View workflow job for this annotation

GitHub Actions / aggregator + projector + dispatch + python suites

error: expect(received).toEqual(expected)

[ - "developing-today/openchamber#492", + "developing-today-forks/openchamber#492", ] - Expected - 1 + Received + 1 at <anonymous> (/home/runner/work/code/code/pm-stack/aggregator/test/board-in-flight.test.ts:247:50)
expect(out[0].repo).toBe("developing-today/openchamber");
});

Expand Down Expand Up @@ -210,7 +298,7 @@
const by944 = out.find((i) => i.title.includes("#944"));
expect(by944?.links.map((l) => l.ref)).toContain("developing-today/code#985");
expect(out.find((i) => i.title.includes("#889"))?.repo).toBe("dezren39/nix");
expect(out.find((i) => i.title.includes("#492"))?.links.map((l) => l.ref)).toEqual([

Check failure on line 301 in pm-stack/aggregator/test/board-in-flight.test.ts

View workflow job for this annotation

GitHub Actions / aggregator + projector + dispatch + python suites

error: expect(received).toEqual(expected)

[ - "developing-today/openchamber#492", + "developing-today-forks/openchamber#492", ] - Expected - 1 + Received + 1 at <anonymous> (/home/runner/work/code/code/pm-stack/aggregator/test/board-in-flight.test.ts:301:80)
"developing-today/openchamber#492",
]);
});
Expand Down Expand Up @@ -268,7 +356,7 @@
]);
const html = renderBoard([...lane, ...existing], items, provenance);

expect(html).toContain('href="https://github.com/developing-today/openchamber/issues/492"');

Check failure on line 359 in pm-stack/aggregator/test/board-in-flight.test.ts

View workflow job for this annotation

GitHub Actions / aggregator + projector + dispatch + python suites

error: expect(received).toContain(expected)

Expected to contain: "href=\"https://github.com/developing-today/openchamber/issues/492\"" Received: "<!doctype html>\n<html lang=\"en\" data-theme=\"dark\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>Cross-repo WIP board · aggregator</title><link rel=\"manifest\" href=\"/manifest.webmanifest\"><meta name=\"theme-color\" content=\"#161b22\"><meta name=\"mobile-web-app-capable\" content=\"yes\"><meta name=\"apple-mobile-web-app-capable\" content=\"yes\"><meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\"><meta name=\"apple-mobile-web-app-title\" content=\"PM Stack\"><link rel=\"apple-touch-icon\" href=\"/icons/apple-touch-icon.png\"><script>try{var __pmTheme=localStorage.getItem('pm-theme');if(__pmTheme==='light'||__pmTheme==='dark')document.documentElement.setAttribute('data-theme',__pmTheme);}catch(e){}</script><link rel=\"stylesheet\" href=\"/assets/app.css\"><script type=\"module\" src=\"/assets/datastar.js\"></script></head>\n<body><nav class=\"navbar bg-base-200 shadow-md flex-wrap items-center gap-x-3 px-4\"><span class=\"navgroup\" data-current=\"true\"><span class=\"navlabel\">Overview</span><a href=\"/\">Overview</a><a href=\"/today\">Today</a><a href=\"/attention\">Needs you</a><a href=\"/roadmap\">Roadmap</a></span><span class=\"navgroup\"><span class=\"navlabel\">Work</span><a href=\"/program\">Program status</a><a href=\"/queue\">Queue</a></span><span class=\"navgroup\"><span class=\"navlabel\">Ops</span><a href=\"/quota\">Usage &amp; billing</a><a href=\"/health\">Health</a><a href=\"/alerts\">Alerts</a></span><select aria-label=\"Go to page\" class=\"select select-bordered select-sm\" data-on:change=\"if (evt.target.value) { window.location.href = evt.target.value; }\"><option value=\"\">Pages ▾</option><optgroup label=\"Overview\"><option value=\"/\">Overview — The stack front door (#1134): needs-you, projects, quotas, and health at a glance.</option><option value=\"/today\">Today — The day&#39;s top objectives + per-project momentum.</option><option value=\"/digest\">Digest — The scheduled PM digest (#1278): moved / blocked / needs Drew / done / quota outlook from the canonical projection, archived per day at /digest?date=&lt;date&gt;.</option><option value=\"/attention\">Needs you — NEEDS USER vs NEEDS ORCHESTRATOR, and every live session.</option><option value=\"/board\" selected>Board — The curated cross-repo WIP board.</option><option value=\"/roadmap\">Roadmap — The program roadmap at every grain.</option></optgroup><optgroup label=\"Work\"><option value=\"/conflicts\">Source conflicts — One read-only queue of every live source disagreement, with both values and its age.</option><option value=\"/sessions\">Sessions — The agent/session identity registry: who ran what, tokens, task links.</option><option value=\"/search\">Search — Search board and roadmap work by title or linked issue/PR ref.</option><option value=\"/events\">Events — The cross-stack chronological stream of dashboard actions, orchestration publishes, and session outcomes.</option><option value=\"/comments\">Comments queue — Dashboard comments still waiting on a loop (#1210): messages awaiting triage and GitHub comments pending or failed to post, with kind/state counts and each failed item&#39;s last error.</option><option value=\"/program\">Program status — The projects hub: every project&#39;s status, roadmap, and tracked work, one page per project under /program/&lt;id&gt; — fed from the project registry, the tracked issues, and the Project pool.</option><option value=\"/queue\">Queue — In progress, blocked, recently completed, and next-up work across projects.</option></optgroup><optgroup label=\"Ops\"><option value=\"/quota\">Usage &amp; billing — Token quotas, PAYG dollars, and every SaaS service&#39;s usage vs its limits.</option><option value=\"/dns\">DNS register — Every domain: next renewal, unused, earmarked. (#902&#39;s register)</option><option value=\"/aa\">Cost Explorer — Two tabs over th
expect(html.match(/href="https:\/\/github.com\/developing-today\/openchamber\/issues\/492"/g)).toHaveLength(1);
expect(html.match(/href="https:\/\/github.com\/developing-today\/code\/issues\/944"/g)).toHaveLength(1);
});
Expand Down
Loading