Skip to content

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

fix(dataflow): give two automatic ports on a tall node 18px instead of packing them at 14

tt-a1i426a6bc2b238
diff --git a/archify/renderers/dataflow/render-dataflow.mjs b/archify/renderers/dataflow/render-dataflow.mjs
index 00b9bee9..9ddecc9f 100644
--- a/archify/renderers/dataflow/render-dataflow.mjs
+++ b/archify/renderers/dataflow/render-dataflow.mjs
@@ -451,8 +451,12 @@ function flowSides(flow) {
};
}
+// The shared default of 14px packs two 10px arrowheads on top of each other.
+// Raise the ceiling so a side that has room spreads them; a short side still
+// clamps to usable/(n-1) and keeps the previous layout.
const automaticPorts = automaticPortSpread(dataflow.flows, nodes, {
sideFor: (flow, endpoint) => flowSides(flow)[endpoint === 'source' ? 'fromSide' : 'toSide'],
+ maxSpacing: 18,
});
function pathFor(flow) {
diff --git a/test/dataflow-first-draft-crossing.test.mjs b/test/dataflow-first-draft-crossing.test.mjs
index 8164a041..0aef75b7 100644
--- a/test/dataflow-first-draft-crossing.test.mjs
+++ b/test/dataflow-first-draft-crossing.test.mjs
@@ -67,3 +67,15 @@ test('a pinned dataflow route keeps its geometry and its crossing diagnostic', (
assert.notEqual(result.status, 0);
assert.match(result.stdout + result.stderr, /proper-crossing/);
});
+
+test('two automatic arrivals on one side of a tall node keep at least 16px between their ports', () => {
+ const diagram = JSON.parse(fs.readFileSync(fixture, 'utf8'));
+ const result = render(diagram);
+ assert.equal(result.status, 0, result.stdout + result.stderr);
+ const arrivals = routes(result.html).filter((route) => route.to === 'fe').map((route) => route.points.at(-1));
+ assert.ok(arrivals.length >= 2, `expected at least two arrivals into fe, got ${arrivals.length}`);
+ const ys = arrivals.map((point) => point[1]).sort((a, b) => a - b);
+ for (let index = 1; index < ys.length; index += 1) {
+ assert.ok(ys[index] - ys[index - 1] >= 16, `ports ${ys[index - 1]} and ${ys[index]} are only ${ys[index] - ys[index - 1]}px apart`);
+ }
+});