Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
chore(ui): page shape and copy for system map v2 (#4622)
Raghav Chamadiya97c528d9c0f4
diff --git a/packages/ui/__tests__/workspace/system-map-draw-budget.test.ts b/packages/ui/__tests__/workspace/system-map-draw-budget.test.tsindex 5ceeab028..aa12b4521 100644--- a/packages/ui/__tests__/workspace/system-map-draw-budget.test.ts+++ b/packages/ui/__tests__/workspace/system-map-draw-budget.test.ts@@ -6,6 +6,7 @@ import {EDGE_FAMILY_ORDER,edgeFamily,familyCounts,+ familyTally,linkWeight,} from "../../src/workspace/system-map/edge-families";import { EDGE_KIND_ORDER, SYSTEM_EDGE_KINDS } from "../../src/workspace/system-map/edge-kinds";@@ -32,6 +33,16 @@ describe("edge families", () => {expect(counts).toEqual({ runtime: { edges: 2, links: 4 }, build: { edges: 1, links: 1 } });expect(linkWeight({ weight: 0 })).toBe(1);});++ it("tallies present families in chip order, drawn or hidden by the filter", () => {+ const edges = [edge("a", "b", "co_change"), edge("a", "c", "package", 4), edge("b", "c", "http"), edge("c", "d", "event")];+ expect(familyTally(edges, DEFAULT_EDGE_FAMILIES)).toEqual([+ { family: "runtime", edges: 2, drawn: true },+ { family: "build", edges: 1, drawn: false },+ { family: "history", edges: 1, drawn: false },+ ]);+ expect(familyTally([], DEFAULT_EDGE_FAMILIES)).toEqual([]);+ });});describe("allocateSlots", () => {diff --git a/packages/ui/src/workspace/system-map/edge-families.ts b/packages/ui/src/workspace/system-map/edge-families.tsindex aef0b40d9..75ea99ef7 100644--- a/packages/ui/src/workspace/system-map/edge-families.ts+++ b/packages/ui/src/workspace/system-map/edge-families.ts@@ -65,6 +65,30 @@ export function linkWeight(edge: { weight: number }): number {return edge.weight > 1 ? edge.weight : 1;}+export interface FamilyTally {+ family: EdgeFamily;+ /** System edges of the family, the unit the chips and the caption count. */+ edges: number;+ /** Whether the family filter draws it. */+ drawn: boolean;+}++/**+ * Edges per present family in chip order, each marked drawn or hidden by+ * `drawn`: what a host's lede and figures say about the map, from the same+ * counts the chips and caption read.+ */+export function familyTally(+ edges: Iterable<{ kind: string; family?: string | null | undefined; weight: number }>,+ drawn: ReadonlySet<EdgeFamily>,+): FamilyTally[] {+ const counts = familyCounts(edges);+ return EDGE_FAMILY_ORDER.flatMap((family) => {+ const count = counts[family];+ return count ? [{ family, edges: count.edges, drawn: drawn.has(family) }] : [];+ });+}+/** How a family is named on its chip, in the caption and in the legend. */export const EDGE_FAMILY_COPY: Record<EdgeFamily, { label: string; meaning: string }> = {runtime: { label: "Runtime", meaning: "calls and events" },diff --git a/packages/ui/src/workspace/system-map/index.ts b/packages/ui/src/workspace/system-map/index.tsindex f7487c563..a83f1cae4 100644--- a/packages/ui/src/workspace/system-map/index.ts+++ b/packages/ui/src/workspace/system-map/index.ts@@ -196,9 +196,11 @@ export {edgeFamily,edgeFamilyOf,familyCounts,+ familyTally,linkWeight,type EdgeFamily,type FamilyCount,+ type FamilyTally,} from "./edge-families";export type {DrawBudget,diff --git a/packages/ui/src/workspace/system-map/system-map-blast-panel.tsx b/packages/ui/src/workspace/system-map/system-map-blast-panel.tsxindex 755e00fa4..7f6276132 100644--- a/packages/ui/src/workspace/system-map/system-map-blast-panel.tsx+++ b/packages/ui/src/workspace/system-map/system-map-blast-panel.tsx@@ -125,7 +125,7 @@ export function SystemMapBlastPanel({<div className="p-3 text-[var(--color-text-tertiary)]">{result.targets.length === 0? "No matching service in the graph."- : "Nothing downstream — no other service depends on this one."}+ : "Nothing downstream: no other service depends on this one."}</div>)}diff --git a/packages/ui/src/workspace/system-map/system-map-legend.tsx b/packages/ui/src/workspace/system-map/system-map-legend.tsxindex 19353dba1..f09e2f65a 100644--- a/packages/ui/src/workspace/system-map/system-map-legend.tsx+++ b/packages/ui/src/workspace/system-map/system-map-legend.tsx@@ -100,7 +100,7 @@ export function SystemMapLegend({ matchTypes, gatewayRouted = 0, bands = false }return (<div className="flex flex-wrap items-center gap-x-5 gap-y-1.5">- {bands && <Item swatch={<BandSwatch />} label="Band: every link between two cards, width and number are the count" />}+ {bands && <Item swatch={<BandSwatch />} label="Band: every link between two cards; its width and number give the count" />}{lines.map((m) => (<Itemkey={m}@@ -128,7 +128,7 @@ export function SystemMapLegend({ matchTypes, gatewayRouted = 0, bands = false }<span className="text-xs text-[var(--color-text-tertiary)]">{bands? "Hover a band for its kinds. Open a group to see its services. Click anything for details."- : "Hover a line for its kind and weight. Click a service or line for details."}+ : "Hover a line for its kind and link count. Click a service or line for details."}</span></div>);diff --git a/packages/ui/src/workspace/system-map/system-map.tsx b/packages/ui/src/workspace/system-map/system-map.tsxindex 7bd43aa8e..73f9f0065 100644--- a/packages/ui/src/workspace/system-map/system-map.tsx+++ b/packages/ui/src/workspace/system-map/system-map.tsx@@ -55,6 +55,8 @@ export interface SystemMapProps {overlay?: SystemMapOverlay;/** Per-service architecture role, named on cards and in the rail (optional). */roleByNodeId?: ReadonlyMap<string, NodeArchitectureRole>;+ /** The section heading, in the title row beside the lens. */+ title?: string;/** The lens control, in the title row. */toolbar?: ReactNode;/** More title-row controls after the lens (search, a between picker). */@@ -250,6 +252,7 @@ function SystemMapInner(props: SystemMapProps) {<GraphCanvasShellvariant="section"breadcrumb={breadcrumb}+ title={props.title}titleActions={toolbar || extraActions || betweenControl ? <>{toolbar}{extraActions}{betweenControl}</> : undefined}banner={banner}rail={railNode}diff --git a/packages/web/messages/en.json b/packages/web/messages/en.jsonindex d0a8c1fbe..14b22932e 100644--- a/packages/web/messages/en.json+++ b/packages/web/messages/en.json@@ -1987,26 +1987,25 @@"title": "System map","description": "Services and the typed relationships between them, rebuilt from code and git history on every workspace update.","section": {- "title": "Services and relationships",- "description": "Each box is a service; each line is a contract, import or co-change between two of them. Pick a lens to ask the map one question at a time."+ "title": "Services and relationships"},"evidence": {"partial": "Partial evidence","insufficient": "Not determined"},"lede": {- "label": "Architecture score",- "labelHint": "A 1 to 10 roll-up of propagation cost, the size of the cyclic core, dependency cycles and rule violations, over structural edges only. Higher means less coupled.",- "unit": "out of 10",- "counts": "{services, plural, one {# service} other {# services}} in {repos, plural, one {# repository} other {# repositories}}, joined by {relationships, plural, one {# relationship} other {# relationships}}: {structural} structural (a contract or import in code) and {behavioral} co-change (files that change in the same commits, not a call).",- "cycleMore": "{count, plural, one {# more cycle is} other {# more cycles are}} listed under Needs attention.",- "cycleOne": "It is listed under Needs attention with a prompt to break it.",- "noCycles": "No dependency cycles: every service can change without a loop back to itself.",- "reachAndScore": "On average a service reaches {pct}% of the others through dependencies, and {core}. Those two figures drive the score.",- "coreForms": "{count, plural, one {# service forms} other {# services form}} the cyclic core",- "noCore": "there is no cyclic core",- "cycleDepend": "{names} depend on each other",- "cycleTail": ", a dependency cycle: none of them can change a contract, build or deploy alone."+ "estate": "{services, plural, one {# service} other {# services}} in {repos, plural, one {# repository} other {# repositories}}.",+ "pair": "{estate} {rest}",+ "familyCount": "{count} {family}",+ "family": {+ "runtime": "runtime",+ "data": "data",+ "build": "build",+ "history": "history"+ },+ "drawn": "The edge filter shows {families} {total, plural, one {relationship} other {relationships}}.",+ "drawnAndHidden": "The edge filter shows {drawn} {drawnTotal, plural, one {relationship} other {relationships}} and hides {hidden}.",+ "allHidden": "The edge filter hides all {families} {total, plural, one {relationship} other {relationships}}."},"lens": {"none": {@@ -2045,10 +2044,10 @@"services": "Services","servicesSub": "in {count, plural, one {# repository} other {# repositories}}","relationships": "Relationships",- "relationshipsSub": "{structural} structural, {behavioral} co-change",- "propagationCost": "Propagation cost",- "propagationCostSub": "of other services the average one reaches",- "propagationCostHint": "The share of other services the average service can reach through structural dependencies. 0% is fully decoupled, 100% is everything reaching everything.",+ "score": "Architecture score",+ "scoreUnit": "out of 10",+ "scoreSub": "out of 10; the average service reaches {pct}% of the others",+ "scoreHint": "A 1 to 10 roll-up of propagation cost, the size of the cyclic core, dependency cycles and rule violations, over structural edges only. Higher means less coupled. Propagation cost is the share of other services the average service reaches through structural dependencies.","contractLinks": "Contract links","contractLinksSub": "from {providers} providers, {consumers} consumers","contractLinksHint": "Consumer calls matched to the provider that serves them, across services.",diff --git a/packages/web/messages/zh-CN.json b/packages/web/messages/zh-CN.jsonindex be832928c..d126816dc 100644--- a/packages/web/messages/zh-CN.json+++ b/packages/web/messages/zh-CN.json@@ -1987,26 +1987,25 @@"title": "系统地图","description": "服务及它们之间的带类型关系,每次工作区更新都会从代码与 git 历史重建。","section": {- "title": "服务与关系",- "description": "每个方块是一个服务;每条连线是两者之间的契约、导入或共同变更。选择一个视角,一次向这张图提一个问题。"+ "title": "服务与关系"},"evidence": {"partial": "证据不完整","insufficient": "无法确定"},"lede": {- "label": "架构评分",- "labelHint": "对影响范围、循环核心规模、依赖循环与规则违反的 1 到 10 综合评分,仅统计结构边。分数越高表示耦合越低。",- "unit": "满分 10",- "counts": "{services} 个服务分布在 {repos} 个仓库中,由 {relationships} 条关系相连:{structural} 条结构关系(代码中的契约或导入)与 {behavioral} 条共同变更关系(在同一批提交中一起改动的文件,而非调用)。",- "cycleMore": "另有 {count} 个循环列在「需要注意」下。",- "cycleOne": "它列在「需要注意」下,并附有一段打破它的提示词。",- "noCycles": "没有依赖循环:每个服务都可以在不形成回环的情况下变更。",- "reachAndScore": "平均而言,一个服务通过依赖可触达其他服务的 {pct}%,并且{core}。这两个数字决定了评分。",- "coreForms": "{count} 个服务构成循环核心",- "noCore": "不存在循环核心",- "cycleDepend": "{names} 互相依赖",- "cycleTail": ",形成一个依赖循环:其中任何一个都无法单独变更契约、构建或部署。"+ "estate": "{services} 个服务,分布在 {repos} 个仓库中。",+ "pair": "{estate}{rest}",+ "familyCount": "{count} 条{family}",+ "family": {+ "runtime": "运行时",+ "data": "数据",+ "build": "构建",+ "history": "历史"+ },+ "drawn": "边筛选显示 {families}关系。",+ "drawnAndHidden": "边筛选显示 {drawn}关系,隐藏 {hidden}关系。",+ "allHidden": "边筛选隐藏了全部 {families}关系。"},"lens": {"none": {@@ -2045,10 +2044,10 @@"services": "服务","servicesSub": "分布在 {count} 个仓库中","relationships": "关系",- "relationshipsSub": "{structural} 条结构关系,{behavioral} 条共同变更",- "propagationCost": "影响范围",- "propagationCostSub": "平均每个服务可触达的其他服务比例",- "propagationCostHint": "平均每个服务通过结构依赖可触达的其他服务的比例。0% 表示完全解耦,100% 表示一切都互相触达。",+ "score": "架构评分",+ "scoreUnit": "满分 10",+ "scoreSub": "满分 10;平均每个服务可触达其他服务的 {pct}%",+ "scoreHint": "对影响范围、循环核心规模、依赖循环与规则违反的 1 到 10 综合评分,仅统计结构边。分数越高表示耦合越低。影响范围指平均每个服务通过结构依赖可触达的其他服务比例。","contractLinks": "契约链接","contractLinksSub": "来自 {providers} 个提供方、{consumers} 个消费方","contractLinksHint": "跨服务匹配到对应提供方的消费方调用。",diff --git a/packages/web/src/app/workspace/system-map/map-summary.ts b/packages/web/src/app/workspace/system-map/map-summary.tsnew file mode 100644index 000000000..6012865e2--- /dev/null+++ b/packages/web/src/app/workspace/system-map/map-summary.ts@@ -0,0 +1,121 @@+/**+ * The words and figures around the map: the one-sentence lede above it and+ * the figures ribbon below it. Both count relationships per edge family from+ * the same tally the family chips read, for the same families the filter draws.+ */++import { useCallback } from "react";+import { useFormatter } from "next-intl";+import { familyTally, type EdgeFamily, type FamilyTally } from "@repowise-dev/ui/workspace/system-map";+import type { RibbonStat } from "@repowise-dev/ui/stats/stat-ribbon";+import { formatNumber } from "@repowise-dev/ui/lib/format";+import { unmatchedOutsideService } from "@repowise-dev/ui/workspace/contract-facts";+import type { ExtractionDiagnostics, SystemGraph, WorkspaceArchitectureResponse } from "@/lib/api/types";+import { httpLinkedStat } from "@/lib/http-link-coverage";++/** The minimal translator shape the copy helpers need; next-intl's `t` fits. */+export type Translator = (key: string, values?: Record<string, string | number>) => string;++/** Joins phrases the locale's way ("a, b and c"). */+export type ListJoin = (parts: string[]) => string;++export function useListJoin(): ListJoin {+ const format = useFormatter();+ return useCallback<ListJoin>((parts) => format.list(parts, { type: "conjunction" }), [format]);+}++function repoCount(graph: SystemGraph): number {+ return new Set(graph.nodes.map((n) => n.repo)).size;+}++/** "4 runtime" per family, in chip order. */+function familyCounts(t: Translator, rows: readonly FamilyTally[]): string[] {+ return rows.map((r) => t("lede.familyCount", { count: r.edges, family: t(`lede.family.${r.family}`) }));+}++/** "4 runtime and 6 history", with the edge total the plural agrees with. */+function familyPhrase(t: Translator, join: ListJoin, rows: readonly FamilyTally[]) {+ return { families: join(familyCounts(t, rows)), total: rows.reduce((sum, r) => sum + r.edges, 0) };+}++/**+ * "10 services in 3 repositories. The edge filter shows 4 runtime and 4 data+ * relationships and hides 4 build and 6 history." Whole-estate counts per+ * family the filter selects; what a level or the draw budget leaves out is+ * the map caption's to say, beside the canvas. Null before there is a service to state.+ */+export function mapLede(+ t: Translator,+ join: ListJoin,+ graph: SystemGraph | null,+ drawn: ReadonlySet<EdgeFamily>,+): string | null {+ if (!graph || graph.nodes.length === 0) return null;+ const estate = t("lede.estate", { services: graph.nodes.length, repos: repoCount(graph) });+ const tally = familyTally(graph.edges, drawn);+ if (tally.length === 0) return estate;+ const shown = tally.filter((r) => r.drawn);+ const hidden = familyPhrase(t, join, tally.filter((r) => !r.drawn));+ if (shown.length === 0) return t("lede.pair", { estate, rest: t("lede.allHidden", hidden) });+ const drawnPhrase = familyPhrase(t, join, shown);+ if (hidden.total === 0) return t("lede.pair", { estate, rest: t("lede.drawn", drawnPhrase) });+ const rest = t("lede.drawnAndHidden", {+ drawn: drawnPhrase.families,+ drawnTotal: drawnPhrase.total,+ hidden: hidden.families,+ hiddenTotal: hidden.total,+ });+ return t("lede.pair", { estate, rest });+}++/** The estate's figures, under the map. */+export function mapRibbon(+ t: Translator,+ tLinks: Translator,+ join: ListJoin,+ graph: SystemGraph,+ architecture: WorkspaceArchitectureResponse | null,+ diag: ExtractionDiagnostics | null | undefined,+): RibbonStat[] {+ const families = familyTally(graph.edges, new Set());+ return [+ {+ label: t("ribbon.services"),+ value: formatNumber(graph.nodes.length),+ sub: t("ribbon.servicesSub", { count: repoCount(graph) }),+ },+ {+ label: t("ribbon.relationships"),+ value: formatNumber(graph.edges.length),+ sub: families.length > 0 ? join(familyCounts(t, families)) : undefined,+ },+ {+ label: t("ribbon.score"),+ // Null when the graph's evidence is insufficient; the notice above the map says why.+ value: architecture?.score != null ? architecture.score.toFixed(1) : "–",+ sub:+ architecture?.propagation_cost_pct != null+ ? t("ribbon.scoreSub", { pct: architecture.propagation_cost_pct.toFixed(1) })+ : t("ribbon.scoreUnit"),+ hint: t("ribbon.scoreHint"),+ },+ {+ label: t("ribbon.contractLinks"),+ value: diag ? formatNumber(diag.total_links) : "–",+ sub: diag+ ? t("ribbon.contractLinksSub", {+ providers: formatNumber(diag.total_providers),+ consumers: formatNumber(diag.total_consumers),+ })+ : undefined,+ hint: t("ribbon.contractLinksHint"),+ },+ // An artifact older than the linked count keeps the unmatched stat.+ (diag && httpLinkedStat(tLinks, diag)) ?? {+ label: t("ribbon.unmatched"),+ value: diag ? formatNumber(unmatchedOutsideService(diag).length) : "–",+ sub: t("ribbon.unmatchedSub"),+ hint: t("ribbon.unmatchedHint"),+ },+ ];+}diff --git a/packages/web/src/app/workspace/system-map/page.tsx b/packages/web/src/app/workspace/system-map/page.tsxindex 9da6a7c8d..27c926edb 100644--- a/packages/web/src/app/workspace/system-map/page.tsx+++ b/packages/web/src/app/workspace/system-map/page.tsx@@ -16,6 +16,7 @@ import {buildBlastRadiusOverlay,buildBreakingChangeOverlay,buildConformanceOverlay,+ drawnFamilies,parseMapView,selectionRepo,writeMapView,@@ -27,18 +28,9 @@ import {type SystemMapSelection,} from "@repowise-dev/ui/workspace/system-map";import { PageShell } from "@repowise-dev/ui/shared/page-shell";-import { PageLede } from "@repowise-dev/ui/shared/page-lede";-import { StatRibbon, type RibbonStat } from "@repowise-dev/ui/stats/stat-ribbon";-import { OverviewSection } from "@repowise-dev/ui/overview/section";+import { StatRibbon } from "@repowise-dev/ui/stats/stat-ribbon";import { Skeleton } from "@repowise-dev/ui/ui/skeleton";-import { formatNumber } from "@repowise-dev/ui/lib/format";-import { unmatchedOutsideService } from "@repowise-dev/ui/workspace/contract-facts";-import type {- ConformanceReport,- ExtractionDiagnostics,- NodeArchitectureRole,- SystemGraph,-} from "@/lib/api/types";+import type { ConformanceReport, NodeArchitectureRole, SystemGraph } from "@/lib/api/types";import {useWorkspaceSystemGraph,useWorkspaceDiagnostics,@@ -48,8 +40,8 @@ import {useWorkspaceConformance,useWorkspaceArchitecture,} from "@/lib/hooks/use-workspace";-import { httpLinkedStat } from "@/lib/http-link-coverage";import { markSystemMap, useSystemMapPerfMarks } from "@/lib/system-map-perf";+import { mapLede, mapRibbon, useListJoin, type Translator } from "./map-summary";import { useRepoContracts } from "./use-repo-contracts";import { useServiceLinks } from "./use-service-links";@@ -57,9 +49,6 @@ const LENSES: readonly SystemMapLens[] = ["none", "blast", "breaking", "conforma/** URL params a selection is written to, one per selection type. */const SELECTION_PARAMS = ["node", "edge", "group", "band"] as const;-/** The minimal translator shape the copy helpers below need; next-intl's `t` fits. */-type Translator = (key: string, values?: Record<string, string | number>) => string;-function contractHref(ref: ContractRef): string {const params = new URLSearchParams({ contract: ref.contract_id, repo: ref.repo });if (ref.file_path) params.set("file", ref.file_path);@@ -73,6 +62,7 @@ function contractsHref(repo: string): string {export default function SystemMapPage() {const t = useTranslations("systemMap");const tLinks = useTranslations("linkCoverage");+ const join = useListJoin();const router = useRouter();const searchParams = useSearchParams();@@ -232,16 +222,13 @@ export default function SystemMapPage() {<PageShelltitle={t("title")}icon={<Waypoints />}- description={t("description")}+ // One sentence above the map, stated for the families it draws; the figures follow the map.+ description={mapLede(t, join, graph, drawnFamilies(mapView)) ?? t("description")}maxWidth="wide">- {graph && (- <Lede graph={graph} architecture={architecture} conformance={conformance} t={t} />- )}- {graph && <StatRibbon stats={ribbon(t, tLinks, graph, architecture, diagnostics)} LinkComponent={Link} />}-- <OverviewSection title={t("section.title")} description={t("section.description")}>- {/* Said once, beside the map it qualifies; the score above reads "–" when not determined. */}+ {/* The map is the page's subject: its heading shares the lens row, straight under the lede. */}+ <section className="flex flex-col gap-3" aria-label={t("section.title")}>+ {/* Said once, beside the map it qualifies; the score below reads "–" when not determined. */}<SystemMapEvidenceNoticeevidence={architecture?.evidence}partialLabel={t("evidence.partial")}@@ -266,6 +253,7 @@ export default function SystemMapPage() {onSelectionChange={onSelectionChange}view={mapView}onViewChange={onViewChange}+ title={t("section.title")}estateLabel={t("estate")}onPhase={markSystemMap}drawer={drawer}@@ -284,7 +272,9 @@ export default function SystemMapPage() {}/>)}- </OverviewSection>+ </section>++ {graph && <StatRibbon stats={mapRibbon(t, tLinks, join, graph, architecture, diagnostics)} LinkComponent={Link} />}{graph && (<SystemMapLensResults@@ -389,122 +379,3 @@ function lensOptionsFor(},];}--function Lede({- graph,- architecture,- conformance,- t,-}: {- graph: SystemGraph;- architecture: ReturnType<typeof useWorkspaceArchitecture>["data"];- conformance: ConformanceReport | null;- t: Translator;-}) {- const name = (id: string) => graph.nodes.find((n) => n.id === id)?.name ?? id;- const repos = new Set(graph.nodes.map((n) => n.repo)).size;- const structural = graph.edges.filter((e) => e.structural).length;- const behavioral = graph.edges.length - structural;- const cycles = conformance?.cycles ?? [];- const totalCycles = conformance ? (conformance.total_cycles ?? conformance.cycle_count) : 0;- const first = cycles[0];-- return (- <PageLede- label={t("lede.label")}- labelHint={t("lede.labelHint")}- value={architecture?.score != null ? architecture.score.toFixed(1) : "–"}- unit={t("lede.unit")}- layout="beside"- >- <p>- {t("lede.counts", {- services: graph.nodes.length,- repos,- relationships: graph.edges.length,- structural,- behavioral,- })}- </p>- {first ? (- <p>- <span className="font-medium text-[var(--color-text-primary)]">- {t("lede.cycleDepend", { names: first.nodes.map(name).join(", ") })}- </span>- {t("lede.cycleTail")}{" "}- {totalCycles > 1- ? t("lede.cycleMore", { count: totalCycles - 1 })- : t("lede.cycleOne")}- </p>- ) : conformance?.generated_at ? (- <p>{t("lede.noCycles")}</p>- ) : null}- {architecture &&- architecture.propagation_cost_pct != null &&- architecture.core_size != null && (- <p>- {t("lede.reachAndScore", {- pct: architecture.propagation_cost_pct.toFixed(1),- core:- architecture.core_size > 0- ? t("lede.coreForms", { count: architecture.core_size })- : t("lede.noCore"),- })}- </p>- )}- </PageLede>- );-}--function ribbon(- t: Translator,- tLinks: Translator,- graph: SystemGraph,- architecture: ReturnType<typeof useWorkspaceArchitecture>["data"],- diag: ExtractionDiagnostics | null | undefined,-): RibbonStat[] {- const repos = new Set(graph.nodes.map((n) => n.repo)).size;- const structural = graph.edges.filter((e) => e.structural).length;- return [- {- label: t("ribbon.services"),- value: formatNumber(graph.nodes.length),- sub: t("ribbon.servicesSub", { count: repos }),- },- {- label: t("ribbon.relationships"),- value: formatNumber(graph.edges.length),- sub: t("ribbon.relationshipsSub", {- structural,- behavioral: graph.edges.length - structural,- }),- },- {- label: t("ribbon.propagationCost"),- value:- architecture?.propagation_cost_pct != null- ? `${architecture.propagation_cost_pct.toFixed(1)}%`- : "–",- sub: t("ribbon.propagationCostSub"),- hint: t("ribbon.propagationCostHint"),- },- {- label: t("ribbon.contractLinks"),- value: diag ? formatNumber(diag.total_links) : "–",- sub: diag- ? t("ribbon.contractLinksSub", {- providers: formatNumber(diag.total_providers),- consumers: formatNumber(diag.total_consumers),- })- : undefined,- hint: t("ribbon.contractLinksHint"),- },- // An artifact older than the linked count keeps the unmatched stat.- (diag && httpLinkedStat(tLinks, diag)) ?? {- label: t("ribbon.unmatched"),- value: diag ? formatNumber(unmatchedOutsideService(diag).length) : "–",- sub: t("ribbon.unmatchedSub"),- hint: t("ribbon.unmatchedHint"),- },- ];-}