Skip to content

Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.

fix(renderers): clear labels without rejecting existing diagrams

tt-a1i05bc389ad1bc
diff --git a/archify.zip b/archify.zip
index 9f943839..1d6b0d5f 100644
Binary files a/archify.zip and b/archify.zip differ
diff --git a/archify/examples/dataflow-product-analytics.html b/archify/examples/dataflow-product-analytics.html
index 6b4364e9..cfa2ee9d 100644
--- a/archify/examples/dataflow-product-analytics.html
+++ b/archify/examples/dataflow-product-analytics.html
@@ -5325,7 +5325,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" data-detail-anchor="" x="745" y="377" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Feature Store</text>
+ <text data-node-label="" data-detail-anchor="" x="747" y="377" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Feature Store</text>
<text data-detail="context" x="745" y="393" class="t-muted" font-size="7" text-anchor="middle">daily batch</text>
<text data-detail="fine" x="745" y="403" class="t-database" font-size="7" text-anchor="middle">derived</text>
</g>
diff --git a/archify/renderers/dataflow/render-dataflow.mjs b/archify/renderers/dataflow/render-dataflow.mjs
index c1f965dd..928bf615 100644
--- a/archify/renderers/dataflow/render-dataflow.mjs
+++ b/archify/renderers/dataflow/render-dataflow.mjs
@@ -4,8 +4,8 @@ import { esc, renderDefinitions, renderSemanticSigil, textUnits } from '../share
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 { availableNodeTextWidth, fittedNodeFontSize, minimumNodeTextWidth } from '../shared/text-fit.mjs';
-import { brandLabelFitWidth, brandMetadataFor, brandTopRailProblem, renderBrandMark } from '../shared/brand-marks.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';
import {
asArray,
@@ -371,36 +371,83 @@ function pathFor(flow) {
return routed;
}
+// Header measurement follows 276970789's #257, including the ordinal.
+// Long titles wrap at the same legible floor instead of becoming invalid input.
+function stageHeaderText(stage, index) {
+ return `${String(index + 1).padStart(2, '0')} / ${stage.label}`;
+}
+
+function renderStageHeader(stage, index, cx) {
+ const text = stageHeaderText(stage, index);
+ const font = fittedNodeFontSize(text, layout.stageW, 9, 7);
+ const available = availableNodeTextWidth(layout.stageW);
+ const open = `<text x="${cx}" y="${layout.stageY + 22}" class="t-dim" font-size="${font}" font-weight="600" text-anchor="middle">`;
+ if (minimumNodeTextWidth(text, font) <= available) return `${open}${esc(text)}</text>`;
+ const lines = [];
+ let line = '';
+ // Prefer word boundaries; split oversized words and CJK by grapheme, without
+ // dropping whitespace or splitting a combining character/emoji sequence.
+ const segmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' });
+ for (const word of text.match(/\s+|\S+/gu) || []) {
+ if (line && minimumNodeTextWidth(line + word, font) > available) {
+ lines.push(line); line = '';
+ }
+ for (const { segment } of segmenter.segment(word)) {
+ if (line && minimumNodeTextWidth(line + segment, font) > available) {
+ lines.push(line); line = '';
+ }
+ line += segment;
+ }
+ }
+ if (line) lines.push(line);
+ // Explicit node geometry is authoritative. Do not turn an old horizontal
+ // overflow into a new collision with nodes when the header area is packed.
+ const firstNodeY = Math.min(...[...nodes.values()].filter(node => node.stage === index).map(node => node.y),
+ viewBox[1] - layout.stageBottomPad);
+ const lastLineBottom = layout.stageY + 22 + (lines.length - 1) * (font + 4) + font * 0.3;
+ if (lastLineBottom > firstNodeY - 4) return `${open}${esc(text)}</text>`;
+ const content = lines.length === 1 ? esc(text) : lines.map((line, i) =>
+ `<tspan x="${cx}" dy="${i ? font + 4 : 0}">${esc(line)}</tspan>`).join('');
+ return `${open}${content}</text>`;
+}
+
function renderStage(stage, index) {
const frame = compositionFrames[index];
const cx = stageX(index);
return ` <rect data-graph-role="structural-frame" data-composition-frame-kind="stage" data-composition-frame-id="${index}" x="${frame.x}" y="${frame.y}" width="${frame.width}" height="${frame.height}" rx="${frame.radius}" class="c-lane" stroke-width="1"/>
- <text x="${cx}" y="${layout.stageY + 22}" class="t-dim" font-size="9" font-weight="600" text-anchor="middle">${String(index + 1).padStart(2, '0')} / ${esc(stage.label)}</text>`;
+ ${renderStageHeader(stage, index, cx)}`;
}
function renderNode(node) {
const fill = componentFill[node.type] || 'c-external';
const accent = componentText[node.type] || 't-muted';
const hasSub = node.sublabel != null && node.sublabel !== '';
+ const labelFontSize = fittedNodeFontSize(node.label, brandLabelFitWidth(node, node.width), 10, 8);
+ const sublabelFontSize = fittedNodeFontSize(node.sublabel, node.width, nodeTextFit.sublabelPreferred, nodeTextFit.sublabelMinimum);
+ const tagFontSize = fittedNodeFontSize(node.tag, node.width, nodeTextFit.tagPreferred, nodeTextFit.tagMinimum);
+ const textRows = [{ text: node.label, font: labelFontSize, y: 21 }];
+ if (hasSub) textRows.push({ text: node.sublabel, font: sublabelFontSize, y: 37 });
+ if (node.tag) textRows.push({ text: node.tag, font: tagFontSize, y: node.height - 11 });
+ const labelLayout = nodeLabelLayout({ width: node.width, height: node.height, rows: textRows,
+ brand: Boolean(brandMarkFor(node)) });
const sub = hasSub
- ? `\n <text data-detail="context" x="${node.cx}" y="${node.y + 37}" class="t-muted" font-size="${fittedNodeFontSize(node.sublabel, node.width, nodeTextFit.sublabelPreferred, nodeTextFit.sublabelMinimum)}" text-anchor="middle">${esc(node.sublabel)}</text>`
+ ? `\n <text data-detail="context" x="${node.cx}" y="${node.y + labelLayout.ys[1]}" class="t-muted" font-size="${sublabelFontSize}" text-anchor="middle">${esc(node.sublabel)}</text>`
: '';
const tag = node.tag
- ? `\n <text data-detail="fine" x="${node.cx}" y="${node.y + node.height - 11}" class="${accent}" font-size="${fittedNodeFontSize(node.tag, node.width, nodeTextFit.tagPreferred, nodeTextFit.tagMinimum)}" text-anchor="middle">${esc(node.tag)}</text>`
+ ? `\n <text data-detail="fine" x="${node.cx}" y="${node.y + labelLayout.ys[hasSub ? 2 : 1]}" class="${accent}" font-size="${tagFontSize}" text-anchor="middle">${esc(node.tag)}</text>`
: '';
const stage = asArray(dataflow.stages)[node.stage];
const context = stage
? `${String(node.stage + 1).padStart(2, '0')} / ${stage.label}`
: i18nText(dataflow.meta.locale, 'node.context.dataflow');
const brand = renderBrandMark(node, { x: node.x + node.width - 22, y: node.y + 6 });
- const labelFontSize = fittedNodeFontSize(node.label, brandLabelFitWidth(node, node.width), 10, 8);
const passport = { kind: node.type, sublabel: node.sublabel, tag: node.tag, context, ...brandMetadataFor(node) };
return ` <g ${focusNodeAttrs(node.id, node.label, passport, dataflow.meta.locale)}>
${focusNodeTitle(node.label, passport)}
<rect x="${node.x}" y="${node.y}" width="${node.width}" height="${node.height}" rx="6" class="c-mask"/>
<rect x="${node.x}" y="${node.y}" width="${node.width}" height="${node.height}" rx="6" class="${fill}"${animateAttr(dataflow.meta, 'node', nodeSteps.get(node.id))} stroke-width="1.5"/>
- ${renderSemanticSigil(node.type, { x: node.x + 6, y: node.y + 6 })}${brand ? `\n ${brand}` : ''}
- <text data-node-label=""${hasSub ? ' data-detail-anchor=""' : ''} x="${node.cx}" y="${node.y + 21}" class="t-primary" font-size="${labelFontSize}" font-weight="600" text-anchor="middle">${esc(node.label)}</text>${sub}${tag}
+ ${renderSemanticSigil(node.type, { x: node.x + 6, y: node.y + labelLayout.sigilY, size: labelLayout.sigilSize })}${brand ? `\n ${brand}` : ''}
+ <text data-node-label=""${hasSub ? ' data-detail-anchor=""' : ''} x="${node.x + labelLayout.x}" y="${node.y + labelLayout.ys[0]}" class="t-primary" font-size="${labelFontSize}" font-weight="600" text-anchor="middle">${esc(node.label)}</text>${sub}${tag}
</g>`;
}
diff --git a/archify/renderers/lifecycle/render-lifecycle.mjs b/archify/renderers/lifecycle/render-lifecycle.mjs
index f77878f8..1a7ae1f9 100644
--- a/archify/renderers/lifecycle/render-lifecycle.mjs
+++ b/archify/renderers/lifecycle/render-lifecycle.mjs
@@ -4,7 +4,7 @@ import { esc, renderDefinitions, renderSemanticSigil, textUnits } from '../share
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 { availableNodeTextWidth, fittedNodeFontSize, minimumNodeTextWidth } from '../shared/text-fit.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';
import {
@@ -442,18 +442,25 @@ function renderState(state) {
const fill = typeClass[state.type] || typeClass.neutral;
const accent = textClass[state.type] || 't-muted';
const hasSub = state.sublabel != null && state.sublabel !== '';
+ const labelFontSize = fittedNodeFontSize(state.label, brandLabelFitWidth(state, state.width), 10, 8);
+ const sublabelFontSize = fittedNodeFontSize(state.sublabel, state.width, stateTextFit.sublabelPreferred, stateTextFit.sublabelMinimum);
+ const tagFontSize = fittedNodeFontSize(state.tag, state.width, stateTextFit.tagPreferred, stateTextFit.tagMinimum);
+ const textRows = [{ text: state.label, font: labelFontSize, y: 21 }];
+ if (hasSub) textRows.push({ text: state.sublabel, font: sublabelFontSize, y: 37 });
+ if (state.tag) textRows.push({ text: state.tag, font: tagFontSize, y: state.height - 11 });
+ const labelLayout = nodeLabelLayout({ width: state.width, height: state.height, rows: textRows,
+ brand: Boolean(brandMarkFor(state)), side: brandMarkFor(state) ? 'left' : 'right', step: state.step });
const sub = hasSub
- ? `\n <text data-detail="context" x="${state.cx}" y="${state.y + 37}" class="t-muted" font-size="${fittedNodeFontSize(state.sublabel, state.width, stateTextFit.sublabelPreferred, stateTextFit.sublabelMinimum)}" text-anchor="middle">${esc(state.sublabel)}</text>`
+ ? `\n <text data-detail="context" x="${state.cx}" y="${state.y + labelLayout.ys[1]}" class="t-muted" font-size="${sublabelFontSize}" text-anchor="middle">${esc(state.sublabel)}</text>`
: '';
const tag = state.tag
- ? `\n <text data-detail="fine" x="${state.cx}" y="${state.y + state.height - 11}" class="${accent}" font-size="${fittedNodeFontSize(state.tag, state.width, stateTextFit.tagPreferred, stateTextFit.tagMinimum)}" text-anchor="middle">${esc(state.tag)}</text>`
+ ? `\n <text data-detail="fine" x="${state.cx}" y="${state.y + labelLayout.ys[hasSub ? 2 : 1]}" class="${accent}" font-size="${tagFontSize}" text-anchor="middle">${esc(state.tag)}</text>`
: '';
const hasBrand = Boolean(brandMarkFor(state));
const step = state.step
? `\n <text data-detail="fine" x="${state.x + (hasBrand ? 23 : 10)}" y="${state.y + 14}" class="${accent}" font-size="7" font-weight="700">${esc(state.step)}</text>`
: '';
const brand = renderBrandMark(state, { x: state.x + state.width - 22, y: state.y + 6 });
- const labelFontSize = fittedNodeFontSize(state.label, brandLabelFitWidth(state, state.width), 10, 8);
const passport = {
kind: state.type,
sublabel: state.sublabel,
@@ -465,8 +472,8 @@ function renderState(state) {
${focusNodeTitle(state.label, passport)}
<rect x="${state.x}" y="${state.y}" width="${state.width}" height="${state.height}" rx="7" class="c-mask"/>
<rect x="${state.x}" y="${state.y}" width="${state.width}" height="${state.height}" rx="7" class="${fill}"${animateAttr(lifecycle.meta, 'node', stateSteps.get(state.id))} stroke-width="1.5"/>
- ${renderSemanticSigil(state.type, { x: hasBrand ? state.x + 6 : state.x + state.width - 17, y: state.y + 6 })}${brand ? `\n ${brand}` : ''}${step}
- <text data-node-label=""${hasSub ? ' data-detail-anchor=""' : ''} x="${state.cx}" y="${state.y + 21}" class="t-primary" font-size="${labelFontSize}" font-weight="600" text-anchor="middle">${esc(state.label)}</text>${sub}${tag}
+ ${renderSemanticSigil(state.type, { x: hasBrand ? state.x + 6 : state.x + state.width - 17, y: state.y + labelLayout.sigilY, size: labelLayout.sigilSize })}${brand ? `\n ${brand}` : ''}${step}
+ <text data-node-label=""${hasSub ? ' data-detail-anchor=""' : ''} x="${state.x + labelLayout.x}" y="${state.y + labelLayout.ys[0]}" class="t-primary" font-size="${labelFontSize}" font-weight="600" text-anchor="middle">${esc(state.label)}</text>${sub}${tag}
</g>`;
}
diff --git a/archify/renderers/shared/text-fit.mjs b/archify/renderers/shared/text-fit.mjs
index 31c0b179..b56902b8 100644
--- a/archify/renderers/shared/text-fit.mjs
+++ b/archify/renderers/shared/text-fit.mjs
@@ -16,7 +16,7 @@
// `minimum` font sizes are not, because renderers set node text at different
// sizes (architecture sublabels are 9px, the rest are 7px).
-import { textUnits } from './utils.mjs';
+import { textUnits, SEMANTIC_SIGIL_INSET, SEMANTIC_SIGIL_SIZE, SEMANTIC_SIGIL_FOOTPRINT } from './utils.mjs';
// widthFactor: px of advance width per text unit, per px of font size.
// horizontalPadding: total px reserved inside the box so text never touches
@@ -47,3 +47,39 @@ export function minimumNodeTextWidth(text, minimum) {
export function availableNodeTextWidth(width) {
return width - nodeTextFit.horizontalPadding;
}
+
+// Adapted from Souptik Chakraborty's #220: shift only labels which reach a
+// corner icon. Unlike the original hard gate, a narrow valid node uses a
+// separate text row; its authored bounds and acceptance remain unchanged.
+export function nodeLabelLayout({ width, height, rows, side = 'left', brand = false, step = '' }) {
+ const result = { x: width / 2, ys: rows.map(row => row.y), sigilY: SEMANTIC_SIGIL_INSET, sigilSize: SEMANTIC_SIGIL_SIZE };
+ const labelWidth = minimumNodeTextWidth(rows[0].text, rows[0].font);
+ const stepEnd = step ? (brand ? 23 : 10) + minimumNodeTextWidth(step, 7) + 3 : 0;
+ const left = Math.max(side === 'left' ? SEMANTIC_SIGIL_FOOTPRINT + 2 : 4, stepEnd);
+ const right = width - (brand ? 26 : side === 'right' ? SEMANTIC_SIGIL_FOOTPRINT + 2 : 4);
+ if (result.x - labelWidth / 2 >= left && result.x + labelWidth / 2 <= right) return result;
+ if (labelWidth <= right - left) {
+ // Round away from the icon, retaining the node centre whenever possible.
+ result.x = Math.min(Math.floor((right - labelWidth / 2) * 10) / 10,
+ Math.max(result.x, Math.ceil((left + labelWidth / 2) * 10) / 10));
+ return result;
+ }
+ // Keep the existing font sizes and put the text below the decoration rail.
+ // Conservative ascent/descent bounds also protect CJK and fallback fonts.
+ let bottom = brand ? 22 : SEMANTIC_SIGIL_FOOTPRINT;
+ const ys = rows.map(row => {
+ const y = Math.max(row.y, Math.ceil((bottom + 2 + row.font * 1.2) * 10) / 10);
+ bottom = y + row.font * 0.3;
+ return y;
+ });
+ if (bottom <= height - 2) {
+ result.ys = ys;
+ return result;
+ }
+ // A deliberately short fixed box may have no spare row. Preserve its text
+ // and geometry, and fit only the decorative sigil in the space above it.
+ result.sigilY = 1;
+ result.sigilSize = Math.max(1, Math.min(SEMANTIC_SIGIL_SIZE,
+ Math.floor(rows[0].y - rows[0].font * 1.2 - 3)));
+ return result;
+}
diff --git a/archify/renderers/shared/utils.mjs b/archify/renderers/shared/utils.mjs
index 5226844a..766a243e 100644
--- a/archify/renderers/shared/utils.mjs
+++ b/archify/renderers/shared/utils.mjs
@@ -77,7 +77,12 @@ const SIGIL_SHAPE = {
// A quiet, renderer-owned role stamp. It is authored SVG content rather than a
// viewer overlay, so it survives canonical export while adding no focus target,
// accessible name, layout box, or interaction state of its own.
-export function renderSemanticSigil(kind, { x, y, size = 11 } = {}) {
+// Shared with label clearance so the reserved rail matches the actual icon.
+export const SEMANTIC_SIGIL_INSET = 6;
+export const SEMANTIC_SIGIL_SIZE = 11;
+export const SEMANTIC_SIGIL_FOOTPRINT = SEMANTIC_SIGIL_INSET + SEMANTIC_SIGIL_SIZE;
+
+export function renderSemanticSigil(kind, { x, y, size = SEMANTIC_SIGIL_SIZE } = {}) {
const normalized = Object.hasOwn(SIGIL_SHAPE, kind) ? kind : 'neutral';
const tone = SIGIL_TONE[normalized] || 'external';
const scale = size / 16;
diff --git a/archify/renderers/workflow/workflow-compiler.mjs b/archify/renderers/workflow/workflow-compiler.mjs
index 6bc01ea4..495ac9e7 100644
--- a/archify/renderers/workflow/workflow-compiler.mjs
+++ b/archify/renderers/workflow/workflow-compiler.mjs
@@ -21,8 +21,8 @@ import {
resolveLegend,
renderLegend as renderResolvedLegend,
} from '../shared/legend.mjs';
-import { availableNodeTextWidth, fittedNodeFontSize, minimumNodeTextWidth } from '../shared/text-fit.mjs';
-import { brandLabelFitWidth, brandMetadataFor, brandTopRailProblem, renderBrandMark } from '../shared/brand-marks.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';
import {
createMappedWorkflowCandidate,
@@ -4252,14 +4252,18 @@ function renderNode(node) {
const accent = componentText[node.type] || 't-muted';
const hasSub = node.sublabel != null && node.sublabel !== '';
const labelFontSize = fittedNodeFontSize(node.label, brandLabelFitWidth(node, node.width), nodeTextFit.labelPreferred, nodeTextFit.labelMinimum);
- const sublabelFontSize = hasSub
- ? fittedNodeFontSize(node.sublabel, node.width, nodeTextFit.sublabelPreferred, nodeTextFit.sublabelMinimum)
- : nodeTextFit.sublabelPreferred;
+ const sublabelFontSize = fittedNodeFontSize(node.sublabel, node.width, nodeTextFit.sublabelPreferred, nodeTextFit.sublabelMinimum);
+ const tagFontSize = fittedNodeFontSize(node.tag, node.width, nodeTextFit.tagPreferred, nodeTextFit.tagMinimum);
+ const textRows = [{ text: node.label, font: labelFontSize, y: 21 }];
+ if (hasSub) textRows.push({ text: node.sublabel, font: sublabelFontSize, y: 38 });
+ if (node.tag) textRows.push({ text: node.tag, font: tagFontSize, y: node.height - 12 });
+ const labelLayout = nodeLabelLayout({ width: node.width, height: node.height, rows: textRows,
+ brand: Boolean(brandMarkFor(node)) });
const sub = hasSub
- ? `\n <text data-detail="context" x="${node.cx}" y="${node.y + 38}" class="t-muted" font-size="${sublabelFontSize}" text-anchor="middle">${esc(node.sublabel)}</text>`
+ ? `\n <text data-detail="context" x="${node.cx}" y="${node.y + labelLayout.ys[1]}" class="t-muted" font-size="${sublabelFontSize}" text-anchor="middle">${esc(node.sublabel)}</text>`
: '';
const tag = node.tag
- ? `\n <text data-detail="fine" x="${node.cx}" y="${node.y + node.height - 12}" class="${accent}" font-size="${fittedNodeFontSize(node.tag, node.width, nodeTextFit.tagPreferred, nodeTextFit.tagMinimum)}" text-anchor="middle">${esc(node.tag)}</text>`
+ ? `\n <text data-detail="fine" x="${node.cx}" y="${node.y + labelLayout.ys[hasSub ? 2 : 1]}" class="${accent}" font-size="${tagFontSize}" text-anchor="middle">${esc(node.tag)}</text>`
: '';
const brand = renderBrandMark(node, { x: node.x + node.width - 22, y: node.y + 6 });
const passport = { kind: node.type, sublabel: node.sublabel, tag: node.tag, context: nodeContext(node), ...brandMetadataFor(node) };
@@ -4267,8 +4271,8 @@ function renderNode(node) {
${focusNodeTitle(node.label, passport)}
<rect x="${node.x}" y="${node.y}" width="${node.width}" height="${node.height}" rx="6" class="c-mask"/>
<rect x="${node.x}" y="${node.y}" width="${node.width}" height="${node.height}" rx="6" class="${fill}"${animateAttr(workflow.meta, 'node', nodeStep(node))} stroke-width="1.5"/>
- ${renderSemanticSigil(node.type, { x: node.x + 6, y: node.y + 6 })}${brand ? `\n ${brand}` : ''}
- <text data-node-label=""${hasSub ? ' data-detail-anchor=""' : ''} x="${node.cx}" y="${node.y + 21}" class="t-primary" font-size="${labelFontSize}" font-weight="600" text-anchor="middle">${esc(node.label)}</text>${sub}${tag}
+ ${renderSemanticSigil(node.type, { x: node.x + 6, y: node.y + labelLayout.sigilY, size: labelLayout.sigilSize })}${brand ? `\n ${brand}` : ''}
+ <text data-node-label=""${hasSub ? ' data-detail-anchor=""' : ''} x="${node.x + labelLayout.x}" y="${node.y + labelLayout.ys[0]}" class="t-primary" font-size="${labelFontSize}" font-weight="600" text-anchor="middle">${esc(node.label)}</text>${sub}${tag}
</g>`;
}
diff --git a/archify/test/label-clearance.test.mjs b/archify/test/label-clearance.test.mjs
new file mode 100644
index 00000000..2afdb571
--- /dev/null
+++ b/archify/test/label-clearance.test.mjs
@@ -0,0 +1,108 @@
+import { test, after } from 'node:test';
+import assert from 'node:assert/strict';
+import { execFileSync } from 'node:child_process';
+import fs from 'node:fs';
+import os from 'node:os';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { parse } from 'parse5';
+
+const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
+const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-label-clearance-'));
+after(() => fs.rmSync(tmp, { recursive: true, force: true }));
+let counter = 0;
+const load = file => JSON.parse(fs.readFileSync(path.join(root, file), 'utf8'));
+function find(node, predicate) {
+ return [...(predicate(node) ? [node] : []), ...(node.childNodes || []).flatMap(child => find(child, predicate))];
+}
+const attr = (node, name) => node.attrs?.find(a => a.name === name)?.value;
+const text = node => node.nodeName === '#text' ? node.value : (node.childNodes || []).map(text).join('');
+function deliver(type, doc, quality = 'standard') {
+ const id = ++counter;
+ doc.meta = { ...doc.meta, output: `case-${id}.html`, quality_profile: quality };
+ const input = path.join(tmp, `case-${id}.json`), output = path.join(tmp, `case-${id}.html`);
+ fs.writeFileSync(input, JSON.stringify(doc));
+ const receipt = JSON.parse(execFileSync(process.execPath, [path.join(root, 'bin/archify.mjs'), 'deliver', type, input, output, '--quality', quality, '--json'], { encoding: 'utf8' }));
+ assert.equal(receipt.ok, true);
+ return parse(fs.readFileSync(output, 'utf8'));
+}
+function parts(page, id) {
+ const group = find(page, n => attr(n, 'data-node-id') === id)[0];
+ assert.ok(group, id);
+ const label = find(group, n => n.tagName === 'text' && attr(n, 'data-node-label') !== undefined)[0];
+ const rect = find(group, n => n.tagName === 'rect')[0];
+ const sigil = find(group, n => attr(n, 'data-semantic-sigil') !== undefined)[0];
+ const [x, y, scale] = attr(sigil, 'transform').match(/-?[\d.]+/g).map(Number);
+ return { group, label, rect, icon: { x, y, size: scale * 16 } };
+}
+function checkLabel(p, expected) {
+ assert.equal(text(p.label), expected);
+ const x = +attr(p.label, 'x'), y = +attr(p.label, 'y'), font = +attr(p.label, 'font-size');
+ // ASCII reproductions: reserve the entire icon square, not just its paths.
+ const half = expected.length * font * 0.6 / 2, icon = p.icon;
+ assert.ok(x - half >= icon.x + icon.size || x + half <= icon.x || y - font * 1.2 >= icon.y + icon.size,
+ `label overlaps sigil: ${JSON.stringify({ x, y, font, icon })}`);
+ assert.ok(x - half >= +attr(p.rect, 'x'));
+ assert.ok(x + half <= +attr(p.rect, 'x') + +attr(p.rect, 'width'));
+}
+for (const quality of ['standard', 'showcase']) {
+ test(`previously valid narrow dataflow still delivers with full text and sigil (${quality})`, () => {
+ const doc = load('examples/product-analytics.dataflow.json');
+ const first = doc.nodes[0]; Object.assign(first, { label: 'Ingester', width: 50 });
+ delete first.brand; delete first.sublabel; delete first.tag;
+ const p = parts(deliver('dataflow', doc, quality), first.id);
+ checkLabel(p, 'Ingester');
+ assert.equal(+attr(p.rect, 'width'), 50);
+ assert.equal(p.icon.size, 11);
+ });
+ test(`long stage header wraps without rejecting or losing text (${quality})`, () => {
+ const doc = load('examples/product-analytics.dataflow.json');
+ const title = 'Stream Processing, Enrichment, and Deduplication'; doc.stages[0].label = title;
+ const header = find(deliver('dataflow', doc, quality), n => n.tagName === 'text' && text(n) === `01 / ${title}`)[0];
+ assert.ok(header);
+ const lines = find(header, n => n.tagName === 'tspan');
+ assert.ok(lines.length >= 2);
+ assert.ok(+attr(header, 'font-size') >= 7);
+ assert.ok(+attr(header, 'y') + (lines.length - 1) * 11 < 128);
+ });
+}
+for (const version of [1, 2]) {
+ test(`workflow v${version} clears PromptScript without changing box width or shrinking text`, () => {
+ const doc = version === 1 ? load('test/fixtures/v1-workflow-700x400.workflow.json') : load('examples/agent-tool-call.workflow.json');
+ const first = doc.nodes[0]; Object.assign(first, { label: 'PromptScript', width: 92 });
+ delete first.brand; delete first.sublabel; delete first.tag;
+ const p = parts(deliver('workflow', doc), first.id); checkLabel(p, 'PromptScript');
+ assert.equal(+attr(p.rect, 'width'), 92);
+ assert.equal(+attr(p.label, 'font-size'), 11);
+ });
+}
+test('a short fixed box fits only the decorative sigil while retaining text and bounds', () => {
+ const doc = load('test/fixtures/v1-workflow-700x400.workflow.json');
+ const first = doc.nodes[0]; Object.assign(first, { label: 'PromptScript', width: 92, height: 32 });
+ delete first.brand; delete first.sublabel; delete first.tag;
+ const p = parts(deliver('workflow', doc), first.id); checkLabel(p, 'PromptScript');
+ assert.equal(+attr(p.rect, 'height'), 32); assert.equal(+attr(p.label, 'font-size'), 11);
+ assert.ok(p.icon.size > 0);
+});
+test('lifecycle clears its right-hand sigil and retains the step and text details', () => {
+ const doc = load('examples/agent-run.lifecycle.json');
+ const first = doc.states[0]; Object.assign(first, { label: 'Prompt Compiler', step: '01', sublabel: 'context', tag: 'tag' });
+ delete first.brand;
+ const p = parts(deliver('lifecycle', doc), first.id); checkLabel(p, 'Prompt Compiler');
+ for (const value of ['01', 'context', 'tag']) assert.ok(find(p.group, n => n.tagName === 'text' && text(n) === value).length);
+});
+test('Chinese stage titles retain every character when wrapped', () => {
+ const doc = load('examples/product-analytics.dataflow.json');
+ const title = '用户行为采集与事件清洗标准化处理以及后续数据分发'; doc.stages[0].label = title;
+ assert.ok(find(deliver('dataflow', doc), n => n.tagName === 'text' && text(n) === `01 / ${title}`).length);
+});
+
+test('an extreme title does not wrap into the node area', () => {
+ const doc = load('examples/product-analytics.dataflow.json');
+ const title = 'Stream processing and enrichment '.repeat(12);
+ doc.stages[0].label = title;
+ const header = find(deliver('dataflow', doc), n => n.tagName === 'text' && text(n) === `01 / ${title}`)[0];
+ assert.ok(header);
+ assert.equal(find(header, n => n.tagName === 'tspan').length, 0,
+ 'keep the compatible single line when the full title cannot fit above the nodes');
+});
diff --git a/archify/test/workflow-compiler.test.mjs b/archify/test/workflow-compiler.test.mjs
index 44f94c3a..3f0a4ee6 100644
--- a/archify/test/workflow-compiler.test.mjs
+++ b/archify/test/workflow-compiler.test.mjs
@@ -26,6 +26,14 @@ function sha256(value) {
return createHash('sha256').update(value).digest('hex');
}
+// #199 intentionally changes only text positions inside fixed-v1 nodes.
+// Pin every other SVG byte to the pre-fix baseline, including labels, fonts,
+// node bounds, icon shapes, edges, ports, viewBox and accessibility metadata.
+function withoutNodeTextPositions(svg) {
+ return svg.replace(/<text\b(?=[^>]*\bdata-(?:node-label|detail)=)[^>]*>/g,
+ tag => tag.replace(/\s[xy]="[^"]*"/g, ''));
+}
+
function attribute(tag, name) {
const value = tag.match(new RegExp(`\\b${name}="([^"]*)"`))?.[1];
assert.notEqual(value, undefined, `expected ${name} in ${tag}`);
@@ -311,13 +319,13 @@ function assertReadableAdjacentResult(result, { label, widths = [92, 92] } = {})
}
}
-test('fixed-v1 compiler preserves the official workflow baseline SVG byte-for-byte', () => {
+test('fixed-v1 preserves baseline SVG except repaired node text positions', () => {
const workflow = readJson(path.join(__dirname, 'fixtures', 'v1-baseline', 'agent-tool-call.workflow.json'));
const result = compileSuccessfully(workflow);
assert.equal(result.receipt.contract, 'fixed-v1');
assert.equal(
- sha256(result.svg),
- '999c771664307079c5dd65deff996d5f172d70780a5ab3bcb6e49cb718549018',
+ sha256(withoutNodeTextPositions(result.svg)),
+ 'e64795a4521e8568718981bf053c6e8f4e0cf714e27f70f0087d1850ae1fe633',
);
});
@@ -333,9 +341,9 @@ test('fixed-v1 compiler preserves the exact 700x400 compatibility geometry', ()
assert.deepEqual(result.receipt.viewBox, [700, 400]);
assert.deepEqual(svgViewBox(result.svg), [0, 0, 700, 400]);
assert.equal(
- sha256(result.svg),
- '28b0167460d16c55ae6bf38bde41368248671a78b3a49133da05ed1efb4354af',
- 'the v1 compiler extraction must not move or reserialize legacy geometry',
+ sha256(withoutNodeTextPositions(result.svg)),
+ '79ac3e30f9e81263f9c7941339a6fe684f3a33dd2ac3ce4f7281a03fa2ee1c6b',
+ 'the clearance repair must not move or reserialize legacy geometry outside node text',
);
});
diff --git a/docs/gallery.html b/docs/gallery.html
index 54f0d632..3c2f45a8 100644
--- a/docs/gallery.html
+++ b/docs/gallery.html
@@ -386,7 +386,7 @@
<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">10N · 10E</span></div>
- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="cbd07d8734628fdbca577030df41fa5b6b5986c61a141784a54f5b5045627a74">cbd07d873462</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="e97182454a7049bd44bf66b779e3f1fa9921220168316a5800563d262c9e79da">e97182454a70</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/release-delivery.workflow.html?present=1&amp;play=1#view=approval-to-production" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>
@@ -415,7 +415,7 @@
<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">11N · 10E</span></div>
- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="b21282528ca71e35bb7c354ab5a14c077483d1b21dd8e154a4f2f0e9f8b9ce08">b21282528ca7</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="b57db538738181f337958e7896119e036703558a04ba0a585e11612fea7cca25">b57db5387381</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/incident-response.workflow.html?present=1&amp;play=1#view=mitigate-and-verify" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>
@@ -444,7 +444,7 @@
<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">10N · 10E</span></div>
- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="e3d4da60d89d90e5593da1cf3319b64316abe2a91e2c28e6e4ebd6a3904477b0">e3d4da60d89d</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="4a2565647da089171a09b2a90f98854c81099634607b33e47630c89dbe6f7bfd">4a2565647da0</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/product-analytics.dataflow.html?present=1&amp;play=1#view=consent-boundary" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>
@@ -502,7 +502,7 @@
<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">12N · 12E</span></div>
- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="b0bd7eefd4588e6d94a98c614034d0ff05a55539ea323a0cb5d129bc74dedc59">b0bd7eefd458</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="c4ce42fece7ae2f896ce9b967839a6b0439c4ec7ddd73c1dfdc1e3d93ff7a45f">c4ce42fece7a</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/event-stream.dataflow.html?present=1&amp;play=1#view=order-transit" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>
@@ -978,8 +978,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 10,
"edgeCount": 10,
- "artifactBytes": 826427,
- "artifactSha256": "cbd07d8734628fdbca577030df41fa5b6b5986c61a141784a54f5b5045627a74",
+ "artifactBytes": 826445,
+ "artifactSha256": "e97182454a7049bd44bf66b779e3f1fa9921220168316a5800563d262c9e79da",
"sourceBytes": 5164,
"sourceSha256": "e5c880417eac1623923c3dd5461e0c78acd762e1621a28bd53fc14a84cad6a91",
"checks": [
@@ -1079,8 +1079,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 11,
"edgeCount": 10,
- "artifactBytes": 823742,
- "artifactSha256": "b21282528ca71e35bb7c354ab5a14c077483d1b21dd8e154a4f2f0e9f8b9ce08",
+ "artifactBytes": 823764,
+ "artifactSha256": "b57db538738181f337958e7896119e036703558a04ba0a585e11612fea7cca25",
"sourceBytes": 5375,
"sourceSha256": "5c760c82eee545dfb7da38a4e628059d7891af4cfbfc13c8a7009ea64f69aa1b",
"checks": [
@@ -1181,7 +1181,7 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>
"nodeCount": 10,
"edgeCount": 10,
"artifactBytes": 827696,
- "artifactSha256": "e3d4da60d89d90e5593da1cf3319b64316abe2a91e2c28e6e4ebd6a3904477b0",
+ "artifactSha256": "4a2565647da089171a09b2a90f98854c81099634607b33e47630c89dbe6f7bfd",
"sourceBytes": 5618,
"sourceSha256": "91411404fb4828a3b7ea358f3a7b9877781c9e9dc9c04b42b6eb4a757281b59f",
"checks": [
@@ -1383,7 +1383,7 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>
"nodeCount": 12,
"edgeCount": 12,
"artifactBytes": 831694,
- "artifactSha256": "b0bd7eefd4588e6d94a98c614034d0ff05a55539ea323a0cb5d129bc74dedc59",
+ "artifactSha256": "c4ce42fece7ae2f896ce9b967839a6b0439c4ec7ddd73c1dfdc1e3d93ff7a45f",
"sourceBytes": 5433,
"sourceSha256": "a92d6597ddbe164f395da32a7d4b33cfae08edd7d9600a6fb45a2058e5bbb43e",
"checks": [
diff --git a/docs/gallery/artifacts/event-stream.dataflow.html b/docs/gallery/artifacts/event-stream.dataflow.html
index 7e6ec21f..7551d1de 100644
--- a/docs/gallery/artifacts/event-stream.dataflow.html
+++ b/docs/gallery/artifacts/event-stream.dataflow.html
@@ -5287,7 +5287,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(480 134) scale(0.6875)">
<path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>
</g>
- <text data-node-label="" data-detail-anchor="" x="530" y="149" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Order Validate</text>
+ <text data-node-label="" data-detail-anchor="" x="535" y="149" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Order Validate</text>
<text data-detail="context" x="530" y="165" class="t-muted" font-size="7" text-anchor="middle">group fulfillment</text>
<text data-detail="fine" x="530" y="175" class="t-backend" font-size="7" text-anchor="middle">ordered</text>
</g>
@@ -5299,7 +5299,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(480 362) scale(0.6875)">
<path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>
</g>
- <text data-node-label="" data-detail-anchor="" x="530" y="377" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Payment Enrich</text>
+ <text data-node-label="" data-detail-anchor="" x="535" y="377" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Payment Enrich</text>
<text data-detail="context" x="530" y="393" class="t-muted" font-size="7" text-anchor="middle">group analytics</text>
<text data-detail="fine" x="530" y="403" class="t-backend" font-size="7" text-anchor="middle">at-least-once</text>
</g>
diff --git a/docs/gallery/artifacts/incident-response.workflow.html b/docs/gallery/artifacts/incident-response.workflow.html
index 756e4f46..39b8d939 100644
--- a/docs/gallery/artifacts/incident-response.workflow.html
+++ b/docs/gallery/artifacts/incident-response.workflow.html
@@ -5252,7 +5252,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<circle cx="10.5" cy="8" r="1" class="sigil-fill"/>
<circle cx="7" cy="11.5" r="1" class="sigil-fill"/>
</g>
- <text data-node-label="" data-detail-anchor="" x="88" y="114" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">SLO Alert</text>
+ <text data-node-label="" data-detail-anchor="" x="90.7" y="114" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">SLO Alert</text>
<text data-detail="context" x="88" y="131" class="t-muted" font-size="8" text-anchor="middle">burn rate</text>
</g>
@@ -5264,8 +5264,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<rect x="2.5" y="5" width="8.5" height="8" rx="1.5"/>
<path d="M8 2.5h5.5V8M13.5 2.5 7.5 8.5"/>
</g>
- <text data-node-label="" data-detail-anchor="" x="220" y="238" class="t-primary" font-size="9.4" font-weight="600" text-anchor="middle">Page On-call</text>
- <text data-detail="context" x="220" y="255" class="t-muted" font-size="8" text-anchor="middle">acknowledge</text>
+ <text data-node-label="" data-detail-anchor="" x="220" y="247.3" class="t-primary" font-size="9.4" font-weight="600" text-anchor="middle">Page On-call</text>
+ <text data-detail="context" x="220" y="261.8" class="t-muted" font-size="8" text-anchor="middle">acknowledge</text>
</g>
<g id="node-triage" data-node-id="triage" data-node-label="Triage" tabindex="0" role="button" aria-label="Focus Triage, scope impact, Incident Command › Incident command › Triage + mitigate" aria-pressed="false" data-node-kind="backend" data-node-sublabel="scope impact" data-node-context="Incident Command › Incident command › Triage + mitigate">
@@ -5275,7 +5275,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(274 223) scale(0.6875)">
<path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>
</g>
- <text data-node-label="" data-detail-anchor="" x="300" y="238" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Triage</text>
+ <text data-node-label="" data-detail-anchor="" x="306.8" y="238" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Triage</text>
<text data-detail="context" x="300" y="255" class="t-muted" font-size="7.7" text-anchor="middle">scope impact</text>
</g>
@@ -5299,7 +5299,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(400 347) scale(0.6875)">
<path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>
</g>
- <text data-node-label="" data-detail-anchor="" x="430" y="362" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Contain</text>
+ <text data-node-label="" data-detail-anchor="" x="436.1" y="362" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Contain</text>
<text data-detail="context" x="430" y="379" class="t-muted" font-size="8" text-anchor="middle">stop growth</text>
</g>
@@ -5310,8 +5310,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<g aria-hidden="true" data-semantic-sigil="cloud" class="semantic-sigil s-cloud" transform="translate(480 347) scale(0.6875)">
<path d="M4.3 12.5h7.3a2.4 2.4 0 0 0 .2-4.8 4 4 0 0 0-7.5-1.3A3.1 3.1 0 0 0 4.3 12.5Z"/>
</g>
- <text data-node-label="" data-detail-anchor="" x="500" y="362" class="t-primary" font-size="10.4" font-weight="600" text-anchor="middle">Recover</text>
- <text data-detail="context" x="500" y="379" class="t-muted" font-size="8" text-anchor="middle">restore</text>
+ <text data-node-label="" data-detail-anchor="" x="500" y="372.5" class="t-primary" font-size="10.4" font-weight="600" text-anchor="middle">Recover</text>
+ <text data-detail="context" x="500" y="387.3" class="t-muted" font-size="8" text-anchor="middle">restore</text>
</g>
<g id="node-verify" data-node-id="verify" data-node-label="Verify" tabindex="0" role="button" aria-label="Focus Verify, SLO + traces, Recovery Evidence › Verify + close" aria-pressed="false" data-node-kind="database" data-node-sublabel="SLO + traces" data-node-tag="15 min stable" data-node-context="Recovery Evidence › Verify + close">
@@ -5349,8 +5349,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/>
<circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/>
</g>
- <text data-node-label="" data-detail-anchor="" x="430" y="610" class="t-primary" font-size="10.7" font-weight="600" text-anchor="middle">Status Update</text>
- <text data-detail="context" x="430" y="627" class="t-muted" font-size="8" text-anchor="middle">impact + ETA</text>
+ <text data-node-label="" data-detail-anchor="" x="430" y="620.9" class="t-primary" font-size="10.7" font-weight="600" text-anchor="middle">Status Update</text>
+ <text data-detail="context" x="430" y="635.8" class="t-muted" font-size="8" text-anchor="middle">impact + ETA</text>
</g>
<g id="node-escalate" data-node-id="escalate" data-node-label="Escalate" tabindex="0" role="button" aria-label="Focus Escalate, specialist, Escalation + Rollback › If impact persists › Triage + mitigate" aria-pressed="false" data-node-kind="security" data-node-sublabel="specialist" data-node-context="Escalation + Rollback › If impact persists › Triage + mitigate">
@@ -5361,8 +5361,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/>
<path d="m5.8 8 1.5 1.5 3-3"/>
</g>
- <text data-node-label="" data-detail-anchor="" x="430" y="734" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Escalate</text>
- <text data-detail="context" x="430" y="751" class="t-muted" font-size="8" text-anchor="middle">specialist</text>
+ <text data-node-label="" data-detail-anchor="" x="430" y="745.2" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Escalate</text>
+ <text data-detail="context" x="430" y="760.1" class="t-muted" font-size="8" text-anchor="middle">specialist</text>
</g>
<g id="node-rollback" data-node-id="rollback" data-node-label="Rollback" tabindex="0" role="button" aria-label="Focus Rollback, last good, Escalation + Rollback › If impact persists › Verify + close" aria-pressed="false" data-node-kind="messagebus" data-node-sublabel="last good" data-node-context="Escalation + Rollback › If impact persists › Verify + close">
diff --git a/docs/gallery/artifacts/product-analytics.dataflow.html b/docs/gallery/artifacts/product-analytics.dataflow.html
index 6b4364e9..cfa2ee9d 100644
--- a/docs/gallery/artifacts/product-analytics.dataflow.html
+++ b/docs/gallery/artifacts/product-analytics.dataflow.html
@@ -5325,7 +5325,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" data-detail-anchor="" x="745" y="377" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Feature Store</text>
+ <text data-node-label="" data-detail-anchor="" x="747" y="377" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Feature Store</text>
<text data-detail="context" x="745" y="393" class="t-muted" font-size="7" text-anchor="middle">daily batch</text>
<text data-detail="fine" x="745" y="403" class="t-database" font-size="7" text-anchor="middle">derived</text>
</g>
diff --git a/docs/gallery/artifacts/release-delivery.workflow.html b/docs/gallery/artifacts/release-delivery.workflow.html
index 075ad16e..4dff011f 100644
--- a/docs/gallery/artifacts/release-delivery.workflow.html
+++ b/docs/gallery/artifacts/release-delivery.workflow.html
@@ -5266,8 +5266,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/>
<circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/>
</g>
- <text data-node-label="" data-detail-anchor="" x="220" y="114" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Pull Request</text>
- <text data-detail="context" x="220" y="131" class="t-muted" font-size="8" text-anchor="middle">reviewed diff</text>
+ <text data-node-label="" data-detail-anchor="" x="220" y="125.2" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Pull Request</text>
+ <text data-detail="context" x="220" y="140.1" class="t-muted" font-size="8" text-anchor="middle">reviewed diff</text>
</g>
<g id="node-build" data-node-id="build" data-node-label="Build" tabindex="0" role="button" aria-label="Focus Build, locked inputs, Continuous Integration › Blocking checks › Build + verify" aria-pressed="false" data-node-kind="backend" data-node-sublabel="locked inputs" data-node-tag="reproducible" data-node-context="Continuous Integration › Blocking checks › Build + verify">
@@ -5290,9 +5290,9 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/>
<path d="m5.8 8 1.5 1.5 3-3"/>
</g>
- <text data-node-label="" data-detail-anchor="" x="430" y="230" class="t-primary" font-size="10.7" font-weight="600" text-anchor="middle">Quality Gates</text>
- <text data-detail="context" x="430" y="247" class="t-muted" font-size="8" text-anchor="middle">test + scan</text>
- <text data-detail="fine" x="430" y="265" class="t-security" font-size="7" text-anchor="middle">blocking</text>
+ <text data-node-label="" data-detail-anchor="" x="430" y="240.9" class="t-primary" font-size="10.7" font-weight="600" text-anchor="middle">Quality Gates</text>
+ <text data-detail="context" x="430" y="255.8" class="t-muted" font-size="8" text-anchor="middle">test + scan</text>
+ <text data-detail="fine" x="430" y="268.6" class="t-security" font-size="7" text-anchor="middle">blocking</text>
</g>
<g id="node-approval" data-node-id="approval" data-node-label="Approve" tabindex="0" role="button" aria-label="Focus Approve, release owner, Release Governance › Promote + observe" aria-pressed="false" data-node-kind="security" data-node-sublabel="release owner" data-node-tag="human gate" data-node-context="Release Governance › Promote + observe">
@@ -5351,8 +5351,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/>
<path d="m5.8 8 1.5 1.5 3-3"/>
</g>
- <text data-node-label="" data-detail-anchor="" x="300" y="734" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Stop Release</text>
- <text data-detail="context" x="300" y="751" class="t-muted" font-size="8" text-anchor="middle">gate failed</text>
+ <text data-node-label="" data-detail-anchor="" x="300" y="745.2" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Stop Release</text>
+ <text data-detail="context" x="300" y="760.1" class="t-muted" font-size="8" text-anchor="middle">gate failed</text>
</g>
<g id="node-rollback" data-node-id="rollback" data-node-label="Rollback" tabindex="0" role="button" aria-label="Focus Rollback, last good image, Failure + Rollback › Recovery path › Promote + observe" aria-pressed="false" data-node-kind="messagebus" data-node-sublabel="last good image" data-node-tag="owner: on-call" data-node-context="Failure + Rollback › Recovery path › Promote + observe">
@@ -5365,9 +5365,9 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<circle cx="10.5" cy="8" r="1" class="sigil-fill"/>
<circle cx="7" cy="11.5" r="1" class="sigil-fill"/>
</g>
- <text data-node-label="" data-detail-anchor="" x="500" y="726" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Rollback</text>
- <text data-detail="context" x="500" y="743" class="t-muted" font-size="6.2" text-anchor="middle">last good image</text>
- <text data-detail="fine" x="500" y="761" class="t-messagebus" font-size="6.6" text-anchor="middle">owner: on-call</text>
+ <text data-node-label="" data-detail-anchor="" x="500" y="737.2" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Rollback</text>
+ <text data-detail="context" x="500" y="750" class="t-muted" font-size="6.2" text-anchor="middle">last good image</text>
+ <text data-detail="fine" x="500" y="761.8" class="t-messagebus" font-size="6.6" text-anchor="middle">owner: on-call</text>
</g>
<!-- Edge labels -->
diff --git a/docs/gallery/manifest.json b/docs/gallery/manifest.json
index a31e9ee9..ca72d1ca 100644
--- a/docs/gallery/manifest.json
+++ b/docs/gallery/manifest.json
@@ -330,8 +330,8 @@
"engineeringProfile": null,
"nodeCount": 10,
"edgeCount": 10,
- "artifactBytes": 826427,
- "artifactSha256": "cbd07d8734628fdbca577030df41fa5b6b5986c61a141784a54f5b5045627a74",
+ "artifactBytes": 826445,
+ "artifactSha256": "e97182454a7049bd44bf66b779e3f1fa9921220168316a5800563d262c9e79da",
"sourceBytes": 5164,
"sourceSha256": "e5c880417eac1623923c3dd5461e0c78acd762e1621a28bd53fc14a84cad6a91",
"checks": [
@@ -431,8 +431,8 @@
"engineeringProfile": null,
"nodeCount": 11,
"edgeCount": 10,
- "artifactBytes": 823742,
- "artifactSha256": "b21282528ca71e35bb7c354ab5a14c077483d1b21dd8e154a4f2f0e9f8b9ce08",
+ "artifactBytes": 823764,
+ "artifactSha256": "b57db538738181f337958e7896119e036703558a04ba0a585e11612fea7cca25",
"sourceBytes": 5375,
"sourceSha256": "5c760c82eee545dfb7da38a4e628059d7891af4cfbfc13c8a7009ea64f69aa1b",
"checks": [
@@ -533,7 +533,7 @@
"nodeCount": 10,
"edgeCount": 10,
"artifactBytes": 827696,
- "artifactSha256": "e3d4da60d89d90e5593da1cf3319b64316abe2a91e2c28e6e4ebd6a3904477b0",
+ "artifactSha256": "4a2565647da089171a09b2a90f98854c81099634607b33e47630c89dbe6f7bfd",
"sourceBytes": 5618,
"sourceSha256": "91411404fb4828a3b7ea358f3a7b9877781c9e9dc9c04b42b6eb4a757281b59f",
"checks": [
@@ -735,7 +735,7 @@
"nodeCount": 12,
"edgeCount": 12,
"artifactBytes": 831694,
- "artifactSha256": "b0bd7eefd4588e6d94a98c614034d0ff05a55539ea323a0cb5d129bc74dedc59",
+ "artifactSha256": "c4ce42fece7ae2f896ce9b967839a6b0439c4ec7ddd73c1dfdc1e3d93ff7a45f",
"sourceBytes": 5433,
"sourceSha256": "a92d6597ddbe164f395da32a7d4b33cfae08edd7d9600a6fb45a2058e5bbb43e",
"checks": [
diff --git a/docs/reviews/issue-199/README.md b/docs/reviews/issue-199/README.md
new file mode 100644
index 00000000..4fe81c1c
--- /dev/null
+++ b/docs/reviews/issue-199/README.md
@@ -0,0 +1,116 @@
+# Label clearance without rejecting existing diagrams
+
+Comparison base: `dev` at `5769206e556e3a74a382b826ad84391080280ccc`.
+Related work: [#199](https://github.com/tt-a1i/archify/issues/199),
+[#220](https://github.com/tt-a1i/archify/pull/220),
+[#257](https://github.com/tt-a1i/archify/pull/257), and the already merged
+[#425](https://github.com/tt-a1i/archify/pull/425).
+
+## Behavior and compatibility
+
+Workflow v1/v2, dataflow and lifecycle node labels move only when their existing
+position reaches the semantic icon or lifecycle step. The existing node font
+size is retained. When horizontal clearance is insufficient, the text stack
+moves below the decoration rail inside the same authored box. Deliberately
+short fixed boxes retain their text and use a smaller decorative icon instead.
+
+Dataflow stage titles include their ordinal in width measurement, fit down to
+7px, then wrap by word or grapheme when the stage has room above its nodes.
+No new validation error is introduced. If an extreme title or explicit node
+position leaves insufficient room, the compatible single-line rendering is
+retained: this avoids creating a new vertical collision, but does not claim to
+solve arbitrary text overflow inside fixed geometry.
+
+Node positions, sizes, ports, edge routes, topology, label contents, node font
+sizes, schemas and acceptance rules remain unchanged. Stage title size and line
+breaks, and colliding node text positions, intentionally change. Sequence keeps
+#425's separate icon/title/context rows unchanged. The fixed-v1 regression now
+pins the old SVG after normalizing only node text coordinates; all remaining
+bytes are still compared to hashes obtained from the pre-fix base.
+
+## Reproductions and evidence
+
+`archify/test/label-clearance.test.mjs` exercises the public `deliver` command:
+
+- A 50px dataflow node named `Ingester` still delivers in standard and showcase.
+- A 92px workflow v1/v2 node named `PromptScript` clears the sigil at 11px.
+- A 32px-high fixed workflow node retains its bounds and complete text.
+- Lifecycle step, title, sublabel and tag remain present.
+- `Stream Processing, Enrichment, and Deduplication` wraps without failing in
+ standard or showcase; Chinese text remains complete; an extreme title cannot
+ wrap down into the node area.
+
+Local test commands (Node 22.23.2):
+
+- `npm test` from `archify/`: freshness and golden gates passed; 2,108 tests,
+ 2,039 passed, 0 failed, 69 skipped. Skips include optional Chrome suites and
+ platform-specific cases, not browser passes.
+- `node --test test/label-clearance.test.mjs`: 10/10 passed, also included in
+ the full suite. `workflow-compiler`, `layout-rules` and `sequence-column-fit`
+ are included in the full suite.
+
+Additional matched-input local evidence:
+
+- 14 input/profile pairs delivered on both base and candidate (28 successful
+ calls). All pairs retained node rectangles, full node text, font sizes and
+ viewBox; compared edge paths were identical. Sequence artifacts were retained.
+- Nine candidate diagrams at 1440×900 and 2048×900, light and dark (36 browser
+ states): no measured label/sigil, label/brand or node-text intersections.
+ The medium, long and CJK stage-title samples stayed within their stage width.
+ Browser checks waited for fonts, reader layout and theme transitions.
+- Real workflow SVG and PNG downloads succeeded; the exported PNG was visually
+ inspected. Clicking the repaired node still opened its semantic passport.
+- An extracted ZIP outside the repository delivered the workflow, narrow-node
+ and long-stage-title reproductions successfully.
+- Gallery generation: 11 artifacts / 99 checks. Changed examples, affected
+ gallery artifacts and their receipts, and `archify.zip` were regenerated.
+
+Perceptual review passed for the shown reproductions. Browser measurements,
+structural comparisons, unit tests and perceptual inspection are separate
+claims; none establishes universal absence of regressions.
+
+### Workflow overlap
+
+Same input and viewport, before and after. The `PromptScript` label keeps its
+font size and node bounds while moving below the icon.
+
+| Base | Candidate |
+| --- | --- |
+| ![Workflow before](base--workflow-v1.png) | ![Workflow after](candidate--workflow-v1.png) |
+
+### Long stage title
+
+The title wraps inside the existing stage frame without rejecting the input.
+
+| Base | Candidate |
+| --- | --- |
+| ![Stage title before](base--stage-long.png) | ![Stage title after](candidate--stage-long.png) |
+
+## Attribution
+
+- Souptik Chakraborty (`Souptik96`, #220): semantic icon footprint and selective
+ label-clearance approach; adapted here to preserve narrow-input acceptance
+ and cover workflow.
+- `276970789` (#257): measuring the complete ordinal-prefixed stage title and
+ fitting it to the frame; extended here with non-rejecting wrapping.
+- `mekhovov` (#425): the existing sequence header fix is preserved in dev and
+ remains attributed through its original commit history.
+
+The integration commit credits the two adapted contributions with
+`Co-authored-by` trailers. The overlapping PRs are not automatically closed.
+
+## Bounded performance check
+
+After the full suite finished, public CLI `deliver` ran seven alternating
+base/candidate pairs per input on the same machine (Node 22.23.2). The first
+pair was discarded as warm-up; these are medians of six samples per version.
+
+| Input | Base | Candidate | Change |
+| --- | ---: | ---: | ---: |
+| narrow-valid | 331.19 ms | 331.57 ms | +0.11% |
+| stage-long | 360.24 ms | 359.96 ms | -0.08% |
+| workflow-v2 | 398.99 ms | 390.94 ms | -2.02% |
+
+No material slowdown was observed in these small matched samples. This measures
+local rendering/validation/delivery, not agent authoring, browser interaction,
+or a general performance guarantee. No speedup is claimed.
diff --git a/docs/reviews/issue-199/base--stage-long.png b/docs/reviews/issue-199/base--stage-long.png
new file mode 100644
index 00000000..76c520f3
Binary files /dev/null and b/docs/reviews/issue-199/base--stage-long.png differ
diff --git a/docs/reviews/issue-199/base--workflow-v1.png b/docs/reviews/issue-199/base--workflow-v1.png
new file mode 100644
index 00000000..efad63f0
Binary files /dev/null and b/docs/reviews/issue-199/base--workflow-v1.png differ
diff --git a/docs/reviews/issue-199/candidate--stage-long.png b/docs/reviews/issue-199/candidate--stage-long.png
new file mode 100644
index 00000000..3a3ae42a
Binary files /dev/null and b/docs/reviews/issue-199/candidate--stage-long.png differ
diff --git a/docs/reviews/issue-199/candidate--workflow-v1.png b/docs/reviews/issue-199/candidate--workflow-v1.png
new file mode 100644
index 00000000..d95d3f36
Binary files /dev/null and b/docs/reviews/issue-199/candidate--workflow-v1.png differ
diff --git a/examples/dataflow-product-analytics.html b/examples/dataflow-product-analytics.html
index 6b4364e9..cfa2ee9d 100644
--- a/examples/dataflow-product-analytics.html
+++ b/examples/dataflow-product-analytics.html
@@ -5325,7 +5325,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" data-detail-anchor="" x="745" y="377" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Feature Store</text>
+ <text data-node-label="" data-detail-anchor="" x="747" y="377" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Feature Store</text>
<text data-detail="context" x="745" y="393" class="t-muted" font-size="7" text-anchor="middle">daily batch</text>
<text data-detail="fine" x="745" y="403" class="t-database" font-size="7" text-anchor="middle">derived</text>
</g>