From 0b612372b2eae6ed412392c9f745e6a225d75cc7 Mon Sep 17 00:00:00 2001 From: repo-worker-tmp-code-b Date: Thu, 19 Nov 2026 19:16:47 -0600 Subject: [PATCH] fix(pm-stack): preserve program timeline notes --- pm-stack/aggregator/src/render.ts | 14 ++++++++---- pm-stack/aggregator/test/program.test.ts | 28 +++++++++++++++++++++++- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/pm-stack/aggregator/src/render.ts b/pm-stack/aggregator/src/render.ts index 1710b4f958..dc7216ec55 100644 --- a/pm-stack/aggregator/src/render.ts +++ b/pm-stack/aggregator/src/render.ts @@ -1859,6 +1859,7 @@ function roadmapCard( forecasts?: Map, spend?: SpendCardsView | null, epicRollups?: Map, + showRowNotes = false, ): string { const refs = allRefs([row]); const refBadges = refs @@ -1870,6 +1871,11 @@ function roadmapCard( const grist = row.gristUrl ? ` Grist ↗` : ""; const repoFile = row.fileUrl ? ` Repo file ↗` : ""; const expansion = drill ? roadmapDrilldown(drill, row, forecasts, spend) : ""; + // The program timeline has no drill map; keep its Notes visible without + // duplicating the same text when a card already has a drilldown. + const rowNotes = showRowNotes && !drill && row.notes.trim() + ? `

${esc(row.notes)}

` + : ""; const epicRollup = epicRollups?.get(row.subject); const rollupHtml = epicRollup ? epicRollupHtml(epicRollup) : ""; const notes = annotations?.get(row.subject) ?? []; @@ -1897,7 +1903,7 @@ function roadmapCard( } } } - return `
${esc(row.title)}${cmt}
${esc(row.status)} ${esc(row.area)} · ${esc(row.horizon)}${horizonWarning}${statusClash}${refBadges}${grist}${repoFile}${rollupHtml}${annotationHtml}${expansion}${briefPanels}
`; + return `
${esc(row.title)}${cmt}
${esc(row.status)} ${esc(row.area)} · ${esc(row.horizon)}${horizonWarning}${statusClash}${refBadges}${grist}${repoFile}${rollupHtml}${annotationHtml}${rowNotes}${expansion}${briefPanels}
`; } function roadmapAnnotationHtml(annotation: RoadmapAnnotation): string { @@ -1913,7 +1919,7 @@ function timelineTable( briefs?: Map, forecasts?: Map, spend?: SpendCardsView | null, - epicRollups?: Map, + options?: { epicRollups?: Map; showRowNotes?: boolean }, ): string { const head = `Theme${tl.lanes.map((l) => `${esc(l.label)}`).join("")}`; const body = tl.themes @@ -1923,7 +1929,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, epicRollups)).join("")}`; + return `${rs.map((r) => roadmapCard(r, items, counts, drill?.get(r.subject), annotations, briefs, forecasts, spend, options?.epicRollups, options?.showRowNotes)).join("")}`; }) .join(""); return `${esc(theme)} (${done}/${themeRows.length} done)${cells}`; @@ -7849,7 +7855,7 @@ export function renderProgramProject( 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)}`; + 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, { epicRollups: rowRollups, showRowNotes: true })}`; } const repoCardsHtml = detail.repoCards.length diff --git a/pm-stack/aggregator/test/program.test.ts b/pm-stack/aggregator/test/program.test.ts index a475d8bf01..168d957d60 100644 --- a/pm-stack/aggregator/test/program.test.ts +++ b/pm-stack/aggregator/test/program.test.ts @@ -14,7 +14,7 @@ import { type ProjectRepoCard, } from "../src/project-config.ts"; import { buildProgramData, buildProgramLive, PROGRAM, programRefs, TRACKED_REFS } from "../src/program.ts"; -import { projectsBodyHtml, renderProgram, renderProgramProject } from "../src/render.ts"; +import { projectsBodyHtml, renderProgram, renderProgramProject, renderRoadmap } from "../src/render.ts"; import { FIXTURE_ROADMAP, fixtureSource } from "../src/sources/fixtures.ts"; const PROV: Provenance = { @@ -496,6 +496,32 @@ describe("project registry", () => { // --- Per-project pages (#1121) -------------------------------------------------- describe("renderProgramProject", () => { + test("program timeline keeps escaped notes and reference text without changing the shared default (#12078)", () => { + const config = projectConfigById("pm-dashboard")!; + const base = FIXTURE_ROADMAP.find((row) => row.area === config.roadmapArea)!; + const notes = 'See https://github.com/example/widget/pull/42 & "notes"'; + const escaped = "See https://github.com/example/widget/pull/42 & <legacy> "notes""; + const row = { ...base, notes, links: [] }; + const blank = { ...row, id: 9001, subject: "grist:blank", title: "Blank notes row", notes: " " }; + const other = { ...row, id: 9002, subject: "grist:other", area: "Other", notes: "Other area notes" }; + const items = new Map(); + const html = renderProgramProject(buildProjectDetail(config, items, [], [row, blank, other]), items, PROV); + + // Oracle: the old project card showed Notes as escaped text, not + // parsed markup or a substitute link badge. + expect(html).toContain("Roadmap timeline by theme"); + expect(html).toContain("Blank notes row"); + expect(html).toContain('

' + escaped + '

'); + expect(html.split('

')).toHaveLength(2); + expect(html).not.toContain(notes); + expect(html).not.toContain("Other area notes"); + expect(renderRoadmap([row], items, PROV)).not.toContain(escaped); + const drill = new Map([[row.subject, { children: [] }]]); + const sharedHtml = renderRoadmap([row], items, PROV, "quarter", undefined, undefined, undefined, drill); + expect(sharedHtml).toContain('

' + escaped + '

'); + expect(sharedHtml.split('

')).toHaveLength(2); + }); + test("every configured project renders from fixtures, nulls stated honestly", async () => { const src = fixtureSource(); const items = await src.items(allProjectRefs());