Skip to content

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

fix(workflow): leave a route corridor between columns

tt-a1i0f1d3adb6608
diff --git a/archify/renderers/workflow/workflow-compiler.mjs b/archify/renderers/workflow/workflow-compiler.mjs
index 6ccd1055..598a16c5 100644
--- a/archify/renderers/workflow/workflow-compiler.mjs
+++ b/archify/renderers/workflow/workflow-compiler.mjs
@@ -154,11 +154,16 @@ function usesIndependentLaneMeasurement(workflow) {
}
// A readable-v2 node without an authored width grows to fit its label, up to
-// 200px; longer labels still fail the label check. Keyed by the node object so
-// the authored document is never rewritten.
+// 200px; longer labels still fail the label check. A sublabel or tag that
+// would not fit even at 6px also grows the node to fit it at its preferred 8px
+// or 7px. Keyed by the node object so the authored document is never rewritten.
const automaticNodeWidths = new WeakMap();
function automaticNodeWidth(node) {
- const fitted = Math.ceil((textUnits(node.label) * 6.8 - 6) / 4) * 4;
+ const labelWidth = Math.max(92, Math.ceil((textUnits(node.label) * 6.8 - 6) / 4) * 4);
+ const secondaryWidths = [[node.sublabel, 8], [node.tag, 7]]
+ .filter(([text]) => text && minimumNodeTextWidth(text, 6) > availableNodeTextWidth(labelWidth))
+ .map(([text, size]) => Math.ceil((minimumNodeTextWidth(text, size) + labelWidth - availableNodeTextWidth(labelWidth)) / 4) * 4);
+ const fitted = Math.max(labelWidth, ...secondaryWidths);
return fitted > 92 ? Math.min(200, fitted) : null;
}
@@ -251,10 +256,11 @@ function createReadableLayout(workflow, layoutFeedback = {}) {
if (!verticalIntervalsOverlap(leftNode, rightNode, 8)) continue;
const fromNode = leftNode.col < rightNode.col ? leftNode : rightNode;
const toNode = fromNode === leftNode ? rightNode : leftNode;
+ // Leave room for a vertical route corridor between neighbouring nodes.
constraints.push({
from: fromNode.col,
to: toNode.col,
- minimum: authoredNodeWidth(fromNode) / 2 + 8 + authoredNodeWidth(toNode) / 2,
+ minimum: authoredNodeWidth(fromNode) / 2 + 32 + authoredNodeWidth(toNode) / 2,
contributors: [
`rank ${fromNode.col}→${toNode.col} node width clearance`,
nodeWidthContributor(fromNode),
@@ -3787,6 +3793,11 @@ function readableAutomaticCandidateSet(
{ family: 'outside-right', via: corridorViaX(start, end, fromSide, toSide, outsideRight) },
{ family: 'top-corridor', via: corridorViaY(start, end, fromSide, toSide, topY) },
{ family: 'bottom-corridor', via: corridorViaY(start, end, fromSide, toSide, bottomY) },
+ // Offset tracks let several routes through one gap run side by side.
+ ...[-12, 12, -24, 24].flatMap((offset) => [
+ { family: 'lane-gap-corridor', via: corridorViaY(start, end, fromSide, toSide, laneGapY + offset) },
+ { family: 'column-gap-corridor', via: corridorViaX(start, end, fromSide, toSide, midX + offset) },
+ ]),
];
const candidates = rawCandidates.map((candidate, ordinal) => ({
...candidate,
@@ -4843,24 +4854,22 @@ function renderGroup(group, index) {
<text x="${span.x + 10}" y="${labelY}" class="${textClass}" font-size="7" font-weight="600">${esc(group.label)}</text>`;
}
-// Shrink-to-fit stops where node text still reads on the desktop at the final
+// Sublabel shrink-to-fit stops where it still reads on the desktop at the final
// canvas width, so an overflow is reported here rather than by the browser gate.
-function readableTextMinimum(minimum) {
+// The gate exempts fine tags, which keep their fixed legible minimum.
+function readableSublabelMinimum() {
+ const minimum = nodeTextFit.sublabelMinimum;
if (workflow.schema_version !== 2) return minimum;
return Math.max(minimum, Math.ceil(minimumReadableSourceTextPx(viewBox[0]) * 10) / 10);
}
function validateReadableNodeText() {
const problems = [];
+ const minimum = readableSublabelMinimum();
for (const node of nodes.values()) {
- for (const [field, value, minimum] of [
- ['Sublabel', node.sublabel, readableTextMinimum(nodeTextFit.sublabelMinimum)],
- ['Tag', node.tag, readableTextMinimum(nodeTextFit.tagMinimum)],
- ]) {
- const minimumW = value ? minimumNodeTextWidth(value, minimum) : 0;
- if (minimumW > availableNodeTextWidth(node.width)) {
- problems.push(`${field} "${value}" needs ~${Math.ceil(minimumW)}px at the ${minimum}px minimum that stays readable on this ${viewBox[0]}px canvas, but node "${node.id}" provides ${availableNodeTextWidth(node.width)}px — shorten the ${field.toLowerCase()}; a wider node or canvas lowers every projected font.`);
- }
+ const minimumW = node.sublabel ? minimumNodeTextWidth(node.sublabel, minimum) : 0;
+ if (minimumW > availableNodeTextWidth(node.width)) {
+ problems.push(`Sublabel "${node.sublabel}" needs ~${Math.ceil(minimumW)}px at the ${minimum}px minimum that stays readable on this ${viewBox[0]}px canvas, but node "${node.id}" provides ${availableNodeTextWidth(node.width)}px — shorten the sublabel; a wider node or canvas lowers every projected font.`);
}
}
if (problems.length) throwDiagnosticProblems('Workflow layout validation failed', problems, { subject: { diagramType: 'workflow' } });
@@ -4871,10 +4880,9 @@ 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 sublabelMinimum = readableTextMinimum(nodeTextFit.sublabelMinimum);
- const tagMinimum = readableTextMinimum(nodeTextFit.tagMinimum);
+ const sublabelMinimum = readableSublabelMinimum();
const sublabelFontSize = fittedNodeFontSize(node.sublabel, node.width, Math.max(nodeTextFit.sublabelPreferred, sublabelMinimum), sublabelMinimum);
- const tagFontSize = fittedNodeFontSize(node.tag, node.width, Math.max(nodeTextFit.tagPreferred, tagMinimum), tagMinimum);
+ 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 });
diff --git a/test/fixtures/workflow-dense-automatic.json b/test/fixtures/workflow-dense-automatic.json
new file mode 100644
index 00000000..e47c1173
--- /dev/null
+++ b/test/fixtures/workflow-dense-automatic.json
@@ -0,0 +1,324 @@
+{
+ "schema_version": 2,
+ "diagram_type": "workflow",
+ "meta": {
+ "title": "Omnigent 会话回合工作流",
+ "locale": "zh-CN",
+ "quality_profile": "showcase",
+ "output": "x.html"
+ },
+ "lanes": [
+ {
+ "id": "client",
+ "label": "客户端 · CLI / Web"
+ },
+ {
+ "id": "server",
+ "label": "Omnigent 服务器"
+ },
+ {
+ "id": "policy",
+ "label": "策略关卡(服务器)",
+ "variant": "exception"
+ },
+ {
+ "id": "runner",
+ "label": "Runner · 主机进程"
+ },
+ {
+ "id": "harness",
+ "label": "Harness 运行时"
+ }
+ ],
+ "phases": [
+ {
+ "id": "intake",
+ "label": "接收 + 输入策略",
+ "fromCol": 0,
+ "toCol": 1
+ },
+ {
+ "id": "schedule",
+ "label": "调度回合",
+ "fromCol": 2,
+ "toCol": 3,
+ "variant": "emphasis"
+ },
+ {
+ "id": "tooling",
+ "label": "工具调用 + 策略",
+ "fromCol": 4,
+ "toCol": 5,
+ "variant": "security"
+ }
+ ],
+ "mainPath": [
+ "send",
+ "ingest",
+ "route",
+ "turn",
+ "loop",
+ "dispatch",
+ "toolGate",
+ "exec",
+ "resultGate"
+ ],
+ "nodes": [
+ {
+ "id": "send",
+ "lane": "client",
+ "col": 0,
+ "type": "frontend",
+ "label": "用户发送消息",
+ "sublabel": "POST …/events"
+ },
+ {
+ "id": "ingest",
+ "lane": "server",
+ "col": 1,
+ "type": "backend",
+ "label": "接收事件",
+ "sublabel": "校验 + REQUEST 策略"
+ },
+ {
+ "id": "inputDeny",
+ "lane": "policy",
+ "col": 1,
+ "type": "security",
+ "label": "输入被拒",
+ "sublabel": "deny 提示 → idle"
+ },
+ {
+ "id": "route",
+ "lane": "server",
+ "col": 2,
+ "type": "backend",
+ "label": "解析 Runner",
+ "sublabel": "离线则主机重启"
+ },
+ {
+ "id": "native",
+ "lane": "harness",
+ "col": 2,
+ "type": "backend",
+ "label": "Native 终端",
+ "sublabel": "tmux 注入 · 转录回写"
+ },
+ {
+ "id": "turn",
+ "lane": "runner",
+ "col": 3,
+ "type": "backend",
+ "label": "启动回合",
+ "sublabel": "_run_turn_bg",
+ "tag": "回合中则缓冲"
+ },
+ {
+ "id": "loop",
+ "lane": "harness",
+ "col": 3,
+ "type": "backend",
+ "label": "智能体循环",
+ "sublabel": "LLM → function_call"
+ },
+ {
+ "id": "dispatch",
+ "lane": "runner",
+ "col": 4,
+ "type": "backend",
+ "label": "派发工具",
+ "sublabel": "dispatch_tool_locally"
+ },
+ {
+ "id": "toolGate",
+ "lane": "policy",
+ "col": 4,
+ "type": "security",
+ "label": "TOOL_CALL 策略",
+ "sublabel": "MCP 代理 tools/call",
+ "tag": "deny → 错误结果"
+ },
+ {
+ "id": "approve",
+ "lane": "client",
+ "col": 4,
+ "type": "frontend",
+ "label": "人工审批卡片",
+ "sublabel": "accept / decline"
+ },
+ {
+ "id": "exec",
+ "lane": "runner",
+ "col": 5,
+ "type": "backend",
+ "label": "执行工具",
+ "sublabel": "POST /mcp/execute"
+ },
+ {
+ "id": "resultGate",
+ "lane": "policy",
+ "col": 5,
+ "type": "security",
+ "label": "TOOL_RESULT 策略",
+ "sublabel": "抑制或改写输出"
+ },
+ {
+ "id": "relay",
+ "lane": "server",
+ "col": 3,
+ "type": "backend",
+ "label": "事件中继",
+ "sublabel": "持久化条目 + 发布"
+ },
+ {
+ "id": "stream",
+ "lane": "client",
+ "col": 3,
+ "type": "frontend",
+ "label": "会话实时流",
+ "sublabel": "GET …/stream SSE"
+ }
+ ],
+ "edges": [
+ {
+ "id": "send-ingest",
+ "from": "send",
+ "to": "ingest",
+ "label": "message",
+ "variant": "emphasis"
+ },
+ {
+ "id": "ingest-route",
+ "from": "ingest",
+ "to": "route",
+ "label": "ALLOW",
+ "variant": "emphasis"
+ },
+ {
+ "id": "ingest-deny",
+ "from": "ingest",
+ "to": "inputDeny",
+ "label": "DENY / 未批准",
+ "variant": "security",
+ "role": "error"
+ },
+ {
+ "id": "route-turn",
+ "from": "route",
+ "to": "turn",
+ "label": "持久化 + 转发",
+ "variant": "emphasis"
+ },
+ {
+ "id": "route-native",
+ "from": "route",
+ "to": "native",
+ "label": "native 会话",
+ "variant": "dashed",
+ "role": "branch"
+ },
+ {
+ "id": "turn-loop",
+ "from": "turn",
+ "to": "loop",
+ "label": "流式回合",
+ "variant": "emphasis"
+ },
+ {
+ "id": "turn-relay",
+ "from": "turn",
+ "to": "relay",
+ "label": "SSE 事件",
+ "variant": "dashed",
+ "role": "async"
+ },
+ {
+ "id": "relay-stream",
+ "from": "relay",
+ "to": "stream",
+ "label": "response.* / status",
+ "variant": "dashed",
+ "role": "async"
+ },
+ {
+ "id": "loop-dispatch",
+ "from": "loop",
+ "to": "dispatch",
+ "label": "action_required",
+ "variant": "emphasis"
+ },
+ {
+ "id": "dispatch-gate",
+ "from": "dispatch",
+ "to": "toolGate",
+ "label": "tools/call",
+ "variant": "emphasis"
+ },
+ {
+ "id": "gate-approve",
+ "from": "toolGate",
+ "to": "approve",
+ "label": "ASK",
+ "variant": "security",
+ "role": "branch"
+ },
+ {
+ "id": "approve-gate",
+ "from": "approve",
+ "to": "toolGate",
+ "label": "批准后重试",
+ "variant": "security",
+ "role": "return"
+ },
+ {
+ "id": "gate-exec",
+ "from": "toolGate",
+ "to": "exec",
+ "label": "ALLOW",
+ "variant": "emphasis"
+ },
+ {
+ "id": "exec-result",
+ "from": "exec",
+ "to": "resultGate",
+ "label": "工具输出",
+ "variant": "emphasis"
+ },
+ {
+ "id": "result-loop",
+ "from": "resultGate",
+ "to": "loop",
+ "label": "结果回传 · 继续循环",
+ "variant": "default",
+ "role": "return"
+ }
+ ],
+ "cards": [
+ {
+ "dot": "rose",
+ "title": "策略判定规则",
+ "items": [
+ "PolicyEngine 按 YAML 顺序评估;DENY 立即短路",
+ "ASK 的标签/状态写入仅在批准后生效",
+ "TOOL_CALL 评估失败时 fail-closed(拒绝)"
+ ]
+ },
+ {
+ "dot": "cyan",
+ "title": "会话状态",
+ "items": [
+ "idle → running → waiting → idle;不可恢复错误为 failed",
+ "回合进行中的新消息先缓冲,回合结束后续跑",
+ "interrupt 不进队列,直接取消当前回合"
+ ]
+ },
+ {
+ "dot": "violet",
+ "title": "Native 终端钩子",
+ "items": [
+ "PreToolUse / UserPromptSubmit 钩子调用 /policies/evaluate",
+ "服务器挂起 ASK,等待人工后返回硬性 ALLOW / DENY"
+ ]
+ }
+ ]
+}
diff --git a/test/layout-rules.test.mjs b/test/layout-rules.test.mjs
index 861b3be5..c3ad486d 100644
--- a/test/layout-rules.test.mjs
+++ b/test/layout-rules.test.mjs
@@ -251,7 +251,7 @@ const CASES = [
['exceeds the segment frame\'s available width', 'increase meta.viewBox[0]']],
['sequence: participant sublabel wider than its legible minimum', 'sequence',
(d) => { d.participants[0].sublabel = 'This supporting sentence is far too long for one sequence participant'; },
- ['Sublabel', 'legible', 'shorten the sublabel']],
+ ['Sublabel', 'readable', 'shorten the sublabel']],
// ---- dataflow layout rules ----
['dataflow: flow missing label', 'dataflow',
@@ -357,11 +357,11 @@ for (const [name, mode, mutate, expected] of CASES) {
});
}
-test('workflow: same-lane nodes the solver separated by exactly 8px keep passing (#583)', () => {
- // Redacted reproduction from #583: the neighbour constraint puts column
- // centers at 873.6 and 1041.6, a 167.9999999999999 distance the check re-derives
- // from the nodes' left edges as 1.14e-13px past a5. The compiler rejected the
- // layout it had just produced, with an empty supportedFixes list.
+test('workflow: same-lane nodes the solver separated by its exact minimum keep passing (#583)', () => {
+ // Redacted reproduction from #583: the neighbour constraint produced a column
+ // distance the check re-derived from the nodes' left edges as 1.14e-13px past
+ // a5. The compiler rejected the layout it had just produced, with an empty
+ // supportedFixes list. Neighbours now keep a 32px route corridor.
const doc = {
schema_version: 2,
diagram_type: 'workflow',
@@ -397,8 +397,8 @@ test('workflow: same-lane nodes the solver separated by exactly 8px keep passing
const right = workflowNodeRect(html, 'a5');
const paintedGap = right.x - (left.x + left.width);
assert.ok(
- Math.abs(paintedGap - 8) < 1e-6,
- `expected a4 and a5 to paint 8px apart, measured ${paintedGap}`,
+ Math.abs(paintedGap - 32) < 1e-6,
+ `expected a4 and a5 to paint 32px apart, measured ${paintedGap}`,
);
const overlapping = JSON.parse(JSON.stringify(doc));
@@ -635,7 +635,9 @@ const SHRINK_CASES = [
// [mode, mutate(doc), preferredFontSize, selector for the sublabel <text>]
['architecture', (d) => { d.components[0].sublabel = 'Browser and mobile apps'; }, 9],
['sequence', (d) => {
+ // On a wider canvas 7px is already the smallest size that reads on desktop.
d.meta.column_fit = 'fixed';
+ d.meta.viewBox = [930, 580];
d.participants[0].sublabel = 'long browser session';
}, 7],
['dataflow', (d) => { d.nodes[0].sublabel = 'browser SDK and mobile SDK'; }, 7],
@@ -935,11 +937,11 @@ test('workflow: explicit labelAt remains authoritative on an automatic one-bend
test('workflow: bounded font fitting keeps an ordinary long sublabel inside its node', () => {
const d = load('workflow');
d.nodes[0].width = 92;
- d.nodes[0].sublabel = 'shell / browser / MCP';
+ d.nodes[0].sublabel = 'shell/browser / MCP';
const { code, stderr, outPath } = render('workflow', d);
assert.equal(code, 0, stderr);
const html = fs.readFileSync(outPath, 'utf8');
- assert.match(html, /font-size="6\.6"[^>]*>shell \/ browser \/ MCP<\/text>/);
+ assert.match(html, /font-size="7\.3"[^>]*>shell\/browser \/ MCP<\/text>/);
});
test('workflow: edge crossing a non-endpoint node is rejected', () => {
diff --git a/test/workflow-compiler-hard-contract.test.mjs b/test/workflow-compiler-hard-contract.test.mjs
index a69c18a0..7a6daead 100644
--- a/test/workflow-compiler-hard-contract.test.mjs
+++ b/test/workflow-compiler-hard-contract.test.mjs
@@ -1751,9 +1751,9 @@ test('readable-v2 classifies a side-only authored route sharing an automatic cor
assertExplicitPinConflict(result, 'side-only route sharing an automatic corridor');
const diagnostic = result.diagnostics[0];
assert.equal(diagnostic.evidence.invariant, 'explicit route-route corridor clearance');
- assert.deepEqual(diagnostic.evidence.overlapStart, [214, 161]);
- assert.deepEqual(diagnostic.evidence.overlapEnd, [334, 161]);
- assert.equal(diagnostic.evidence.overlapLengthPx, 120);
+ assert.deepEqual(diagnostic.evidence.overlapStart, [218, 161]);
+ assert.deepEqual(diagnostic.evidence.overlapEnd, [342, 161]);
+ assert.equal(diagnostic.evidence.overlapLengthPx, 124);
assert.ok(diagnostic.evidence.conflictingPins.length > 0);
assert.ok(diagnostic.evidence.conflictingPins.every(({ edge, field, path, value }) => (
edge === 'z-side'
@@ -1773,7 +1773,9 @@ test('readable-v2 classifies a side-only authored route sharing an automatic cor
}
});
-test('readable-v2 classifies a preset-only route sharing an automatic corridor', () => {
+test('readable-v2 routes an automatic edge clear of a preset channel', () => {
+ // The column gap leaves the automatic edge a corridor of its own, so it no
+ // longer shares the bottom channel the preset route claims.
const document = workflow({
lanes: [{ id: 'l0', label: 'l0' }, { id: 'l1', label: 'l1' }],
nodes: [
@@ -1790,33 +1792,11 @@ test('readable-v2 classifies a preset-only route sharing an automatic corridor',
document.meta.quality_profile = 'showcase';
const result = compileWorkflow({ workflow: document });
- assertExplicitPinConflict(result, 'preset-only route sharing an automatic corridor');
- const diagnostic = result.diagnostics[0];
- assert.equal(diagnostic.evidence.invariant, 'explicit route-route corridor clearance');
- assert.deepEqual(diagnostic.subject, {
- diagramType: 'workflow',
- edge: 'z-route',
- from: 'n01',
- to: 'n02',
- path: '/edges/1/route',
- });
- assert.deepEqual(diagnostic.evidence.conflictingPins, [{
- edge: 'z-route',
- field: 'route',
- path: '/edges/1/route',
- value: 'bottom-channel',
- }]);
- assert.deepEqual(diagnostic.evidence.overlapStart, [214, 166]);
- assert.deepEqual(diagnostic.evidence.overlapEnd, [214, 177]);
- assert.equal(diagnostic.evidence.overlapLengthPx, 11);
- assert.deepEqual(diagnostic.supportedFixes, [
- 'remove route from edge "z-route" so readable-v2 can replan the remaining authored route assertions',
- ]);
-
- const repaired = clone(document);
- delete repaired.edges[1].route;
- const verified = compileWorkflow({ workflow: repaired });
- assert.equal(verified.ok, true, JSON.stringify(verified.diagnostics, null, 2));
+ assert.equal(result.ok, true, JSON.stringify(result.diagnostics, null, 2));
+ const auto = result.receipt.edges.find(({ id }) => id === 'a-auto');
+ const preset = result.receipt.edges.find(({ id }) => id === 'z-route');
+ const presetLeft = Math.min(...preset.points.map(([x]) => x));
+ assert.ok(auto.points.every(([x]) => x < presetLeft), JSON.stringify({ auto: auto.points, preset: preset.points }));
});
test('readable-v2 reports unknown edge endpoints with a precise semantic diagnostic', () => {
diff --git a/test/workflow-compiler.test.mjs b/test/workflow-compiler.test.mjs
index 59b16259..fbe12929 100644
--- a/test/workflow-compiler.test.mjs
+++ b/test/workflow-compiler.test.mjs
@@ -353,11 +353,11 @@ test('readable-v2 separates approval branches in the checked-in workflow example
assert.equal(result.receipt.contract, 'readable-v2');
assert.equal(
- // The only visible delta is approved-tool's source moving 12px left:
- // approval-denied and approved-tool previously shared a mixed-style trunk.
- // Node geometry, labels, all other paths and v1 baselines are unchanged.
+ // approval-denied and approved-tool keep separate trunks. Neighbouring
+ // columns now keep a 32px route corridor, which widens the canvas by 12px,
+ // and tags keep their 7px preferred size.
sha256(result.svg.replace(/ data-(?:composition-routing|edge-role|layout-contract)="[^"]*"/g, '')),
- 'cf98dc4bf3104e98dee7b69e1875206cc78cd9e322142e8432219c1784dae886',
+ '9254f1c5304ea0a2ba0db9399952988a6af8c768930fd47b7d8ba5935499a073',
);
});
@@ -1450,4 +1450,11 @@ test('CLI validate workflow --layout-json returns only the causal compiler failu
assert.equal(receipt.diagnostics[0].code, 'workflow/column-capacity');
});
+test('a dense automatic first draft routes between columns without crossings', () => {
+ // A generated first draft: five lanes, 150px nodes and no authored routes.
+ const workflow = readJson(path.join(__dirname, 'fixtures', 'workflow-dense-automatic.json'));
+ const result = compileWorkflow({ workflow, qualityProfile: 'showcase' });
+ assert.equal(result.ok, true, JSON.stringify(result.diagnostics, null, 2));
+});
+
process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));
diff --git a/test/workflow-migration.test.mjs b/test/workflow-migration.test.mjs
index 3ceb956e..085a8caf 100644
--- a/test/workflow-migration.test.mjs
+++ b/test/workflow-migration.test.mjs
@@ -436,10 +436,10 @@ test('workflow migration remaps absolute x coordinates, expands only the constra
const migratedBytes = fs.readFileSync(destination);
const migrated = JSON.parse(migratedBytes);
assert.equal(migrated.schema_version, 2);
- assert.deepEqual(migrated.meta.viewBox, [768, 700], 'width grows to fit v2 while sufficient height is preserved');
+ assert.deepEqual(migrated.meta.viewBox, [772, 700], 'width grows to fit v2 while sufficient height is preserved');
assert.deepEqual(migrated.edges[0].via, [[214, 119]]);
- assert.deepEqual(migrated.edges[1].labelAt, [394, 203]);
- assert.equal(migrated.edges[2].channelX, 574);
+ assert.deepEqual(migrated.edges[1].labelAt, [396, 203]);
+ assert.equal(migrated.edges[2].channelX, 578);
const report = parseJsonOutput(result);
assert.equal(report.ok, true);
@@ -462,11 +462,11 @@ test('workflow migration remaps absolute x coordinates, expands only the constra
assert.deepEqual(report.newSchemaDiagnostics, []);
assert.deepEqual(report.changedCoordinates, [
{ path: '/edges/0/via/0/0', from: 220, to: 214 },
- { path: '/edges/1/labelAt/0', from: 365, to: 394 },
- { path: '/edges/2/channelX', from: 500, to: 574 },
+ { path: '/edges/1/labelAt/0', from: 365, to: 396 },
+ { path: '/edges/2/channelX', from: 500, to: 578 },
]);
assert.deepEqual(report.oldRequiredViewBox, [720, 652]);
- assert.deepEqual(report.newRequiredViewBox, [768, 652]);
+ assert.deepEqual(report.newRequiredViewBox, [772, 652]);
});
test('workflow migration never shrinks an already spacious explicit viewBox', () => {
diff --git a/test/workflow-routing-clarity.test.mjs b/test/workflow-routing-clarity.test.mjs
index f8a9eb7a..8b07cf93 100644
--- a/test/workflow-routing-clarity.test.mjs
+++ b/test/workflow-routing-clarity.test.mjs
@@ -120,7 +120,7 @@ test('readable-v2 preserves authored sides, routes, channels, vias, and label po
{ route: 'straight' },
{ route: 'bottom-channel' },
{ channelY: 425 },
- { via: [[716.8, 425], [836.8, 425]], fromSide: 'bottom', toSide: 'bottom' },
+ { via: [[716.8, 425], [840.8, 425]], fromSide: 'bottom', toSide: 'bottom' },
{ labelAt: [776.8, 415] },
];
for (const authored of cases) {