From d9053f791988699a8a31c52138de8deaf81505f3 Mon Sep 17 00:00:00 2001 From: repo-worker-tmp-code-b Date: Thu, 19 Nov 2026 17:02:42 -0600 Subject: [PATCH 1/2] pm-stack: add roadmap priorities and release surfaces --- pm-stack/aggregator/src/model.ts | 4 ++ pm-stack/aggregator/src/render.ts | 58 ++++++++++++++++++------- pm-stack/aggregator/src/server.ts | 9 ++++ pm-stack/aggregator/test/render.test.ts | 25 +++++++++++ 4 files changed, 81 insertions(+), 15 deletions(-) diff --git a/pm-stack/aggregator/src/model.ts b/pm-stack/aggregator/src/model.ts index ecb299d4eb..e672f69b81 100644 --- a/pm-stack/aggregator/src/model.ts +++ b/pm-stack/aggregator/src/model.ts @@ -243,6 +243,10 @@ export interface RoadmapRow { source: string; notes: string; links: Link[]; + /** Genealogy overlay from the Project pool; absent when no linked item resolves. */ + priority?: RefKey | null; + afterRefs?: RefKey[]; + releaseRef?: RefKey | null; /** Grist UI link for this row's document (#1136), when known. */ gristUrl?: string; /** Repo-file link for this row's source file + heading (#1738), when diff --git a/pm-stack/aggregator/src/render.ts b/pm-stack/aggregator/src/render.ts index ffabecd385..1710b4f958 100644 --- a/pm-stack/aggregator/src/render.ts +++ b/pm-stack/aggregator/src/render.ts @@ -26,6 +26,7 @@ import { } from "./derive.ts"; import type { RoadmapReconciliation } from "./roadmap-reconcile.ts"; import type { RoadmapAnnotation } from "./roadmap-annotations.ts"; +import type { ReleaseSnapshot } from "./releases.ts"; import { diffCoverage, staleIssueState, type CoverageSnapshotFile } from "./coverage.ts"; import { DIGEST_SECTION_LIMIT, type Digest, type DigestKind } from "./digest.ts"; import { registryQueryString, type RegistryView } from "./registry-view.ts"; @@ -1857,6 +1858,7 @@ function roadmapCard( briefs?: Map, forecasts?: Map, spend?: SpendCardsView | null, + epicRollups?: Map, ): string { const refs = allRefs([row]); const refBadges = refs @@ -1868,6 +1870,8 @@ function roadmapCard( const grist = row.gristUrl ? ` Grist ↗` : ""; const repoFile = row.fileUrl ? ` Repo file ↗` : ""; const expansion = drill ? roadmapDrilldown(drill, row, forecasts, spend) : ""; + const epicRollup = epicRollups?.get(row.subject); + const rollupHtml = epicRollup ? epicRollupHtml(epicRollup) : ""; const notes = annotations?.get(row.subject) ?? []; const annotationHtml = notes.length ? `
${notes.map(roadmapAnnotationHtml).join("")}
` @@ -1893,7 +1897,7 @@ function roadmapCard( } } } - return `
${esc(row.title)}${cmt}
${esc(row.status)} ${esc(row.area)} · ${esc(row.horizon)}${horizonWarning}${statusClash}${refBadges}${grist}${repoFile}${annotationHtml}${expansion}${briefPanels}
`; + return `
${esc(row.title)}${cmt}
${esc(row.status)} ${esc(row.area)} · ${esc(row.horizon)}${horizonWarning}${statusClash}${refBadges}${grist}${repoFile}${rollupHtml}${annotationHtml}${expansion}${briefPanels}
`; } function roadmapAnnotationHtml(annotation: RoadmapAnnotation): string { @@ -1909,6 +1913,7 @@ function timelineTable( briefs?: Map, forecasts?: Map, spend?: SpendCardsView | null, + epicRollups?: Map, ): string { const head = `Theme${tl.lanes.map((l) => `${esc(l.label)}`).join("")}`; const body = tl.themes @@ -1918,7 +1923,7 @@ function timelineTable( const cells = tl.lanes .map((lane) => { const rs = tl.cells.get(theme)?.get(lane.key) ?? []; - return `${rs.map((r) => roadmapCard(r, items, counts, drill?.get(r.subject), annotations, briefs, forecasts, spend)).join("")}`; + return `${rs.map((r) => roadmapCard(r, items, counts, drill?.get(r.subject), annotations, briefs, forecasts, spend, epicRollups)).join("")}`; }) .join(""); return `${esc(theme)} (${done}/${themeRows.length} done)${cells}`; @@ -1942,6 +1947,8 @@ export function renderRoadmap( forecasts?: Map, flowAnalytics?: FlowAnalytics, spend?: SpendCardsView | null, + releases: ReleaseSnapshot[] = [], + prioritiesView = false, ): string { // #1144: when the Grist rows and the Project's Kind=Epic pool items // disagree, say so on the page itself — drift the reader can see, @@ -1952,16 +1959,30 @@ export function renderRoadmap( : reconciliation && reconciliation.drift > 0 ? `
Roadmap drift: ${reconciliation.unmatchedRows.length} Grist row${reconciliation.unmatchedRows.length === 1 ? "" : "s"} with no matching Project epic · ${reconciliation.unmatchedEpics.length} Project epic${reconciliation.unmatchedEpics.length === 1 ? "" : "s"} with no roadmap row (#1144 — the two roadmap sources disagree; both lists are in /api/roadmap.json).
` : ""; - const chips = GRAINS.map( + const chips = `${GRAINS.map( ([g, label]) => `${label}`, - ).join(""); + ).join("")} Priorities`; const invalidHorizons = rows.filter((row) => row.horizonError); const horizonFlag = invalidHorizons.length ? `
${invalidHorizons.length} roadmap row${invalidHorizons.length === 1 ? " has" : "s have"} an invalid Horizon value. Original values are preserved and marked on their cards; correct them in Grist using the documented Horizon grammar.
` : ""; let body: string; - if (grain === "quarter") { + if (prioritiesView) { + const ordered = [...rows].sort((a, b) => { + const rank = (row: RoadmapRow) => { + const match = /#(\d+)$/.exec(row.priority ?? ""); + return match ? Number(match[1]) : Number.MAX_SAFE_INTEGER; + }; + return rank(a) - rank(b) || a.title.localeCompare(b.title); + }); + body = ordered.length ? ordered.map((row) => { + const priority = row.priority ? `Priority ${esc(row.priority)}` : 'No priority link'; + const after = row.afterRefs?.length ? `After: ${row.afterRefs.map((ref) => `${esc(ref)}`).join(", ")}` : 'No predecessor recorded'; + const release = row.releaseRef ? `Release ${esc(row.releaseRef)}` : 'No release linked'; + return `
${esc(row.title)}
${priority} ${release}
${after}
${esc(row.area)} · ${esc(row.horizon)} · ${esc(row.status)}
`; + }).join("") : '

No priority rows in the current roadmap source.

'; + } else if (grain === "quarter") { body = timelineTable(buildTimeline(rows), items, counts, drill, annotations, briefs, forecasts, spend); } else if (grain === "month") { body = timelineTable(monthTimeline(rows), items, counts, drill, annotations, briefs, forecasts, spend); @@ -2001,9 +2022,17 @@ export function renderRoadmap( .join("") : '

No roadmap rows.

'; } + const releaseCards = releases.filter((release) => release.kind === "release").map((release) => { + const counts = release.counts; + const carried = release.carriedOverEpics.length + ? `

Carried-over epics: ${release.carriedOverEpics.map((ref) => `${esc(ref)}`).join(", ")}

` + : '

No carried-over epics.

'; + return `

${esc(release.milestone.title)}

Date: ${esc(release.releaseDate ?? "date not set")}

Issues: ${counts.issues.closed}/${counts.issues.total} closed · Designs: ${counts.designs.closed}/${counts.designs.total} closed · Epics: ${counts.epics.closed}/${counts.epics.total} closed

${carried}

${esc(release.descriptionLine)}

`; + }).join(""); + const releasesHtml = `

Releases

${releaseCards || '

No release close-out snapshots are available.

'}

Releases JSON

`; return layout( "Roadmap", - `

Roadmap

Grist's Program roadmap table at every grain — one data model, switchable horizon. Rows with a calendar date land on their day; quarter-labelled rows stay at quarter grain. Every row remains visible at every grain.

${chips}
${driftFlag}${horizonFlag}${body}${spend?.unattributed ? unattributedSpendHtml(spend.unattributed) : ""}${flowAnalytics ? flowChartsHtml(flowAnalytics) : ""}`, + `

Roadmap

Grist's Program roadmap table at every grain — one data model, switchable horizon. Rows with a calendar date land on their day; quarter-labelled rows stay at quarter grain. Every row remains visible at every grain.

${chips}
${driftFlag}${horizonFlag}${body}${releasesHtml}${spend?.unattributed ? unattributedSpendHtml(spend.unattributed) : ""}${flowAnalytics ? flowChartsHtml(flowAnalytics) : ""}`, provenance, "/roadmap", "", @@ -7813,15 +7842,14 @@ export function renderProgramProject( } else if (!detail.roadmapRows.length) { roadmapHtml = ``; } else { - const rows = detail.roadmapRows - .map((r) => { - const links = r.links - .map((l) => `${esc(l.ref)}`) - .join(" "); - return `
${esc(r.title)}
${esc(r.status)} ${esc(r.horizon)}${links ? ` ${links}` : ""}${r.notes ? `
${esc(r.notes)}` : ""}
💬 comments · roadmap
`; - }) - .join(""); - roadmapHtml = `

${detail.roadmapRows.length} row${detail.roadmapRows.length === 1 ? "" : "s"} with area ${esc(config.roadmapArea)} in Grist's Program roadmap.

${rows}`; + const rollups = buildEpicRollups(epicPool); + const rowRollups = new Map(); + for (const row of detail.roadmapRows) { + const epic = row.links.map((link) => epicPool.find((item) => item.ref === link.ref && item.kind === "Epic")).find(Boolean); + const rollup = epic ? rollups.get(epic.ref) : undefined; + if (rollup) rowRollups.set(row.subject, rollup); + } + roadmapHtml = `

${detail.roadmapRows.length} row${detail.roadmapRows.length === 1 ? "" : "s"} with area ${esc(config.roadmapArea)} in Grist's Program roadmap. Timeline lanes and drill-downs use the shared roadmap renderer; epic rollups are per matched row.

${timelineTable(buildTimeline(detail.roadmapRows), items, undefined, undefined, undefined, undefined, undefined, undefined, rowRollups)}`; } const repoCardsHtml = detail.repoCards.length diff --git a/pm-stack/aggregator/src/server.ts b/pm-stack/aggregator/src/server.ts index 09016e2329..d3688eedec 100644 --- a/pm-stack/aggregator/src/server.ts +++ b/pm-stack/aggregator/src/server.ts @@ -3398,6 +3398,15 @@ async function handler(req: Request): Promise { const { rows, items, reconciliation } = await roadmapContext(); const pool = await source.projects().catch(() => [] as ProjectPoolItem[]); const genealogyRows = enrichRoadmapRows(rows, pool); + if (url.searchParams.get("view") === "priorities") { + genealogyRows.sort((a, b) => { + const rank = (row: typeof a) => { + const match = /#(\d+)$/.exec(row.priority ?? ""); + return match ? Number(match[1]) : Number.MAX_SAFE_INTEGER; + }; + return rank(a) - rank(b) || a.title.localeCompare(b.title); + }); + } const resolved = await resolveView(url); if (!resolved) { const annotatedRows = await Promise.all( diff --git a/pm-stack/aggregator/test/render.test.ts b/pm-stack/aggregator/test/render.test.ts index 4e061a659b..10d04ecd5b 100644 --- a/pm-stack/aggregator/test/render.test.ts +++ b/pm-stack/aggregator/test/render.test.ts @@ -150,6 +150,31 @@ describe("roadmap timeline", () => { expect(laneFor("2026-10-24").key).toBe("2026-Q4"); expect(laneFor("Ongoing").key).toBe("ongoing"); }); + test("priorities view shows priority edges and release close-out cards", async () => { + const source = fixtureSource(); + const rows: RoadmapRow[] = [ + { ...FIXTURE_ROADMAP[0], title: "Later priority", priority: "developing-today/code#90", afterRefs: ["developing-today/code#80"], releaseRef: "developing-today/code#100" }, + { ...FIXTURE_ROADMAP[1], title: "Earlier priority", priority: "developing-today/code#10", afterRefs: [], releaseRef: null }, + ]; + const release = { + milestone: { title: "Program — release 1", dueOn: "2026-11-19", closedAt: "2026-11-19" }, + kind: "release" as const, + releaseDate: "2026-11-19", + counts: { + issues: { closed: 2, carriedOver: 1, total: 3 }, + designs: { closed: 1, carriedOver: 0, total: 1 }, + epics: { closed: 1, carriedOver: 1, total: 2 }, + total: { closed: 4, carriedOver: 2, total: 6 }, + }, + carriedOverEpics: ["developing-today/code#100"], + descriptionLine: "release snapshot", + }; + const html = renderRoadmap(rows, new Map(), source.provenance(), "quarter", undefined, undefined, undefined, undefined, undefined, "", undefined, undefined, undefined, null, [release], true); + expect(html.indexOf("Earlier priority")).toBeLessThan(html.indexOf("Later priority")); + expect(html).toContain("After:"); + expect(html).toContain("Program — release 1"); + expect(html).toContain("Carried-over epics:"); + }); }); describe("horizon calendar-date validation (#1628)", () => { From 063fb21a1933760e8ca8a5622bb261188c0d40de Mon Sep 17 00:00:00 2001 From: repo-worker-tmp-code-b Date: Thu, 19 Nov 2026 18:42:58 -0600 Subject: [PATCH 2/2] test(pm-stack): update 8723 regression pin for early pool fetch (genealogy) --- pm-stack/aggregator/test/roadmap-view-8723.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pm-stack/aggregator/test/roadmap-view-8723.test.ts b/pm-stack/aggregator/test/roadmap-view-8723.test.ts index 734cf4997b..4f7896c4c9 100644 --- a/pm-stack/aggregator/test/roadmap-view-8723.test.ts +++ b/pm-stack/aggregator/test/roadmap-view-8723.test.ts @@ -101,7 +101,7 @@ describe("roadmap handler wiring (#8723 regression pin)", () => { }); test("the unfiltered JSON branch stays untouched by view filtering", () => { - const unfiltered = jsonBlock.slice(0, jsonBlock.indexOf("const pool = await source.projects()")); + const unfiltered = jsonBlock.slice(jsonBlock.indexOf("if (!resolved)"), jsonBlock.indexOf("const poolByRef")); expect(unfiltered).toContain("items: [...items.values()]"); expect(unfiltered).not.toContain("filterRoadmapForView"); });