Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
refactor(view): the roadmap header cache lives with its summary [N26]
Corey Olson0ae731ea818a
diff --git a/src/cockpit.js b/src/cockpit.jsindex d4896bb7..89106565 100644--- a/src/cockpit.js+++ b/src/cockpit.js@@ -22,7 +22,7 @@ import {hostedState,} from './view/hosted.js';import { staleChip } from './view/stale.js';-import { roadmapSummary } from './view/roadmap-summary.js';+import { roadmapHeaders, roadmapSummary } from './view/roadmap-summary.js';import { roadmapBlock } from './view/roadmap-block.js';import { applyStateDelta } from './api-http.js';@@ -603,7 +603,7 @@ function shoutAgentName(id) {}/** Render a review note with escaped text and references bound to the selected board. */const verdictHtml = (v, titles) => '<div class="verdict ' + (v.decision === 'ACCEPT' ? 'yes' : 'no') + '"><b>' + esc(v.decision) + ' ' + esc(v.reason) + '</b><span class="by">' + esc(agentName(v.by)) + ' · ' + when(v.at) + ' · at ' + esc(String(v.commit || '').slice(0, 12)) + '</span><div class="note">' + inline(visibleVerdictNote(v.reason, v.note), titles) + '</div></div>';-const roadmapSummary = (${roadmapSummary.toString()});+const roadmapSummary = (${roadmapSummary.toString()}), roadmapHeaders = (${roadmapHeaders.toString()});const stateOf = (i) => i.status === 'claimed' ? 'building' : i.status === 'submitted' ? 'verify' : i.status === 'verified' ? 'verified' : i.status === 'withdrawn' ? 'withdrawn' : i.verdict && i.verdict.decision === 'REJECT' ? 'back' : 'open';const STATES = { building: ['building', 'busy'], verify: ['to verify', 'warn'], back: ['sent back', 'no'], verified: ['verified', 'ok'], open: ['unclaimed', 'free'], withdrawn: ['withdrawn', ''] };const chip = (s) => '<span class="chip ' + STATES[s][1] + '">' + STATES[s][0] + '</span>';@@ -2355,16 +2355,7 @@ function roadmapCards(p, titles) {const isOpen = (key, first) => view.roadmapOpen.has(JSON.stringify([view.root, key])) ? view.roadmapOpen.get(JSON.stringify([view.root, key])) : first;const caret = '<span class="caret" aria-hidden="true"></span>';const next = coming.find((m) => m.rows.length) || null;- const summaryHeaders = new Map();- /** Reuse the supplied summary across its header, body and companion panel. */- const headerFor = (read) => {- if (!read) return null;- if (!summaryHeaders.has(read)) summaryHeaders.set(read, roadmapSummary(read.milestone, { time: when, lookup: (id) => {- const label = typeof id === 'number' ? '#' + id : String(id), row = read.rows.find((row) => row.label === label);- return row ? { label, title: row.title, id: row.open?.id, address: row.open ? itemAddress(row.open.id, row.open.root) : null, board: row.open?.root !== view.root ? row.open?.root : null } : null;- } }));- return summaryHeaders.get(read);- };+ const headerFor = roadmapHeaders(roadmapSummary, { time: when, address: itemAddress, root: view.root });const stages = [['open', 'Open'], ['claimed', 'Building'], ['submitted', 'In review'], ['accepted', 'Accepted'], ['merged', 'Landed']];const counts = headerFor(next) ? null : Object.fromEntries(stages.map(([stage]) => [stage, next ? next.rows.filter((row) => row.stage === stage).length : 0]));const shippingCounts = headerFor(next)diff --git a/src/view/roadmap-summary.js b/src/view/roadmap-summary.jsindex 1eb76f0c..736b2ead 100644--- a/src/view/roadmap-summary.js+++ b/src/view/roadmap-summary.js@@ -29,3 +29,23 @@ export function roadmapSummary(milestone, context = {}) {}).join(', ') : '';return { count, detail: '<div class="roadmap-summary">'+bar+legend+meta+(needs?'<div class="roadmap-summary-needs"><b>Needs you:</b> '+needs+'</div>':'')+'</div>' };}++/**+ * The header for each milestone read, made once and reused across its header, body and companion panel [N26]. Why here:+ * the page embeds this source, so it keeps src/cockpit.js inside its line cap; the page hands in what it reads by.+ *+ * @param {(milestone: object, context: object) => object|null} summarize - roadmapSummary.+ * @param {{time: (iso: string) => string, address: (id: number, root: string) => string, root: string}} page+ * @returns {(read: {milestone: object, rows: object[]}|null) => object|null}+ */+export function roadmapHeaders(summarize, page) {+ const made = new Map();+ return (read) => {+ if (!read) return null;+ if (!made.has(read)) made.set(read, summarize(read.milestone, { time: page.time, lookup: (id) => {+ const label = typeof id === 'number' ? '#' + id : String(id), row = read.rows.find((row) => row.label === label);+ return row ? { label, title: row.title, id: row.open?.id, address: row.open ? page.address(row.open.id, row.open.root) : null, board: row.open?.root !== page.root ? row.open?.root : null } : null;+ } }));+ return made.get(read);+ };+}