Skip to content

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

fix(check): report crossings between independent shared-endpoint routes

tt-a1i3914865231b3
diff --git a/archify.zip b/archify.zip
index 55110a80..7d7bf609 100644
Binary files a/archify.zip and b/archify.zip differ
diff --git a/archify/scripts/check-render-output.mjs b/archify/scripts/check-render-output.mjs
index aa84f524..2bf89ddc 100644
--- a/archify/scripts/check-render-output.mjs
+++ b/archify/scripts/check-render-output.mjs
@@ -536,7 +536,10 @@ function collectRelationshipCrossings(arrows) {
const left = relationships[leftIndex];
for (let rightIndex = leftIndex + 1; rightIndex < relationships.length; rightIndex += 1) {
const right = relationships[rightIndex];
- if ([left.from, left.to].some((id) => id === right.from || id === right.to)) continue;
+ // A shared semantic endpoint does not make an interior X a junction
+ // when both generated paths promise independent automatic ports.
+ if ([left.from, left.to].some((id) => id === right.from || id === right.to)
+ && (!left.independentPorts || !right.independentPorts)) continue;
let point = null;
for (const leftSegment of left.segments) {
for (const rightSegment of right.segments) {
diff --git a/archify/test/render-output-checks.test.mjs b/archify/test/render-output-checks.test.mjs
index 6275900b..26ff2b0d 100644
--- a/archify/test/render-output-checks.test.mjs
+++ b/archify/test/render-output-checks.test.mjs
@@ -6,6 +6,7 @@ import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
+import { compactFinalizeReceipt } from '../bin/finalize.mjs';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const skillRoot = path.resolve(__dirname, '..');
@@ -617,6 +618,29 @@ function automaticArrow(id, from, to, points, width = 1.5) {
<path data-edge-id="${id}" data-edge-from="${from}" data-edge-to="${to}" data-composition-points="${points.map((point) => point.join(',')).join(';')}" data-composition-crossover="halo" data-composition-independent="true" d="${d}" class="a-default" stroke-width="${width}" marker-end="url(#arrowhead)"/>`;
}
+test('render output check: independent shared-endpoint crossings still recommend visual review', () => {
+ const markup = automaticArrow('first', 'a', 'hub', [[20, 20], [80, 20], [80, 80], [140, 80]])
+ + automaticArrow('second', 'b', 'hub', [[20, 100], [120, 100], [120, 40], [140, 40]]);
+ const { code, result } = checkHtml('independent-shared-crossing', markup, 'showcase');
+ assert.equal(code, 0, JSON.stringify(result));
+ assert.equal(result.composition.metrics.resolvedCrossovers, 1);
+ assert.equal(result.composition.metrics.properCrossings, 0);
+ assert.equal(result.composition.metrics.routesOverSuggestedBends, 0);
+ assert.equal(result.composition.metrics.routesOverSuggestedStretch, 0);
+ const summary = compactFinalizeReceipt({ ok: true, stages: { check: { receipt: result } } });
+ assert.deepEqual(summary.visualReviewRecommendation.signals, { resolvedCrossovers: 1 });
+ assert.equal(summary.visualReview, 'not-requested');
+ // A legacy/authored shared junction must keep its existing interpretation.
+ for (const preserved of [
+ markup.replaceAll(' data-composition-independent="true"', ''),
+ markup.replace(' data-composition-independent="true"', ''),
+ ]) {
+ const legacy = checkHtml('legacy-shared-crossing', preserved, 'showcase');
+ assert.equal(legacy.code, 0, JSON.stringify(legacy.result));
+ assert.equal(legacy.result.composition.metrics.resolvedCrossovers, 0);
+ }
+});
+
test('render output check: automatic shared destinations do not excuse long merged corridors', () => {
const markup = automaticArrow('first', 'a', 'hub', [[20, 20], [100, 20], [100, 140]])
+ automaticArrow('second', 'b', 'hub', [[180, 60], [100, 60], [100, 120], [140, 120], [140, 140]]);