From dd1d307816d27e09515ad85d5ee55c096b27b5c4 Mon Sep 17 00:00:00 2001 From: Muse Sweep Date: Tue, 27 Oct 2026 03:42:39 +0000 Subject: [PATCH] feat(aggregator): /program hub + per-project pages for all projects (#1120, #1121) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Project registry (src/project-config.ts): one ProjectConfig per project — id/title/intro, poolArea, roadmapArea, homeDoc, dashboardLinks, trackedRefs, optional architecture + editorial — with pure validateProjectConfigs (duplicate ids/areas, malformed refs) asserted clean over the shipped registry in tests. The pm-dashboard PROGRAM migrates into the registry as its entry (same object references, no content loss); its designRecordUrl now points at the real file (dir/same-named .md). /program becomes the projects index: one card per project with LIVE pool counts by status and roadmap row counts, the whole-pool summary and orchestration freshness from #1046, and the unset-Area pool count as a visible gap. /program/ renders per project: intro + home-doc/dashboard links, tracked issues resolved live (unresolved stays unresolved), its Area's pool items grouped by status, its roadmap area's Grist rows, editorial done/next/long-term/gaps, and honest gap banners for null poolArea/roadmapArea/homeDoc. JSON twins: /api/program.json gains per-project summaries (existing pm fields unchanged); new /api/program-project.json?id= (404 JSON for unknown id); unknown /program/ gets a clean not-found page. Starter editorial for lab-cluster (project-structure spec seed: 12 epics with horizons, hard rules, nothing installed yet), id (Phase 12 path from planning/roadmaps/id.md), repo-fleet (four repos + #911), mcpx (planning/roadmaps/mcpx.md; tracked refs verified open via gh), cloud-program (/quota hub + account campaign; Plaid/Citi gap stated). Depth stays in #1124-#1128. README: /program + /program/ views rows, the add-a-project registry recipe, project-config.ts in the layout list (#1123 parts that belong with this PR). Also fixes a pre-existing-on-main test failure: render.test.ts expected 16 Grist seed rows; the seed grew to 23 (verified failing on pristine origin/main before this change). --- pm-stack/aggregator/README.md | 58 ++- pm-stack/aggregator/src/pages.ts | 2 +- pm-stack/aggregator/src/program.ts | 14 +- pm-stack/aggregator/src/project-config.ts | 598 ++++++++++++++++++++++ pm-stack/aggregator/src/render.ts | 177 ++++++- pm-stack/aggregator/src/server.ts | 52 +- pm-stack/aggregator/test/program.test.ts | 203 +++++++- pm-stack/aggregator/test/render.test.ts | 2 +- 8 files changed, 1035 insertions(+), 71 deletions(-) create mode 100644 pm-stack/aggregator/src/project-config.ts diff --git a/pm-stack/aggregator/README.md b/pm-stack/aggregator/README.md index d549cfeab6..5a96db0885 100644 --- a/pm-stack/aggregator/README.md +++ b/pm-stack/aggregator/README.md @@ -15,19 +15,20 @@ Design record (source of truth): ## The views -| Route | View | Machine-first JSON | -| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `/today` | **Today** (slice 2, #898) — the day's top objectives, prioritized, plus per-project momentum (moving / stalled / blocked-by-what, recent accomplishments). From the orchestration job's goal measurements (#899) when a section exists; derived from board + roadmap + item activity, and labelled as derived, until then. | `/api/today.json` | -| `/attention` | **Needs you** (#852, tiered in slice 2) — **NEEDS DREW** (default; only items that genuinely require Drew, each with its reason), **NEEDS ORCHESTRATOR** (the fleet's own queue), then every current session with source labels and plain-language states. Finished runs and stale items expire out. | `/api/attention.json`, `/api/coverage.json` | -| `/` | **Cross-repo WIP board** — the curated in-flight set across all four repos, with an execution strip per card (implementing → review → merged → queued). | `/api/board.json` | -| `/roadmap` | **Roadmap** — Grist's `Program roadmap` table as a timeline; `?h=` switches the horizon: `quarter` (default), `month`, `week`, `3d`, `today` — one data model at every grain. | `/api/roadmap.json` | -| `/quota` | **Usage & billing** (hub, design 2026-10-25; pools from #851) — needs-attention strip (bubble rules: >80% of a limit, >$5 projected unbilled PAYG), token-quota pools + PAYG dollars card, SaaS service cards grouped by kind with highlight metrics, charges evidence strip. Per-service detail: `/quota/service/`. | `/api/quota.json` (extended: `saas`/`payg`/`charges`/…), `/api/quota/service.json?id=` | -| `/dns` | **DNS / domain register** (slice 3, #906; data owned by #902) — the register rendered next-renewal-first: renewing-soon spend, then in-use / unused-but-earmarked / completely-unused views and the full table. | `/api/dns.json` | -| `/sessions` | **Sessions** (slice 3, #906) — the identity registry: every known session with its stable id, agent identity, parent, task refs, and token total, grouped by source. | `/api/registry.json` | -| `/program` | **Program status** (#1046) — the dashboard documents itself: what the PM stack is (architecture), what's built, what's next, the long-term roadmap, and known gaps. Editorial content lives in `src/program.ts`; the live-status section (tracked-issue states #898/#899/#902/#906/#910/#911, Project pool counts, orchestration freshness) is derived from the Source at request time so it cannot drift. | `/api/program.json` | -| `/pages` | **All pages** — the page manifest rendered: every registered page, its route, and its JSON twin. | — (the manifest is `src/pages.ts`) | -| `/discuss/` | **Comment thread** for one object ref (a `gh:` ref, an `orch:` tier item, a `session:` id, a board item, a roadmap subject) — dashboard comments + the post form. | `/api/comments.json?object=` | -| `/item/` | Drill-down for one board card or roadmap row: linked refs + a unified comment stream, plus its dashboard comments and the sessions that worked it. | — | +| Route | View | Machine-first JSON | +| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `/today` | **Today** (slice 2, #898) — the day's top objectives, prioritized, plus per-project momentum (moving / stalled / blocked-by-what, recent accomplishments). From the orchestration job's goal measurements (#899) when a section exists; derived from board + roadmap + item activity, and labelled as derived, until then. | `/api/today.json` | +| `/attention` | **Needs you** (#852, tiered in slice 2) — **NEEDS DREW** (default; only items that genuinely require Drew, each with its reason), **NEEDS ORCHESTRATOR** (the fleet's own queue), then every current session with source labels and plain-language states. Finished runs and stale items expire out. | `/api/attention.json`, `/api/coverage.json` | +| `/` | **Cross-repo WIP board** — the curated in-flight set across all four repos, with an execution strip per card (implementing → review → merged → queued). | `/api/board.json` | +| `/roadmap` | **Roadmap** — Grist's `Program roadmap` table as a timeline; `?h=` switches the horizon: `quarter` (default), `month`, `week`, `3d`, `today` — one data model at every grain. | `/api/roadmap.json` | +| `/quota` | **Usage & billing** (hub, design 2026-10-25; pools from #851) — needs-attention strip (bubble rules: >80% of a limit, >$5 projected unbilled PAYG), token-quota pools + PAYG dollars card, SaaS service cards grouped by kind with highlight metrics, charges evidence strip. Per-service detail: `/quota/service/`. | `/api/quota.json` (extended: `saas`/`payg`/`charges`/…), `/api/quota/service.json?id=` | +| `/dns` | **DNS / domain register** (slice 3, #906; data owned by #902) — the register rendered next-renewal-first: renewing-soon spend, then in-use / unused-but-earmarked / completely-unused views and the full table. | `/api/dns.json` | +| `/sessions` | **Sessions** (slice 3, #906) — the identity registry: every known session with its stable id, agent identity, parent, task refs, and token total, grouped by source. | `/api/registry.json` | +| `/program` | **Program status — projects index** (#1046, generalized #1121) — one card per configured project (title, live Project-pool counts by status for its Area, Grist roadmap row count, home-doc link), the whole-pool summary, orchestration freshness, and the pool's unset-Area count as a visible gap. Driven by the project registry in `src/project-config.ts`. | `/api/program.json` (incl. per-project summaries) | +| `/program/` | **Project page** (#1121) — one per registry entry (pm-dashboard, lab-cluster, id, repo-fleet, mcpx, cloud-program): intro + home-doc/dashboard links, live tracked-issue states, its Area's pool items grouped by status, its roadmap area's rows, and editorial done/next/long-term/gaps where configured. Null Area/roadmap/home-doc render as honest gap notes, never empty sections. The full PM-dashboard document (#1046) lives at `/program/pm-dashboard`. | `/api/program-project.json?id=` | +| `/pages` | **All pages** — the page manifest rendered: every registered page, its route, and its JSON twin. | — (the manifest is `src/pages.ts`) | +| `/discuss/` | **Comment thread** for one object ref (a `gh:` ref, an `orch:` tier item, a `session:` id, a board item, a roadmap subject) — dashboard comments + the post form. | `/api/comments.json?object=` | +| `/item/` | Drill-down for one board card or roadmap row: linked refs + a unified comment stream, plus its dashboard comments and the sessions that worked it. | — | All views are mobile-first (single-column stacking, scrollable tables, touch-sized switchers) — verify at phone width, not by resizing a desktop @@ -80,6 +81,34 @@ manifest, so a new page never touches the chrome. To add one: (`src/dns.ts`, keyed on the register's table header), and the page renders its views from that section alone. +### Projects are configured, not coded (#1120) + +Every project on `/program` is one entry in the registry in +`src/project-config.ts` (`PROJECT_CONFIGS`) — the single source the +index, the per-project pages, and both JSON twins read. To add a +project (target: under 30 minutes): + +1. Add one `ProjectConfig` entry: `id` (the `/program/` slug), + `title`, `intro`, `poolArea` (its org Project #4 Area value, or + `null` — the page then states honestly that it has no dedicated + Area yet), `roadmapArea` (its Grist Program-roadmap area, or + `null`), `homeDoc` (its `planning/roadmaps/.md` home, as + `{ repo, path, url }`), `dashboardLinks`, and `trackedRefs` (the + issues whose live state the page resolves). +2. Optionally add `editorial` sections (`done` / `next` / `longTerm` / + `gaps`, `ProgramEntry[]` — every entry should carry its tracker + refs) and, for a program-level doc like pm-dashboard's, + `architecture` entries. +3. Nothing else: the index card, the `/program/` page, and the + JSON twins all derive from the entry, and every countable thing + (pool items by status, roadmap rows, issue states) is derived from + the Source at request time — never written into the config. + +Validation is fail-soft at render and strict in tests: +`validateProjectConfigs` (duplicate ids, duplicate pool/roadmap +areas, malformed slugs/refs, unusable home-doc URLs) is asserted +clean over the shipped registry in `test/program.test.ts`. + ### Dashboard comments (slice 3, #906) Comments live in a dashboard-side store (`src/comments.ts`, one JSON @@ -365,6 +394,9 @@ src/ pages.ts the page manifest — nav, dropdown, /pages (#906) program.ts the /program page's editorial record + live-data builder (tracked issues, pool summary, freshness) (#1046) + project-config.ts the project registry: one ProjectConfig per + project + validation + the per-project live builders + the index, project pages, and JSON twins read (#1120) derive.ts execution strip, timeline lanes, quota/attention rules render.ts pure HTML rendering of every view server.ts Bun HTTP server (pages, JSON twins, comment writes) diff --git a/pm-stack/aggregator/src/pages.ts b/pm-stack/aggregator/src/pages.ts index 6a8c314346..e479363132 100644 --- a/pm-stack/aggregator/src/pages.ts +++ b/pm-stack/aggregator/src/pages.ts @@ -78,7 +78,7 @@ export const PAGES: PageDef[] = [ route: "/program", api: "/api/program.json", blurb: - "What this dashboard is, what's built, what's next, and the long-term roadmap — fed from the tracked issues and the Project pool.", + "The projects hub: every project's status, roadmap, and tracked work, one page per project under /program/ — fed from the project registry, the tracked issues, and the Project pool.", }, { id: "pages", diff --git a/pm-stack/aggregator/src/program.ts b/pm-stack/aggregator/src/program.ts index 7555931c2b..e00c3d5c3d 100644 --- a/pm-stack/aggregator/src/program.ts +++ b/pm-stack/aggregator/src/program.ts @@ -57,7 +57,7 @@ export const TRACKED_REFS: RefKey[] = [issue(898), issue(899), issue(902), issue export const PROGRAM: ProgramDoc = { intro: "This dashboard is the aggregator of the PM stack: the one screen Drew lives in while the fleet works in GitHub, Kaneo, and Pad underneath. This page is the program's own record — what it is, what is built, what is next — with the status sections below derived live from the tracked issues, the Project pool, and the orchestrator, so they cannot drift quietly.", - designRecordUrl: `https://github.com/developing-today/code/blob/main/doc/2026-10-24T11-05-38Z_design_project-management-stack.md`, + designRecordUrl: `https://github.com/developing-today/code/blob/main/doc/2026-10-24T11-05-38Z_design_project-management-stack/2026-10-24T11-05-38Z_design_project-management-stack.md`, projectUrl: PROJECT_URL, architecture: [ { @@ -152,6 +152,12 @@ export const PROGRAM: ProgramDoc = { refs: [issue(910)], links: [{ label: "Project #4", url: PROJECT_URL }], }, + { + title: "Program pages generalized to every project", + detail: + "This page stopped being a single hard-coded document: projects are configured in a registry (src/project-config.ts), /program is the projects index, and every configured project — pm-dashboard, the basement cluster, id, the repo fleet, mcpx, the cloud program — has its own page under /program/ with live pool, roadmap, and tracked-issue sections. Epic #1129 tracks the remaining per-project build-out.", + refs: [issue(1120), issue(1121)], + }, ], next: [ { @@ -268,10 +274,14 @@ export function buildProgramLive( }; } -/** The /api/program.json shape: the editorial document plus the live half. */ +/** The /api/program.json shape: the editorial document plus the live half. + * `projects` (the multi-project index summaries, #1121) is attached by + * the server from src/project-config.ts; optional so the builder and + * its tests keep working without the registry. */ export interface ProgramData { program: ProgramDoc; live: ProgramLive; + projects?: import("./project-config.ts").ProjectSummary[]; } export function buildProgramData( diff --git a/pm-stack/aggregator/src/project-config.ts b/pm-stack/aggregator/src/project-config.ts new file mode 100644 index 0000000000..5734bc1adb --- /dev/null +++ b/pm-stack/aggregator/src/project-config.ts @@ -0,0 +1,598 @@ +// The project registry (#1120): one config entry per project is the +// single source the /program index, the /program/ pages, and their +// JSON twins all read. Adding a project is a config change here — not +// a code change per project (recipe in the README, "Add a project"). +// +// A config says WHERE a project's live data lives (its org Project #4 +// Area, its Grist roadmap area), WHERE its home doc lives, WHICH issues +// state the page resolves live, and any EDITORIAL sections (done / next +// / long-term / gaps) in the same ProgramEntry shape as src/program.ts. +// Everything countable is derived from the Source at request time by +// the builders below — no count or issue state is written by hand in a +// config. A project with no Area / roadmap area yet says so honestly +// (null), and the page renders the gap instead of an empty section. +import type { GhItem, ProjectPoolItem, RefKey, RoadmapRow } from "./model.ts"; +import { refUrl } from "./model.ts"; +import { PROGRAM, TRACKED_REFS, type ProgramEntry, type TrackedIssue } from "./program.ts"; + +export interface ProjectHomeDoc { + repo: string; + path: string; + url: string; +} + +export interface ProjectDashboardLink { + label: string; + route: string; +} + +export interface ProjectEditorial { + done: ProgramEntry[]; + next: ProgramEntry[]; + longTerm: ProgramEntry[]; + gaps: ProgramEntry[]; +} + +export interface ProjectConfig { + /** Slug used in /program/. */ + id: string; + title: string; + /** One-paragraph description of the project. */ + intro: string; + /** Org Project #4 Area value; null = no dedicated Area yet. */ + poolArea: string | null; + /** Grist "Program roadmap" area value (RoadmapRow.area); null = none yet. */ + roadmapArea: string | null; + homeDoc?: ProjectHomeDoc; + dashboardLinks?: ProjectDashboardLink[]; + /** Issues whose live state the page resolves via Source.items(). */ + trackedRefs: RefKey[]; + /** Extra architecture entries (the pm-dashboard doc renders its from here). */ + architecture?: ProgramEntry[]; + editorial?: ProjectEditorial; +} + +const CODE = "developing-today/code"; +const NIX = "dezren39/nix"; +const blob = (path: string): string => `https://github.com/${CODE}/blob/main/${path}`; +const home = (path: string): ProjectHomeDoc => ({ repo: CODE, path, url: blob(path) }); +const ref = (repo: string, n: number): RefKey => `${repo}#${n}`; +const code = (n: number): RefKey => ref(CODE, n); + +export const PROJECT_CONFIGS: ProjectConfig[] = [ + { + id: "pm-dashboard", + title: "PM dashboard", + intro: PROGRAM.intro, + poolArea: "pm-dashboard", + roadmapArea: "PM stack", + homeDoc: home( + "doc/2026-10-24T11-05-38Z_design_project-management-stack/2026-10-24T11-05-38Z_design_project-management-stack.md", + ), + dashboardLinks: [ + { label: "Projects pool", route: "/projects" }, + { label: "Today", route: "/today" }, + { label: "Needs you", route: "/attention" }, + ], + trackedRefs: TRACKED_REFS, + architecture: PROGRAM.architecture, + editorial: { done: PROGRAM.done, next: PROGRAM.next, longTerm: PROGRAM.longTerm, gaps: PROGRAM.gaps }, + }, + { + id: "lab-cluster", + title: "Basement cluster", + intro: + "A home lab built from the ~12 Threadripper machines in the basement: the first 3–5 become a Talos Linux cluster running Cozystack, bootstrapped declaratively with TALM, with CloudNativePG Postgres, RustFS, NATS, FluxCD, a Cloudflare tunnel and Tailscale on top. Hard rules: no HashiCorp anything, and everything bootstrappable from config — no hand-built state. Nothing is physically installed yet; basement power and space gate the first nodes, and egress (2 Gbps symmetric fiber) is the scarce resource, not compute.", + poolArea: "lab-cluster", + roadmapArea: "Basement cluster", + homeDoc: home("planning/roadmaps/basement-cluster.md"), + dashboardLinks: [{ label: "Projects pool (lab-cluster)", route: "/projects?area=lab-cluster" }], + trackedRefs: [ + code(1080), + code(1081), + code(1083), + code(1084), + code(1085), + code(1086), + code(1091), + code(1087), + code(1088), + code(1090), + code(1092), + code(1093), + ], + editorial: { + done: [ + { + title: "Project structure seeded", + detail: + "The home doc (planning/roadmaps/basement-cluster.md) was created from the 2026-10-26 project-structure spec, the 12 epic issues below were filed and cross-linked, and the first dated status record was written (2026-10-27, linked from the home doc).", + }, + { + title: "v1.9-era test cluster marked historical", + detail: + "The earlier Talos test cluster was only a test and has been torn down; its layout docs are historical reference, not a live cluster.", + }, + ], + next: [ + { + title: "Hardware inventory & first-node selection (Now, hybrid)", + detail: "Gather hardware stats for all ~12 machines and pick the first 3–5 cluster nodes.", + refs: [code(1080)], + }, + { + title: "Firmware / BIOS / BMC audit (Now, hybrid)", + detail: + "Confirm firmware versions and every setting are identical across the core machines, verified by routine KVM screenshots.", + refs: [code(1081)], + }, + { + title: "Basement power & space (Now, physical)", + detail: "Dedicated 20A circuits, cleanup and rack layout, so the first nodes can actually run.", + refs: [code(1083)], + }, + { + title: "Network fabric, storage assembly, TALM + Talos bootstrap (Next)", + detail: + "Switching and a new addressing plan replacing the torn-down test layout; HDD RAID 10 pools and NVMe tiers validated per-drive; prove the declarative bootstrap flow including per-machine drives that are all different.", + refs: [code(1084), code(1085), code(1086)], + }, + ], + longTerm: [ + { + title: "Cozystack platform + platform services (Later)", + detail: + "Install Cozystack and settle its upgrade path; then CNPG Postgres, RustFS (against Cozystack's bundled SeaweedFS), NATS, FluxCD, Cloudflare tunnel and Tailscale.", + refs: [code(1087), code(1088)], + }, + { + title: "Observability, backup & recovery (Later)", + detail: "Metrics, an etcd and TALM recovery vault, restore drills, and a power-return boot order.", + refs: [code(1090)], + }, + { + title: "Cloud extension (Next horizon, long tail)", + detail: "The OCI always-free fleet, egress offload, and cold tiering to R2 alongside the home cluster.", + refs: [code(1091)], + }, + { + title: "First workload: the id app on FluxCD (Later)", + detail: "Run the id app as the cluster's first real workload.", + refs: [code(1092)], + }, + ], + gaps: [ + { + title: "Nothing physically installed yet", + detail: + "Basement power and space block the full fleet; the target is 3–5 machines first. All current progress is design, inventory, and preparation.", + }, + { + title: "ESP32 wing is deliberately an idea", + detail: + "A low-end section of ESP32 sensors and LoRa alongside the compute fleet — a side project of a side project for now.", + refs: [code(1093)], + }, + ], + }, + }, + { + id: "id", + title: "id platform", + intro: + "id is the peer-to-peer CLI built on Iroh. Its current growth area is the worlds platform: sandboxed Wasm programs (written in Roc) that run in shared, journaled worlds and render to browsers and SSH terminals. Drew's order (2026-10-26): Phase 12 is the goal, and the work needed to get to Phase 12 comes first — priority labels encode that order, and the dashboard mirrors it.", + poolArea: "id-train", + roadmapArea: "id", + homeDoc: home("planning/roadmaps/id.md"), + dashboardLinks: [{ label: "Projects pool (id-train)", route: "/projects?area=id-train" }], + trackedRefs: [code(534), code(796), code(1075), code(807), code(557), code(806), code(812), code(793)], + editorial: { + done: [ + { + title: "Phases 9–11 delivered", + detail: + "The worlds platform foundations shipped — faster than they were verified. Dedicated validation tasks now audit each delivered phase against its plan, with a tracked issue for every gap found.", + refs: [code(796), code(1075)], + }, + { + title: "Phase 13 shells started", + detail: + "F13.1 (shell contract) and F13.2 (SSH frame transport) are done; the rest of Phase 13 waits behind Phase 12 foundations.", + refs: [code(783), code(784)], + }, + ], + next: [ + { + title: "The path to Phase 12 (Now)", + detail: + "A CI signal that can be trusted, validation of the delivered phases, journal format management (must land before any new journal entry type), cost visibility baselines, and the Phase 12 designs run through the research workflow.", + refs: [code(229), code(1075), code(534)], + }, + { + title: "Phase 12 — platform flexibility (Next)", + detail: + "Make the platform something other people can build on without changing its core: worlds as data (world.toml), a provider registry, first new providers, more guest languages, program upgrade with state migration, many worlds per node, journal replication, portals.", + refs: [code(534), code(807), code(557), code(806)], + }, + ], + longTerm: [ + { + title: "Phase 13 — client shells", + detail: + "SSH-over-iroh reachability, presentation capability tiers, native client shells on the shell contract, client-side capability providers, multi-server topology, and a world directory (worlds as places).", + refs: [code(788), code(812)], + }, + { + title: "Worlds on Cloudflare Workers; group encryption", + detail: + "A pkarr option for running worlds on Workers (design merged; implementation deferred), and group key agreement so a world's documents are encrypted for current members only.", + refs: [code(793), code(1070)], + }, + ], + gaps: [ + { + title: "CI trust is the standing gap", + detail: + "The Nix check had no recorded success in 392 runs and the fast lane's exit (median PR feedback under 15 min) has never been measured. A red check must mean something before Phase 12 stacks on it.", + refs: [code(229)], + }, + ], + }, + }, + { + id: "repo-fleet", + title: "Repo fleet", + intro: + "The four working repos and the automation that keeps them healthy: developing-today/code, developing-today/opencode, developing-today/openchamber, and dezren39/nix. Issue sweeps, the issue creator, PR shepherding, Jules, and the hourly orchestration job work these queues; this project tracks the fleet-level work — CI, automation, and triage — while each project's own checks live in its own roadmap.", + poolArea: "fleet-ops", + roadmapArea: "Repo fleet", + homeDoc: home("planning/roadmaps/repo-and-ci.md"), + dashboardLinks: [ + { label: "Board", route: "/" }, + { label: "Needs you", route: "/attention" }, + { label: "Projects pool (fleet-ops)", route: "/projects?area=fleet-ops" }, + ], + trackedRefs: [code(911), code(899), code(287), code(288), code(257), code(292)], + editorial: { + done: [ + { + title: "The fleet's jobs are live", + detail: + "Issue sweeps across all four repos, the hourly orchestration pass (queue triage, goal measurement, Project reconciliation), and the Jules keeper all run on schedule.", + refs: [code(899)], + }, + ], + next: [ + { + title: "Work-picking jobs consult the orchestrator", + detail: + "The last unimplemented item of the original PM program: sweeps and the creator should read the orchestrator's published priorities and blocked-by data first, falling back to their current rules when it is stale.", + refs: [code(911)], + }, + { + title: "CI hygiene (from the repo-and-ci roadmap)", + detail: + "Three Jules workflow files become one; cache the Go build by go.sum hash; fix nix flake check dying out-of-disk in id-test/id-ci; triage stale PRs.", + refs: [code(287), code(288), code(257)], + }, + ], + longTerm: [ + { + title: "The id workflow gate stays under 15 minutes", + detail: "The gate once took about two hours; it is fast now. Keep it that way — and measure it.", + refs: [code(292)], + }, + ], + gaps: [ + { + title: "Home doc scope is CI/automation only", + detail: + "planning/roadmaps/repo-and-ci.md covers workflows, Jules, and PR triage. Per-project CI detail lives in each project's own roadmap, not here.", + }, + ], + }, + }, + { + id: "mcpx", + title: "mcpx", + intro: + "mcpx is the Go MCP gateway and Code Mode runner in pkgs/mcpx: it pools MCP servers behind one daemon, runs TypeScript scripts against them, and hands a running daemon to its successor during upgrades. This repo is the only source for mcpx — the vendored copy in dezren39/nix was deleted 2026-10-19 — and the OpenCode and OpenChamber forks consume the result.", + poolArea: null, + roadmapArea: null, + homeDoc: home("planning/roadmaps/mcpx.md"), + dashboardLinks: [{ label: "Sessions", route: "/sessions" }], + trackedRefs: [code(308), code(309), code(237), code(290), code(864)], + editorial: { + done: [ + { + title: "Single source established", + detail: + "The dezren39/nix vendored copy was deleted on 2026-10-19 (dezren39/nix#468) and now builds mcpx from a pinned source-only input of this repo; OpenCode and OpenChamber consume that build.", + }, + ], + next: [ + { + title: "Consumption decision + backlog re-homing (Now)", + detail: + "What remains of the single-source work: the downstream consumption decision, and re-homing the large mcpx backlog that still lives in dezren39/nix into this repo.", + refs: [code(308), code(309)], + }, + { + title: "Darwin takeover tests; orphan-session test (Now)", + detail: + "Takeover/upgrade/handoff is unsupported on darwin and its Linux-only tests break the darwin build; the orphan-session test flakes in the Nix build and hides its own failure reason.", + refs: [code(237), code(290)], + }, + { + title: "JSON Schema validation of tool input/output (Next)", + detail: "Seven conformance rows depend on it; tracked in the nix-side backlog until re-homed.", + refs: [ref(NIX, 254)], + }, + ], + longTerm: [ + { + title: "Supervisor-owned stdio pipes; session resume", + detail: + "A supervisor that outlives the daemon makes upgrades a plain front-end restart; upstream sessions should resume after a cold restart instead of re-initialising every HTTP upstream.", + }, + { + title: "Write policy, principals, and HTTP auth", + detail: + "Ask/allow/deny per call with the exact call shown when asking; a bearer token for /v1 and /mcp; a principal per surface with per-operation permissions.", + }, + ], + gaps: [ + { + title: "No Project Area or roadmap area yet", + detail: + "mcpx has no dedicated org Project Area and no Grist roadmap area, so this page's live pool/roadmap sections are honestly empty; its work is tracked in GitHub issues and planning/roadmaps/mcpx.md. The integration decision is tracked in #1127.", + links: [{ label: "#1127", url: refUrl(code(1127), "issue") }], + }, + ], + }, + }, + { + id: "cloud-program", + title: "Cloud program & SaaS", + intro: + "Every cloud account, plan, and subscription the fleet runs on — Cloudflare, Turso, OCI, the AI plans — and what each costs against its allotment. The Usage & billing hub renders the master tracker (workspace: ai-subscriptions) with dated reads and pace verdicts; the account-connection campaign wired API/OAuth access for nearly everything. The standing aim is ~100% of paid allotments, with pricing revalidated against official docs.", + poolArea: null, + roadmapArea: null, + dashboardLinks: [ + { label: "Usage & billing", route: "/quota" }, + { label: "DNS register", route: "/dns" }, + ], + trackedRefs: [code(967), code(1047)], + editorial: { + done: [ + { + title: "Usage & billing hub live", + detail: + "The /quota hub renders the master tracker: pools, SaaS services, PAYG lines, charges evidence, and per-service detail pages.", + refs: [code(967)], + }, + { + title: "Account-connection campaign (mostly)", + detail: + "Services were connected via API keys/OAuth everywhere possible, tokens vaulted in Bitwarden/1Password, no new MFA unless forced. The known remainder is Plaid (below).", + }, + ], + next: [ + { + title: "Hub build-out under its epic", + detail: + "Open checks, live collectors per service, daily + event-driven console reads, dashboard provenance, and the free-services completion pass.", + refs: [code(1047)], + }, + ], + longTerm: [ + { + title: "Every plan paced against its reset", + detail: + "Usage percentages refreshed on a daily cadence, allotments aimed at ~100% use, and any claimed plan change diffed against the dated evidence baseline before the tracker moves.", + }, + ], + gaps: [ + { + title: "No Project Area or roadmap area", + detail: + "This program is tracked in the ai-subscriptions workspace tracker and its hub epic, not in the org Project pool or the Grist roadmap — so this page's live pool/roadmap sections are honestly empty.", + }, + { + title: "Plaid / Citi still not linked", + detail: + "Plaid blocks Muse's browser, so linking Citi (Costco, Diamond, Double Cash) needs Drew's own browser session. Several vendor meters are also console-only, so some /quota numbers are dated manual reads rather than live meters.", + }, + ], + }, + }, +]; + +export function projectConfigById(id: string): ProjectConfig | undefined { + return PROJECT_CONFIGS.find((c) => c.id === id); +} + +export function projectRoute(id: string): string { + return `/program/${id}`; +} + +// --- Validation (strict in tests, never throws at render) ------------------ + +const REF_PATTERN = /^[^/\s]+\/[^#\s]+#\d+$/; +const ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/; + +function checkRefs(refs: RefKey[], errors: string[], where: string): void { + for (const r of refs) { + if (!REF_PATTERN.test(r)) errors.push(`${where}: malformed ref "${r}" (want owner/repo#N)`); + } +} + +function checkEntries(entries: ProgramEntry[] | undefined, errors: string[], where: string): void { + for (const e of entries ?? []) checkRefs(e.refs ?? [], errors, where); +} + +/** Validate a registry: returns human-readable errors (empty = valid). + * Catches duplicate ids, duplicate pool/roadmap areas, malformed slugs + * and refs, and home docs without a usable URL. Pure — the shipped + * registry is asserted valid in tests. */ +export function validateProjectConfigs(configs: ProjectConfig[]): string[] { + const errors: string[] = []; + const seenIds = new Map(); + const seenPoolAreas = new Map(); + const seenRoadmapAreas = new Map(); + configs.forEach((c, i) => { + const where = `configs[${i}] (${c.id || "?"})`; + if (!ID_PATTERN.test(c.id)) errors.push(`${where}: id is not a slug`); + seenIds.set(c.id, (seenIds.get(c.id) ?? 0) + 1); + if (c.poolArea !== null) { + const prev = seenPoolAreas.get(c.poolArea); + if (prev) errors.push(`${where}: poolArea "${c.poolArea}" also used by ${prev}`); + seenPoolAreas.set(c.poolArea, c.id); + } + if (c.roadmapArea !== null) { + const prev = seenRoadmapAreas.get(c.roadmapArea); + if (prev) errors.push(`${where}: roadmapArea "${c.roadmapArea}" also used by ${prev}`); + seenRoadmapAreas.set(c.roadmapArea, c.id); + } + if (!c.title.trim()) errors.push(`${where}: title is empty`); + if (!c.intro.trim()) errors.push(`${where}: intro is empty`); + if (c.homeDoc && !/^https:\/\//.test(c.homeDoc.url)) errors.push(`${where}: homeDoc.url is not an https URL`); + checkRefs(c.trackedRefs, errors, where); + checkEntries(c.architecture, errors, where); + checkEntries(c.editorial?.done, errors, where); + checkEntries(c.editorial?.next, errors, where); + checkEntries(c.editorial?.longTerm, errors, where); + checkEntries(c.editorial?.gaps, errors, where); + }); + for (const [id, n] of seenIds) { + if (n > 1) errors.push(`duplicate project id "${id}" (${n} entries)`); + } + return errors; +} + +// --- Live builders (derived from Source data, never hard-coded) ------------ + +export interface Count { + name: string; + count: number; +} + +function counts(values: (string | null)[]): Count[] { + const map = new Map(); + for (const v of values) { + const key = v ?? "(unset)"; + map.set(key, (map.get(key) ?? 0) + 1); + } + return [...map.entries()] + .map(([name, count]) => ({ name, count })) + .sort((a, b) => b.count - a.count || a.name.localeCompare(b.name)); +} + +export interface ProjectSummary { + id: string; + title: string; + route: string; + intro: string; + poolArea: string | null; + roadmapArea: string | null; + /** Pool items in this project's Area; 0 when poolArea is null. */ + poolTotal: number; + poolByStatus: Count[]; + /** Grist rows in this project's roadmapArea; 0 when null. */ + roadmapRows: number; + homeDoc: ProjectHomeDoc | null; +} + +export function buildProjectSummary( + config: ProjectConfig, + pool: ProjectPoolItem[], + rows: RoadmapRow[], +): ProjectSummary { + const mine = config.poolArea === null ? [] : pool.filter((p) => p.area === config.poolArea); + return { + id: config.id, + title: config.title, + route: projectRoute(config.id), + intro: config.intro, + poolArea: config.poolArea, + roadmapArea: config.roadmapArea, + poolTotal: mine.length, + poolByStatus: counts(mine.map((p) => p.status)), + roadmapRows: config.roadmapArea === null ? 0 : rows.filter((r) => r.area === config.roadmapArea).length, + homeDoc: config.homeDoc ?? null, + }; +} + +export function buildProjectSummaries( + configs: ProjectConfig[], + pool: ProjectPoolItem[], + rows: RoadmapRow[], +): ProjectSummary[] { + return configs.map((c) => buildProjectSummary(c, pool, rows)); +} + +/** Pool items carrying no Area — they belong to no project page until + * Area is set; the index surfaces this count so the gap stays visible. */ +export function unsetPoolCount(pool: ProjectPoolItem[]): number { + return pool.filter((p) => p.area === null).length; +} + +export interface ProjectDetail { + config: ProjectConfig; + route: string; + poolItems: ProjectPoolItem[]; + poolByStatus: Count[]; + roadmapRows: RoadmapRow[]; + tracked: TrackedIssue[]; + /** Whole-pool items with no Area (the gap note for null-area projects). */ + unsetPoolCount: number; +} + +export function buildProjectDetail( + config: ProjectConfig, + items: Map, + pool: ProjectPoolItem[], + rows: RoadmapRow[], +): ProjectDetail { + const poolItems = + config.poolArea === null + ? [] + : pool + .filter((p) => p.area === config.poolArea) + .sort((a, b) => (a.status ?? "").localeCompare(b.status ?? "") || a.title.localeCompare(b.title)); + return { + config, + route: projectRoute(config.id), + poolItems, + poolByStatus: counts(poolItems.map((p) => p.status)), + roadmapRows: config.roadmapArea === null ? [] : rows.filter((r) => r.area === config.roadmapArea), + tracked: config.trackedRefs.map((ref) => ({ ref, item: items.get(ref) ?? null })), + unsetPoolCount: unsetPoolCount(pool), + }; +} + +/** Every ref any project page wants resolved (tracked + editorial + + * architecture), de-duplicated, first-seen order — the server resolves + * exactly this set for the project routes. */ +export function allProjectRefs(configs: ProjectConfig[] = PROJECT_CONFIGS): RefKey[] { + const out: RefKey[] = []; + const seen = new Set(); + const add = (r: RefKey) => { + if (!seen.has(r)) { + seen.add(r); + out.push(r); + } + }; + for (const c of configs) { + for (const r of c.trackedRefs) add(r); + const sections = [ + c.architecture ?? [], + c.editorial?.done ?? [], + c.editorial?.next ?? [], + c.editorial?.longTerm ?? [], + c.editorial?.gaps ?? [], + ]; + for (const entries of sections) for (const e of entries) for (const r of e.refs ?? []) add(r); + } + return out; +} diff --git a/pm-stack/aggregator/src/render.ts b/pm-stack/aggregator/src/render.ts index 950b6d1e97..953d0519e8 100644 --- a/pm-stack/aggregator/src/render.ts +++ b/pm-stack/aggregator/src/render.ts @@ -52,7 +52,8 @@ import { refUrl, } from "./model.ts"; import { PAGES } from "./pages.ts"; -import type { ProgramData, ProgramEntry } from "./program.ts"; +import type { ProgramData, ProgramEntry, ProgramLive, TrackedIssue } from "./program.ts"; +import type { ProjectDetail, ProjectSummary } from "./project-config.ts"; import { derivedProjectState, projectDisagreement, PROJECT_URL } from "./projects.ts"; import { type AuthorIdentity } from "./registry.ts"; @@ -1181,40 +1182,166 @@ function programEntries(entries: ProgramEntry[], items: Map): st return entries.map((e) => programEntryHtml(e, items)).join(""); } -export function renderProgram(data: ProgramData, items: Map, provenance: Provenance): string { - const { program, live } = data; - const trackedRows = live.tracked +function countList(list: { name: string; count: number }[]): string { + return list.length ? list.map((c) => `${esc(c.name)}: ${c.count}`).join(" · ") : 'none'; +} + +function trackedTable(tracked: TrackedIssue[]): string { + const rows = tracked .map(({ ref, item }) => item ? `${itemBadge(item)}${esc(item.title)}${esc(item.state)}${fmtDate(item.updatedAt)}` : `unresolved${esc(ref)}unresolved — the current source cannot resolve this ref—`, ) .join(""); - const countList = (list: { name: string; count: number }[]) => - list.length ? list.map((c) => `${esc(c.name)}: ${c.count}`).join(" · ") : 'none'; - const poolHtml = live.pool.total + return `
${rows}
Tracked issueTitleStateUpdated
`; +} + +function poolSummaryHtml(live: ProgramLive): string { + return live.pool.total ? `
${live.pool.total} items in the org Project pool
By status — ${countList(live.pool.byStatus)}
By area — ${countList(live.pool.byArea)}
` - : ``; - const orchHtml = live.orchestration + : ``; +} + +function orchestrationHtml(live: ProgramLive): string { + return live.orchestration ? `
Orchestrator — latest run ${esc(live.orchestration.runId)}, published ${fmtDate(live.orchestration.generatedAt)}.
The tiers and goal measurements it publishes are on Needs you and Today.
` : `
Orchestrator — no orchestration section in the current feed yet (not measured). The Today view derives and labels itself until one lands.
`; - const body = `

Program status — what this dashboard is

-

${esc(program.intro)}

+} + +function projectCard(s: ProjectSummary): string { + const poolLine = + s.poolArea === null + ? `No dedicated Project Area yet.` + : `${s.poolTotal} pool items (${esc(s.poolArea)})${s.poolTotal ? `
By status — ${countList(s.poolByStatus)}` : ""}`; + const roadmapLine = + s.roadmapArea === null + ? `No Grist roadmap area yet.` + : `${s.roadmapRows} roadmap row${s.roadmapRows === 1 ? "" : "s"} (${esc(s.roadmapArea)})`; + const homeLine = s.homeDoc + ? `
Home doc: ${esc(s.homeDoc.path)}` + : ""; + return `
${esc(s.title)}
${poolLine}
${roadmapLine}${homeLine}
Project page →
`; +} + +/** /program as the projects index (#1121): one card per configured + * project from the registry, the whole-pool + orchestrator live blocks + * from #1046, and the unset-Area count as a visible gap. The full + * pm-dashboard document moved to /program/pm-dashboard — every link + * that pointed at /program still lands here. */ +export function renderProgram(data: ProgramData, items: Map, provenance: Provenance): string { + const { program, live } = data; + const projects = data.projects ?? []; + const unset = live.pool.byArea.find((c) => c.name === "(unset)")?.count ?? 0; + const cards = projects.map(projectCard).join(""); + const unsetHtml = + live.pool.total && unset + ? `` + : ""; + const body = `

Program status — projects

+

Every project the fleet runs, documented the same way: a description, its live Project-pool and roadmap sections, its tracked issues resolved live, and its roadmap — all driven by the project registry in src/project-config.ts. Pick a project for its full page.

Source of truth: the design record in developing-today/code · the org Project Developing Today (#4) · Machine-first: /api/program.json.

-

What this is — architecture

-${programEntries(program.architecture, items)} +

Projects

+
${cards || '

No projects configured.

'}
+${unsetHtml}

Live status

-

Derived at request time from the tracked issues, the Project pool, and the latest orchestration section — not written by hand. A ref the current source cannot resolve says so.

-
${trackedRows}
Tracked issueTitleStateUpdated
-${poolHtml} -${orchHtml} -

What's built

-${programEntries(program.done, items)} -

What's next

-${programEntries(program.next, items)} -

Long-term roadmap

-${programEntries(program.longTerm, items)} -

Known gaps

-${programEntries(program.gaps, items)}`; +

Derived at request time from the Project pool and the latest orchestration section — not written by hand.

+${poolSummaryHtml(live)} +${orchestrationHtml(live)} +

The PM dashboard's own record

+

This dashboard's architecture, what's built, what's next, and its long-term roadmap live on its project page: PM dashboard →. Its tracked issues, resolved live:

+${trackedTable(live.tracked)}`; return layout("Program status", body, provenance, "/program"); } + +// --- Per-project page (#1121, registry in src/project-config.ts) ------------- + +const POOL_ITEM_CAP = 24; + +export function renderProgramProject( + detail: ProjectDetail, + items: Map, + provenance: Provenance, +): string { + const { config } = detail; + const linkBits: string[] = []; + if (config.homeDoc) { + linkBits.push( + `Home doc: ${esc(config.homeDoc.path)} (${esc(config.homeDoc.repo)})`, + ); + } else { + linkBits.push(`No home doc configured for this project yet.`); + } + for (const l of config.dashboardLinks ?? []) { + linkBits.push(`${esc(l.label)}`); + } + linkBits.push(`JSON twin`); + + const archHtml = config.architecture?.length + ? `

What this is — architecture

${programEntries(config.architecture, items)}` + : ""; + + let poolHtml: string; + if (config.poolArea === null) { + poolHtml = ``; + } else if (!detail.poolItems.length) { + poolHtml = ``; + } else { + const shown = detail.poolItems.slice(0, POOL_ITEM_CAP); + const cards = shown + .map((p) => { + const statusBadge = p.status + ? `${esc(p.status)}` + : `no status`; + const meta = [ + p.horizon ? `${esc(p.horizon)}` : "", + p.kind ? `${esc(p.kind)}` : "", + `issue ${esc(p.state)}`, + ].join(" "); + return `
${esc(p.title)}
${statusBadge} ${meta}
${esc(p.repo)}#${p.number} · Project item${p.updatedAt ? ` · updated ${fmtDate(p.updatedAt)}` : ""}
`; + }) + .join(""); + const more = + detail.poolItems.length > POOL_ITEM_CAP + ? `

Showing ${POOL_ITEM_CAP} of ${detail.poolItems.length} — the full set is on /projects.

` + : ""; + poolHtml = `

${detail.poolItems.length} items with Area ${esc(config.poolArea)} — by status: ${countList(detail.poolByStatus)}. Full pool view: /projects?area=${esc(config.poolArea)}.

${cards}${more}`; + } + + let roadmapHtml: string; + if (config.roadmapArea === null) { + roadmapHtml = ``; + } 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 ed = config.editorial; + const editorialHtml = ed + ? `${ed.done.length ? `

What's built

${programEntries(ed.done, items)}` : ""}${ed.next.length ? `

What's next

${programEntries(ed.next, items)}` : ""}${ed.longTerm.length ? `

Long-term roadmap

${programEntries(ed.longTerm, items)}` : ""}${ed.gaps.length ? `

Known gaps

${programEntries(ed.gaps, items)}` : ""}` + : ""; + + const body = `

${esc(config.title)}

+

${esc(config.intro)}

+

${linkBits.join(" · ")}

+

← all projects

+${archHtml} +

Live status — tracked issues

+

Resolved at request time from the same Source as every other view. A ref the current source cannot resolve says so — never an invented state.

+${trackedTable(detail.tracked)} +

Project pool — live

+${poolHtml} +

Roadmap — live

+${roadmapHtml} +${editorialHtml}`; + return layout(config.title, body, provenance, "/program"); +} diff --git a/pm-stack/aggregator/src/server.ts b/pm-stack/aggregator/src/server.ts index 1f3c590f75..bc4ebd20d5 100644 --- a/pm-stack/aggregator/src/server.ts +++ b/pm-stack/aggregator/src/server.ts @@ -8,6 +8,13 @@ import { loadConfig } from "./config.ts"; import { allRefs, buildAttention, deriveToday, projectPace, type RoadmapGrain } from "./derive.ts"; import type { DashComment, RefKey } from "./model.ts"; import { buildProgramData, programRefs } from "./program.ts"; +import { + PROJECT_CONFIGS, + allProjectRefs, + buildProjectDetail, + buildProjectSummaries, + projectConfigById, +} from "./project-config.ts"; import { identitiesFromRecords } from "./registry.ts"; import { ghObjectRef, @@ -18,6 +25,7 @@ import { renderItem, renderPages, renderProgram, + renderProgramProject, renderProjects, renderQuota, renderRoadmap, @@ -248,20 +256,52 @@ async function handler(req: Request): Promise { } if (path === "/program" || path === "/api/program.json") { - // #1046: the dashboard documents itself. Editorial content from - // src/program.ts; the live half derived from the same Source the - // other views read (items / projects / orchestration), each facet - // failing soft on its own. - const [items, pool, orchestration] = await Promise.all([ + // #1046 + #1121: /program is the projects index. Editorial content + // from src/program.ts (the pm-dashboard doc) and the project + // registry in src/project-config.ts; the live half derived from + // the same Source the other views read (items / projects / + // roadmap / orchestration), each facet failing soft on its own. + const [items, pool, rows, orchestration] = await Promise.all([ source.items(programRefs()).catch(() => new Map()), source.projects().catch(() => []), + source.roadmap().catch(() => []), source.orchestration().catch(() => null), ]); - const data = buildProgramData(items, pool, orchestration); + const data = { + ...buildProgramData(items, pool, orchestration), + projects: buildProjectSummaries(PROJECT_CONFIGS, pool, rows), + }; if (path === "/api/program.json") return json(data); return html(renderProgram(data, items, prov())); } + const programProjectMatch = /^\/program\/([\w-]+)$/.exec(path); + if (programProjectMatch) { + const config = projectConfigById(programProjectMatch[1]); + if (!config) { + return html( + `

Not found

no project with id ${programProjectMatch[1]} in the registry (src/project-config.ts) — back to the projects index

`, + ); + } + const [items, pool, rows] = await Promise.all([ + source.items(allProjectRefs()).catch(() => new Map()), + source.projects().catch(() => []), + source.roadmap().catch(() => []), + ]); + return html(renderProgramProject(buildProjectDetail(config, items, pool, rows), items, prov())); + } + if (path === "/api/program-project.json") { + const id = url.searchParams.get("id") ?? ""; + const config = projectConfigById(id); + if (!config) return json({ error: "unknown project", id }, 404); + const [items, pool, rows] = await Promise.all([ + source.items(allProjectRefs()).catch(() => new Map()), + source.projects().catch(() => []), + source.roadmap().catch(() => []), + ]); + return json(buildProjectDetail(config, items, pool, rows)); + } + if (path === "/pages") { return html(renderPages(prov())); } diff --git a/pm-stack/aggregator/test/program.test.ts b/pm-stack/aggregator/test/program.test.ts index e55b128da9..e61eaaf7ae 100644 --- a/pm-stack/aggregator/test/program.test.ts +++ b/pm-stack/aggregator/test/program.test.ts @@ -1,9 +1,19 @@ import { describe, expect, test } from "bun:test"; import type { GhItem, OrchestrationSection, ProjectPoolItem, Provenance } from "../src/model.ts"; import { PAGES, pageByRoute } from "../src/pages.ts"; +import { + PROJECT_CONFIGS, + allProjectRefs, + buildProjectDetail, + buildProjectSummaries, + projectConfigById, + unsetPoolCount, + validateProjectConfigs, + type ProjectConfig, +} from "../src/project-config.ts"; import { buildProgramData, buildProgramLive, PROGRAM, programRefs, TRACKED_REFS } from "../src/program.ts"; -import { renderProgram } from "../src/render.ts"; -import { fixtureSource } from "../src/sources/fixtures.ts"; +import { renderProgram, renderProgramProject } from "../src/render.ts"; +import { FIXTURE_ROADMAP, fixtureSource } from "../src/sources/fixtures.ts"; const PROV: Provenance = { board: "x", @@ -92,38 +102,37 @@ describe("program data builder", () => { }); }); -describe("renderProgram", () => { - test("renders every section, a tracked ref, and next/long-term items from fixtures", async () => { +describe("renderProgram (projects index, #1121)", () => { + test("renders the index: every configured project card, live blocks, unset gap", async () => { const src = fixtureSource(); const items = await src.items(programRefs()); - const data = buildProgramData(items, await src.projects(), await src.orchestration()); + const pool = await src.projects(); + const rows = await src.roadmap(); + const data = { + ...buildProgramData(items, pool, await src.orchestration()), + projects: buildProjectSummaries(PROJECT_CONFIGS, pool, rows), + }; const html = renderProgram(data, items, PROV); - for (const heading of [ - "Program status", - "What this is — architecture", - "Live status", - "What's built", - "What's next", - "Long-term roadmap", - "Known gaps", - ]) { - expect(html).toContain(heading); + expect(html).toContain("Program status — projects"); + // One card + route per configured project. + for (const c of PROJECT_CONFIGS) { + expect(html).toContain(c.title.replace(/&/g, "&")); + expect(html).toContain(`href="/program/${c.id}"`); } - // A tracked-issue ref renders (resolved or honestly unresolved). + // The pm-dashboard tracked table rides on the index. expect(html).toContain("developing-today/code#910"); expect(html).toContain("unresolved"); - // Next + long-term editorial items, each with its tracker named. - expect(html).toContain("Wire the work-picking jobs to the orchestrator"); - expect(html).toContain("Cozystack"); // Fixtures carry no pool and no orchestration: both say so. expect(html).toContain("No Project pool in the current feed"); expect(html).toContain("no orchestration section in the current feed yet"); // The design record + Project links are present. expect(html).toContain("2026-10-24T11-05-38Z_design_project-management-stack"); expect(html).toContain("https://github.com/orgs/developing-today/projects/4"); + // The full pm doc is one click away, not gone. + expect(html).toContain('href="/program/pm-dashboard"'); }); - test("renders resolved states, pool counts, and freshness when data exists", () => { + test("index shows pool counts, freshness, and the unset-Area gap when data exists", () => { const item: GhItem = { ref: "developing-today/code#910", kind: "issue", @@ -135,16 +144,164 @@ describe("renderProgram", () => { updatedAt: "2026-10-26T17:00:00Z", }; const items = new Map([[item.ref, item]]); - const pool = [poolItem({ status: "Done", area: "pm-dashboard" })]; + const pool = [poolItem({ status: "Done", area: "pm-dashboard" }), poolItem({ status: "Todo", area: null })]; const section = { generatedAt: "2026-10-26T17:00:00Z", runId: "orch-2026-10-26T17:00:00Z", } as OrchestrationSection; - const html = renderProgram(buildProgramData(items, pool, section), items, PROV); + const data = { + ...buildProgramData(items, pool, section), + projects: buildProjectSummaries(PROJECT_CONFIGS, pool, FIXTURE_ROADMAP), + }; + const html = renderProgram(data, items, PROV); expect(html).toContain("Org Project layer"); - expect(html).toContain("1 items"); + expect(html).toContain("2 items"); expect(html).toContain("Done: 1"); expect(html).toContain("orch-2026-10-26T17:00:00Z"); + expect(html).toContain("carry no Area"); expect(PROGRAM.done.length).toBeGreaterThan(0); }); }); + +// --- Project registry (#1120) ------------------------------------------------- + +describe("project registry", () => { + test("the shipped registry is valid and has the six v1 projects", () => { + expect(validateProjectConfigs(PROJECT_CONFIGS)).toEqual([]); + expect(PROJECT_CONFIGS.map((c) => c.id)).toEqual([ + "pm-dashboard", + "lab-cluster", + "id", + "repo-fleet", + "mcpx", + "cloud-program", + ]); + // pm-dashboard migrated with no content loss: editorial IS the doc. + const pm = projectConfigById("pm-dashboard"); + expect(pm?.editorial?.done).toBe(PROGRAM.done); + expect(pm?.editorial?.next).toBe(PROGRAM.next); + expect(pm?.architecture).toBe(PROGRAM.architecture); + expect(pm?.trackedRefs).toBe(TRACKED_REFS); + expect(projectConfigById("nope")).toBeUndefined(); + }); + + test("validation catches duplicates and malformed entries", () => { + const base: ProjectConfig = { + id: "x-proj", + title: "X", + intro: "x", + poolArea: "area-x", + roadmapArea: "Area X", + trackedRefs: ["developing-today/code#1"], + }; + const dup: ProjectConfig = { ...base, title: "X2" }; + const errors = validateProjectConfigs([base, dup]); + expect(errors.some((e) => e.includes("duplicate project id"))).toBe(true); + expect(errors.some((e) => e.includes("poolArea"))).toBe(true); + expect(errors.some((e) => e.includes("roadmapArea"))).toBe(true); + const bad = validateProjectConfigs([ + { ...base, id: "Not A Slug", poolArea: null, roadmapArea: null, trackedRefs: ["nope"] }, + ]); + expect(bad.some((e) => e.includes("not a slug"))).toBe(true); + expect(bad.some((e) => e.includes("malformed ref"))).toBe(true); + }); + + test("summaries derive pool/roadmap counts per project; unset is counted once", () => { + const pool = [ + poolItem({ status: "Done", area: "pm-dashboard" }), + poolItem({ status: "Todo", area: "pm-dashboard" }), + poolItem({ status: "Todo", area: "id-train" }), + poolItem({ status: null, area: null }), + ]; + const summaries = buildProjectSummaries(PROJECT_CONFIGS, pool, FIXTURE_ROADMAP); + const byId = new Map(summaries.map((s) => [s.id, s])); + expect(byId.get("pm-dashboard")?.poolTotal).toBe(2); + expect(byId.get("pm-dashboard")?.poolByStatus).toContainEqual({ name: "Done", count: 1 }); + expect(byId.get("pm-dashboard")?.roadmapRows).toBe(5); // fixture seed "PM stack" + expect(byId.get("id")?.poolTotal).toBe(1); + expect(byId.get("id")?.roadmapRows).toBe(7); // fixture seed area "id" + expect(byId.get("repo-fleet")?.roadmapRows).toBe(4); + expect(byId.get("lab-cluster")?.roadmapRows).toBe(6); + // Null-area projects claim nothing, however much pool exists. + expect(byId.get("mcpx")?.poolTotal).toBe(0); + expect(byId.get("cloud-program")?.roadmapRows).toBe(0); + expect(unsetPoolCount(pool)).toBe(1); + }); + + test("allProjectRefs covers every project's tracked + editorial refs, de-duplicated", () => { + const refs = allProjectRefs(); + for (const r of TRACKED_REFS) expect(refs).toContain(r); + expect(refs).toContain("developing-today/code#1080"); // lab-cluster epic + expect(refs).toContain("developing-today/code#911"); // repo-fleet + pm next + expect(refs).toContain("dezren39/nix#254"); // mcpx editorial + expect(new Set(refs).size).toBe(refs.length); + }); +}); + +// --- Per-project pages (#1121) -------------------------------------------------- + +describe("renderProgramProject", () => { + test("every configured project renders from fixtures, nulls stated honestly", async () => { + const src = fixtureSource(); + const items = await src.items(allProjectRefs()); + const pool = await src.projects(); + const rows = await src.roadmap(); + for (const config of PROJECT_CONFIGS) { + const html = renderProgramProject(buildProjectDetail(config, items, pool, rows), items, PROV); + expect(html).toContain(config.title.replace(/&/g, "&")); + expect(html).toContain("Live status — tracked issues"); + expect(html).toContain("Project pool — live"); + expect(html).toContain("Roadmap — live"); + } + // Null-area projects say so, with the gap, instead of empty sections. + const mcpx = projectConfigById("mcpx")!; + const mcpxHtml = renderProgramProject(buildProjectDetail(mcpx, items, pool, rows), items, PROV); + expect(mcpxHtml).toContain("No dedicated Project Area yet"); + expect(mcpxHtml).toContain("No Grist roadmap area yet"); + expect(mcpxHtml).toContain("planning/roadmaps/mcpx.md"); + const cloud = projectConfigById("cloud-program")!; + const cloudHtml = renderProgramProject(buildProjectDetail(cloud, items, pool, rows), items, PROV); + expect(cloudHtml).toContain("No home doc configured"); + expect(cloudHtml).toContain("/quota"); + }); + + test("pm-dashboard page retains the full #1046 document", async () => { + const src = fixtureSource(); + const items = await src.items(allProjectRefs()); + const pm = projectConfigById("pm-dashboard")!; + const html = renderProgramProject( + buildProjectDetail(pm, items, await src.projects(), await src.roadmap()), + items, + PROV, + ); + for (const heading of [ + "What this is — architecture", + "What's built", + "What's next", + "Long-term roadmap", + "Known gaps", + ]) { + expect(html).toContain(heading); + } + expect(html).toContain("Wire the work-picking jobs to the orchestrator"); + expect(html).toContain("Cozystack"); + expect(html).toContain("2026-10-24T11-05-38Z_design_project-management-stack"); + }); + + test("detail builder filters pool by Area and rows by roadmap area", () => { + const pool = [ + poolItem({ status: "Done", area: "id-train", title: "b item" }), + poolItem({ status: "Todo", area: "id-train", title: "a item" }), + poolItem({ status: "Todo", area: "pm-dashboard", title: "other" }), + poolItem({ status: null, area: null, title: "unset" }), + ]; + const id = projectConfigById("id")!; + const detail = buildProjectDetail(id, new Map(), pool, FIXTURE_ROADMAP); + expect(detail.poolItems.map((p) => p.title)).toEqual(["b item", "a item"]); // status-sorted + expect(detail.poolByStatus).toContainEqual({ name: "Done", count: 1 }); + expect(detail.roadmapRows.length).toBe(7); + expect(detail.roadmapRows.every((r) => r.area === "id")).toBe(true); + expect(detail.unsetPoolCount).toBe(1); + expect(detail.tracked.every((t) => t.item === null)).toBe(true); // unresolved, not invented + }); +}); diff --git a/pm-stack/aggregator/test/render.test.ts b/pm-stack/aggregator/test/render.test.ts index 71cbd4a0f2..edaa919bab 100644 --- a/pm-stack/aggregator/test/render.test.ts +++ b/pm-stack/aggregator/test/render.test.ts @@ -159,7 +159,7 @@ describe("fixture source", () => { const board = await src.board(); const rows = await src.roadmap(); expect(board.length).toBeGreaterThan(0); - expect(rows.length).toBe(16); // the real Grist seed + expect(rows.length).toBe(23); // the real Grist seed (grew 16 → 23 with the cluster/id rows) const crossRepo = board.find((b) => b.id.includes("aggregator")); expect(crossRepo?.links.some((l) => l.ref.startsWith("developing-today/openchamber"))).toBe(true); });