Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.
HTML agent-skillsai-agentsarchitecture-diagramclaude-codeclaude-skillscodexcoding-agentsdeepseek-harnessdeveloper-toolsdiagramsdiagrams-as-codedsh-pluginflowchartllmmermaidopencodesequence-diagramsoftware-architecturesystem-designvisualization
fix(workflow,dataflow): protect label-pin evidence and all-mode legends
tt-a1ic0e6d8746971
diff --git a/archify/renderers/dataflow/render-dataflow.mjs b/archify/renderers/dataflow/render-dataflow.mjsindex 5ba10418..05dcb9c8 100644--- a/archify/renderers/dataflow/render-dataflow.mjs+++ b/archify/renderers/dataflow/render-dataflow.mjs@@ -3,7 +3,7 @@ import { fileURLToPath } from 'node:url';import { esc, renderDefinitions, renderSemanticSigil, textUnits } from '../shared/utils.mjs';import { animateAttr, focusEdgeAttrs, focusNodeAttrs, focusNodeTitle, loadDiagramWithBrandMarks, writeDiagram, svgAccessibleText, svgRootAttrs } from '../shared/cli.mjs';import { throwDiagnosticProblems } from '../shared/diagnostics.mjs';-import { resolveLegend, renderLegend as renderResolvedLegend } from '../shared/legend.mjs';+import { resolveLegend, renderLegend as renderResolvedLegend, legendFootprint } from '../shared/legend.mjs';import { availableNodeTextWidth, fittedNodeFontSize, minimumNodeTextWidth, nodeLabelLayout } from '../shared/text-fit.mjs';import { brandLabelFitWidth, brandMarkFor, brandMetadataFor, brandTopRailProblem, renderBrandMark } from '../shared/brand-marks.mjs';import { translateMessage as i18nText } from '../shared/i18n.mjs';@@ -811,7 +811,26 @@ function renderLegend() {});}+function ensureAutoLegendFits() {+ // Narrow auto canvases can wrap the legend onto extra rows. Stage frames+ // fill the canvas height, so growing height alone does not free a legend+ // band — widen just enough for a one-row pack instead.+ if (dataflow.meta?.viewBox) return;+ const presentKinds = new Set(asArray(dataflow.flows).map((flow) => flow.variant || 'default'));+ if ([...nodes.values()].some((node) => node.type === 'database')) presentKinds.add('database');+ const entries = resolveLegend(dataflow.meta?.legend, LEGEND_CATALOG, presentKinds);+ if (!entries.length) return;+ if (legendFootprint(entries, { width: Math.max(1, viewBox[0] - 80) }).extraHeight <= 0) return;+ let width = viewBox[0];+ while (width < 1600+ && legendFootprint(entries, { width: Math.max(1, width - 80) }).extraHeight > 0) {+ width += 40;+ }+ viewBox[0] = width;+}+function renderSvg() {+ ensureAutoLegendFits();// Same default-canvas contract as lifecycle: 940x720 is below the 1.55 wide// ratio, so without intrinsic-height the desktop Reader can neither narrow// nor scroll it and every default dataflow fails the browser gate.diff --git a/archify/renderers/workflow/workflow-compiler.mjs b/archify/renderers/workflow/workflow-compiler.mjsindex 98973ec5..fcfdf285 100644--- a/archify/renderers/workflow/workflow-compiler.mjs+++ b/archify/renderers/workflow/workflow-compiler.mjs@@ -2276,6 +2276,12 @@ function routeContainsChannelPin(points, field, value) {function hasClearStraightAutomaticRoute(edge) {if (!independentAutomaticRoute(edge) || edge.from === edge.to) return false;+ // Relative label pins are not absolute, but they still participate in+ // placed-label conflict evidence. Reserving a straight path for them first+ // can change which edge owns the corridor and scramble supportedFixes.+ if (edge.labelDx !== undefined || edge.labelDy !== undefined || edge.labelSegment !== undefined) {+ return false;+ }const from = nodes.get(edge.from);const to = nodes.get(edge.to);const start = anchor(from, defaultFromSide(from, to));@@ -2300,7 +2306,15 @@ function validateReadablePinnedGeometry() {// Skip during discoverFixes probes (discoverFixes === false): those probes// strip labelAt/via and would otherwise look "automatic", recreating the pin// geometry and shrinking causal pin sets (round-23 regression).- if (discoverFixes) {+ // Skip when any edge carries a relative/absolute label pin: straight-first+ // would reorder corridors and scramble placed-label conflict evidence.+ const hasLabelPins = workflow.edges.some((edge) => (+ edge.labelAt !== undefined+ || edge.labelDx !== undefined+ || edge.labelDy !== undefined+ || edge.labelSegment !== undefined+ ));+ if (discoverFixes && !hasLabelPins) {for (const edge of workflow.edges) {if (!nodes.has(edge.from) || !nodes.has(edge.to) || !hasClearStraightAutomaticRoute(edge)) continue;validateReadableRouteControls(edge);