Skip to content

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

test: cover public delivery of inferred routes

dajiaohuang7f57f54d670a
diff --git a/archify.zip b/archify.zip
index 1b21ad02..3f2b7812 100644
Binary files a/archify.zip and b/archify.zip differ
diff --git a/archify/renderers/shared/geometry.mjs b/archify/renderers/shared/geometry.mjs
index 8af8c19e..0d9ccb5d 100644
--- a/archify/renderers/shared/geometry.mjs
+++ b/archify/renderers/shared/geometry.mjs
@@ -1275,7 +1275,8 @@ export function automaticPortSpread(relations, boxes, { gutter = 16, maxSpacing
// leaves sideways: a hub above an offset spoke has both a horizontal and a
// larger vertical delta, and the router draws the vertical dogleg. Compare the
// deltas so the inferred side matches the axis the route actually uses. Equal
-// deltas, and a zero horizontal delta, keep the previous vertical result.
+// deltas select horizontal sides; dx === 0 preserves the previous vertical
+// result, while a vertical-dominant nonzero dx selects vertical sides.
export function defaultFromSide(from, to) {
const dx = to.cx - from.cx;
const dy = to.cy - from.cy;
diff --git a/archify/test/layout-rules.test.mjs b/archify/test/layout-rules.test.mjs
index 0ff3da6c..10a86ca6 100644
--- a/archify/test/layout-rules.test.mjs
+++ b/archify/test/layout-rules.test.mjs
@@ -73,6 +73,31 @@ function validateCli(mode, doc, quality = 'showcase') {
}
}
+function deliverCli(mode, doc, quality = 'showcase') {
+ const input = path.join(tmp, `${mode}-deliver-${Math.abs(hash(JSON.stringify(doc)))}.json`);
+ const outPath = path.join(tmp, `${mode}-deliver-${Math.abs(hash(JSON.stringify(doc)))}.html`);
+ fs.writeFileSync(input, JSON.stringify(doc));
+ try {
+ const stdout = execFileSync('node', [
+ path.join(skillRoot, 'bin', 'archify.mjs'),
+ 'deliver',
+ mode,
+ input,
+ outPath,
+ '--quality',
+ quality,
+ '--json',
+ ], { encoding: 'utf8' });
+ return { code: 0, result: JSON.parse(stdout), outPath };
+ } catch (err) {
+ return {
+ code: err.status ?? 1,
+ result: JSON.parse(String(err.stdout || '{}')),
+ outPath,
+ };
+ }
+}
+
function hash(s) {
let h = 0;
for (let i = 0; i < s.length; i += 1) h = (h * 31 + s.charCodeAt(i)) | 0;
@@ -1381,6 +1406,13 @@ test('architecture: an inferred side follows the dominant axis for a hub above a
// The CLI validation surface agrees with the renderer.
const cli = validateCli('architecture', doc, 'standard');
assert.equal(cli.code, 0, `validate must accept the inferred vertical route: ${JSON.stringify(cli.result)}`);
+
+ // The public delivery path must accept the same inferred route and verify
+ // the committed artifact, without authored side, route, or via fields.
+ const delivery = deliverCli('architecture', doc, 'standard');
+ assert.equal(delivery.code, 0, `deliver must accept the inferred vertical route: ${JSON.stringify(delivery.result)}`);
+ assert.equal(delivery.result.ok, true);
+ assert.equal(fs.existsSync(delivery.outPath), true);
});
test('dataflow: stage border run is blocking and the inter-stage gutter passes', () => {