Skip to content

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

fix: reduce avoidable authoring retries and fit default canvases

tt-a1i16f6e01327bd
diff --git a/archify.zip b/archify.zip
index d189cee5..c060b896 100644
Binary files a/archify.zip and b/archify.zip differ
diff --git a/archify/SKILL.md b/archify/SKILL.md
index 296e73ee..560cc996 100644
--- a/archify/SKILL.md
+++ b/archify/SKILL.md
@@ -12,6 +12,8 @@ metadata:
Create an interactive HTML diagram from typed JSON. Static output is the default; enable motion only when requested.
+Run commands from your working directory, keeping candidate JSON and output artifacts there. Replace `bin/archify.mjs` in the commands below with the installed package's absolute path, or its path relative to your working directory; input and output paths resolve from that working directory.
+
For a real codebase, read [Repository authoring](references/repository-authoring.md) for exploration and example selection. A system description uses the steps below; an existing JSON uses the handoff path.
## Existing candidate handoff
diff --git a/archify/bin/archify.mjs b/archify/bin/archify.mjs
index 6e15ce19..11ac64ba 100755
--- a/archify/bin/archify.mjs
+++ b/archify/bin/archify.mjs
@@ -2183,7 +2183,7 @@ function usage() {
archify validate <type> <input.json> [--json] [--layout-json] [--quality standard|showcase] [--repo-root path]
archify migrate workflow <old.json> <new.json> --to-schema 2 [--output portable.html] [--json] [--repo-root path]
archify inspect <type> <input.json>
- archify check <output.html> [--require-provenance]
+ archify check <output.html> [--json] [--require-provenance]
archify browser-check <output.html> [--json] [--require-provenance] [--out-dir <dir>]
archify visual-check <output.html> [--json] [--require-provenance] [--out-dir <dir>]
archify guide [scenario or question] [--json] [--lang en|zh]
@@ -2607,13 +2607,13 @@ const CHECK_FIXES = {
};
const COMPOSITION_FIXES = {
- 'composition/proper-crossing': ['adjust route/via or channel coordinates so unrelated relationships use separate corridors'],
- 'composition/ambiguous-corridor': ['adjust route/via or channel coordinates so unrelated relationships do not visually merge'],
- 'composition/container-border-run': ['route across the frame perpendicularly through a clear opening'],
- 'composition/label-route-clearance': ['adjust labelAt, labelDx, labelDy, labelSegment, message y, or the other relationship route'],
- 'composition/label-canvas-containment': ['adjust labelAt, labelDx, labelDy, or labelSegment so the label rect stays inside the viewBox, or enlarge meta.viewBox'],
- 'composition/micro-segment': ['move the route/channel/via point so every visible segment is at least 8px'],
- 'composition/short-interior-segment': ['move the route/channel/via point so every interior turn has at least 16px'],
+ 'composition/proper-crossing': ['if authored via/route/channelX/channelY controls exist and are not required by the user, remove them to let the renderer re-plan; otherwise preserve that intent and adjust route/via or channel coordinates so unrelated relationships use separate corridors'],
+ 'composition/ambiguous-corridor': ['if authored via/route/channelX/channelY controls exist and are not required by the user, remove them to let the renderer re-plan; otherwise preserve that intent and adjust route/via or channel coordinates so unrelated relationships do not visually merge'],
+ 'composition/container-border-run': ['if authored via/route/channelX/channelY controls exist and are not required by the user, remove them to let the renderer re-plan; otherwise preserve that intent and route across the frame perpendicularly through a clear opening'],
+ 'composition/label-route-clearance': ['if authored labelAt/labelDx/labelDy/labelSegment controls exist and are not required by the user, remove them to let the renderer re-plan; otherwise preserve that intent and adjust labelAt, labelDx, labelDy, labelSegment, message y, or the other relationship route'],
+ 'composition/label-canvas-containment': ['if authored labelAt/labelDx/labelDy/labelSegment controls exist and are not required by the user, remove them to let the renderer re-plan; otherwise preserve that intent and adjust labelAt, labelDx, labelDy, or labelSegment so the label rect stays inside the viewBox, or enlarge meta.viewBox'],
+ 'composition/micro-segment': ['if authored via/route/channelX/channelY controls exist and are not required by the user, remove them to let the renderer re-plan; otherwise preserve that intent and move the route/channel/via point so every visible segment is at least 8px'],
+ 'composition/short-interior-segment': ['if authored via/route/channelX/channelY controls exist and are not required by the user, remove them to let the renderer re-plan; otherwise preserve that intent and move the route/channel/via point so every interior turn has at least 16px'],
};
function checkerDiagnostics(checker) {
@@ -5349,7 +5349,7 @@ function provenanceFailureReceipt({ command, artifactPath, provenance }) {
}
async function commandCheck(args) {
- const knownOptions = new Set(['--require-provenance']);
+ const knownOptions = new Set(['--json', '--require-provenance']);
const unknown = args.find((arg) => arg.startsWith('--') && !knownOptions.has(arg));
if (unknown) fail(`Unknown check option "${unknown}".`);
const requireProvenance = args.includes('--require-provenance');
diff --git a/archify/references/delivery-contract.md b/archify/references/delivery-contract.md
index 7e7f3549..51c95a98 100644
--- a/archify/references/delivery-contract.md
+++ b/archify/references/delivery-contract.md
@@ -367,9 +367,11 @@ The receipt binds the artifact SHA-256 and byte count, identifies
`visualReview: "not-requested"`.
Horizontal overflow always fails. Vertical overflow normally fails as well. One
-bounded exception preserves readability for compiler-measured intrinsic-height
-diagrams: after the adaptive Reader reaches its projected text floor and exposes
-`data-reader-layout="adaptive"` with `data-reader-overflow="authored"`, normal
+bounded exception preserves readability for renderer-owned canvases that declare
+intrinsic-height (omitted `meta.viewBox`, whether compiler-measured or the
+type's default canvas): after the adaptive Reader reaches its projected text
+floor and exposes `data-reader-layout="adaptive"` with
+`data-reader-overflow="authored"`, normal
page-level vertical scrolling may pass. The SVG must also expose
`data-reader-fit="intrinsic-height"`, projected text must still pass, and the
receipt records `verticalScrollAccepted: true` with
diff --git a/archify/renderers/dataflow/render-dataflow.mjs b/archify/renderers/dataflow/render-dataflow.mjs
index 684208f8..6f79d012 100644
--- a/archify/renderers/dataflow/render-dataflow.mjs
+++ b/archify/renderers/dataflow/render-dataflow.mjs
@@ -504,7 +504,11 @@ function renderLegend() {
}
function renderSvg() {
- return ` <svg viewBox="0 0 ${viewBox[0]} ${viewBox[1]}" ${svgRootAttrs(dataflow.meta)}>
+ // Same default-canvas contract as lifecycle: 940x720 is below the 1.55 wide
+ // ratio, so without intrinsic-height the desktop Reader can neither narrow
+ // nor scroll it and every default dataflow fails the browser gate.
+ const readerFit = dataflow.meta?.viewBox ? '' : ' data-reader-fit="intrinsic-height"';
+ return ` <svg viewBox="0 0 ${viewBox[0]} ${viewBox[1]}"${readerFit} ${svgRootAttrs(dataflow.meta)}>
${svgAccessibleText(dataflow.meta, 'dataflow')}
${renderDefinitions()}
diff --git a/archify/renderers/sequence/render-sequence.mjs b/archify/renderers/sequence/render-sequence.mjs
index 288dd2c6..7d949323 100644
--- a/archify/renderers/sequence/render-sequence.mjs
+++ b/archify/renderers/sequence/render-sequence.mjs
@@ -439,7 +439,11 @@ function renderLegend() {
function renderSvg() {
const participantList = [...participants.values()];
- return ` <svg viewBox="0 0 ${viewBox[0]} ${viewBox[1]}" ${svgRootAttrs(sequence.meta)}>
+ // Same default-canvas contract as lifecycle: 920x760 is below the 1.55 wide
+ // ratio, so without intrinsic-height the desktop Reader can neither narrow
+ // nor scroll it and every default sequence fails the browser gate.
+ const readerFit = sequence.meta?.viewBox ? '' : ' data-reader-fit="intrinsic-height"';
+ return ` <svg viewBox="0 0 ${viewBox[0]} ${viewBox[1]}"${readerFit} ${svgRootAttrs(sequence.meta)}>
${svgAccessibleText(sequence.meta, 'sequence')}
${renderDefinitions()}
diff --git a/archify/renderers/shared/geometry.mjs b/archify/renderers/shared/geometry.mjs
index 3407adb2..670d4458 100644
--- a/archify/renderers/shared/geometry.mjs
+++ b/archify/renderers/shared/geometry.mjs
@@ -275,6 +275,20 @@ function relationshipSubject(diagramType, relationCollection, relationIndex, rel
};
}
+const AUTHORED_PLAN_KEYS = ['route', 'via', 'channelX', 'channelY', 'fromSide', 'toSide', 'bias', 'labelAt', 'labelDx', 'labelDy', 'labelSegment'];
+
+// Re-planning advice only applies when the failing relation actually carries
+// authored controls; telling an author to remove controls that do not exist
+// just sends them hunting for a field that was never written.
+function rePlanHint(relations, fallback) {
+ const controls = new Set();
+ for (const relation of asArray(relations)) {
+ for (const key of AUTHORED_PLAN_KEYS) if (relation?.[key] !== undefined) controls.add(key);
+ }
+ if (!controls.size) return fallback;
+ return `if the authored ${[...controls].join('/')} are not required by the user, remove them so the renderer can re-plan; otherwise preserve that intent and ${fallback}`;
+}
+
const ENDPOINT_SIDE_RULES = {
left: {
axis: 'horizontal',
@@ -460,7 +474,8 @@ export function cleanFlowProblems({
const from = points[hitSegment].map(Math.round).join(', ');
const to = points[hitSegment + 1].map(Math.round).join(', ');
const relationId = relation.id ? ` id "${relation.id}"` : '';
- const message = `[clean-flow/edge-through-node] ${diagramType} ${relationCollection}[${relationIndex}]${relationId} "${relation.from}" -> "${relation.to}" crosses ${obstacleKind} "${obstacle.id}" (unrelated to this relationship) on segment ${hitSegment} [${from}] -> [${to}] (${clearance}px clearance) — ${routeHint}.`;
+ const hint = rePlanHint([relation], routeHint);
+ const message = `[clean-flow/edge-through-node] ${diagramType} ${relationCollection}[${relationIndex}]${relationId} "${relation.from}" -> "${relation.to}" crosses ${obstacleKind} "${obstacle.id}" (unrelated to this relationship) on segment ${hitSegment} [${from}] -> [${to}] (${clearance}px clearance) — ${hint}.`;
recordDiagnostic({
code: 'clean-flow/edge-through-node',
severity: 'error',
@@ -474,7 +489,7 @@ export function cleanFlowProblems({
to: points[hitSegment + 1],
clearancePx: clearance,
},
- supportedFixes: [routeHint],
+ supportedFixes: [hint],
});
problems.push(message);
}
@@ -628,7 +643,8 @@ export function cleanCrossingProblems({
return `${relationCollection}[${index}]${id} "${relation.from}" -> "${relation.to}"`;
};
const point = hit.point.map((value) => Math.round(value * 10) / 10).join(', ');
- const message = `[composition/proper-crossing] showcase ${diagramType} ${describe(left)} crosses ${describe(right)} at [${point}] (segments ${hit.leftSegment} and ${hit.rightSegment}) — ${routeHint}.`;
+ const hint = rePlanHint([left.relation, right.relation], routeHint);
+ const message = `[composition/proper-crossing] showcase ${diagramType} ${describe(left)} crosses ${describe(right)} at [${point}] (segments ${hit.leftSegment} and ${hit.rightSegment}) — ${hint}.`;
recordDiagnostic({
code: 'composition/proper-crossing',
severity: 'error',
@@ -640,7 +656,7 @@ export function cleanCrossingProblems({
segmentIndex: hit.leftSegment,
otherSegmentIndex: hit.rightSegment,
},
- supportedFixes: [routeHint],
+ supportedFixes: [hint],
});
problems.push(message);
}
@@ -727,7 +743,8 @@ export function cleanAmbiguousCorridorProblems({
const length = Math.round(hit.overlapLength * 10) / 10;
const from = hit.overlapStart.map((value) => Math.round(value * 10) / 10).join(', ');
const to = hit.overlapEnd.map((value) => Math.round(value * 10) / 10).join(', ');
- const message = `[composition/ambiguous-corridor] showcase ${diagramType} ${describe(hit.left)} shares a ${length}px corridor with ${describe(hit.right)} at [${from}] -> [${to}] (segments ${hit.leftSegment} and ${hit.rightSegment}; minimum ${minOverlapPx}px) — ${routeHint}.`;
+ const hint = rePlanHint([hit.left.relation, hit.right.relation], routeHint);
+ const message = `[composition/ambiguous-corridor] showcase ${diagramType} ${describe(hit.left)} shares a ${length}px corridor with ${describe(hit.right)} at [${from}] -> [${to}] (segments ${hit.leftSegment} and ${hit.rightSegment}; minimum ${minOverlapPx}px) — ${hint}.`;
recordDiagnostic({
code: 'composition/ambiguous-corridor',
severity: 'error',
@@ -742,7 +759,7 @@ export function cleanAmbiguousCorridorProblems({
segmentIndex: hit.leftSegment,
otherSegmentIndex: hit.rightSegment,
},
- supportedFixes: [routeHint],
+ supportedFixes: [hint],
});
return message;
});
@@ -819,7 +836,8 @@ export function cleanBorderRunProblems({
const length = Math.round(hit.overlapLength * 10) / 10;
const from = hit.overlapStart.map((value) => Math.round(value * 10) / 10).join(', ');
const to = hit.overlapEnd.map((value) => Math.round(value * 10) / 10).join(', ');
- const message = `[composition/container-border-run] ${diagramType} ${relationCollection}[${hit.relationIndex}]${relationId} "${relation.from}" -> "${relation.to}" follows ${frameKind} "${frameIdentity}" ${hit.side} border for ${length}px on segment ${hit.segmentIndex} [${from}] -> [${to}] — ${routeHint}.`;
+ const hint = rePlanHint([relation], routeHint);
+ const message = `[composition/container-border-run] ${diagramType} ${relationCollection}[${hit.relationIndex}]${relationId} "${relation.from}" -> "${relation.to}" follows ${frameKind} "${frameIdentity}" ${hit.side} border for ${length}px on segment ${hit.segmentIndex} [${from}] -> [${to}] — ${hint}.`;
recordDiagnostic({
code: 'composition/container-border-run',
severity: 'error',
@@ -835,7 +853,7 @@ export function cleanBorderRunProblems({
from: hit.overlapStart,
to: hit.overlapEnd,
},
- supportedFixes: [routeHint],
+ supportedFixes: [hint],
});
return message;
});
@@ -964,7 +982,8 @@ export function cleanRouteRhythmProblems({
const rule = hit.code === 'composition/micro-segment'
? `is below the ${microSegmentPx}px micro-segment floor`
: `is below the ${interiorSegmentPx}px interior-segment floor`;
- const message = `[${hit.code}] showcase ${diagramType} ${relationCollection}[${hit.relationIndex}]${relationId} "${relation.from}" -> "${relation.to}" has a ${length}px ${hit.position} segment ${hit.segmentIndex} [${from}] -> [${to}] that ${rule} — ${routeHint}.`;
+ const hint = rePlanHint([relation], routeHint);
+ const message = `[${hit.code}] showcase ${diagramType} ${relationCollection}[${hit.relationIndex}]${relationId} "${relation.from}" -> "${relation.to}" has a ${length}px ${hit.position} segment ${hit.segmentIndex} [${from}] -> [${to}] that ${rule} — ${hint}.`;
recordDiagnostic({
code: hit.code,
severity: 'error',
@@ -978,7 +997,7 @@ export function cleanRouteRhythmProblems({
from: hit.start,
to: hit.end,
},
- supportedFixes: [routeHint],
+ supportedFixes: [hint],
});
return message;
});
@@ -1007,7 +1026,8 @@ export function cleanLabelRouteClearanceProblems({
const clearance = Math.round(hit.clearance * 10) / 10;
const from = hit.start.map((value) => Math.round(value * 10) / 10).join(', ');
const to = hit.end.map((value) => Math.round(value * 10) / 10).join(', ');
- const message = `[composition/label-route-clearance] showcase ${diagramType} label "${hit.label?.label || hit.labelRelation?.label || ''}" on ${describe(hit.labelRelation, hit.labelRelationIndex)} is ${clearance}px from ${describe(hit.otherRelation, hit.otherRelationIndex)} segment ${hit.segmentIndex} [${from}] -> [${to}] (label rect ${formatRect(hit.rect)}; minimum ${threshold}px) — ${routeHint}.`;
+ const hint = rePlanHint([hit.labelRelation, hit.otherRelation], routeHint);
+ const message = `[composition/label-route-clearance] showcase ${diagramType} label "${hit.label?.label || hit.labelRelation?.label || ''}" on ${describe(hit.labelRelation, hit.labelRelationIndex)} is ${clearance}px from ${describe(hit.otherRelation, hit.otherRelationIndex)} segment ${hit.segmentIndex} [${from}] -> [${to}] (label rect ${formatRect(hit.rect)}; minimum ${threshold}px) — ${hint}.`;
recordDiagnostic({
code: 'composition/label-route-clearance',
severity: 'error',
@@ -1023,7 +1043,7 @@ export function cleanLabelRouteClearanceProblems({
from: hit.start,
to: hit.end,
},
- supportedFixes: [routeHint],
+ supportedFixes: [hint],
});
return message;
});
@@ -1115,7 +1135,8 @@ export function cleanLabelCanvasContainmentProblems({
const relation = hit.relation;
const relationId = relation?.id ? ` id "${relation.id}"` : '';
const labelText = hit.label?.label || relation?.label || '';
- const message = `[composition/label-canvas-containment] showcase ${diagramType} label "${labelText}" on ${relationCollection}[${hit.relationIndex}]${relationId} "${relation?.from}" -> "${relation?.to}" extends past the ${describeLabelCanvasOverflow(hit)} (label rect ${formatRect(hit.rect)}; viewBox ${hit.viewBox[0]}x${hit.viewBox[1]}) — ${routeHint}.`;
+ const hint = rePlanHint([relation], routeHint);
+ const message = `[composition/label-canvas-containment] showcase ${diagramType} label "${labelText}" on ${relationCollection}[${hit.relationIndex}]${relationId} "${relation?.from}" -> "${relation?.to}" extends past the ${describeLabelCanvasOverflow(hit)} (label rect ${formatRect(hit.rect)}; viewBox ${hit.viewBox[0]}x${hit.viewBox[1]}) — ${hint}.`;
recordDiagnostic({
code: 'composition/label-canvas-containment',
severity: 'error',
@@ -1128,7 +1149,7 @@ export function cleanLabelCanvasContainmentProblems({
overflowPx: hit.overflowPx,
tolerancePx: hit.tolerance,
},
- supportedFixes: [routeHint],
+ supportedFixes: [hint],
});
return message;
});
diff --git a/archify/renderers/shared/repository-evidence.mjs b/archify/renderers/shared/repository-evidence.mjs
index ac9399b4..ed0dc70b 100644
--- a/archify/renderers/shared/repository-evidence.mjs
+++ b/archify/renderers/shared/repository-evidence.mjs
@@ -110,9 +110,13 @@ export function verifyRepositoryEvidence(diagramType, diagram, repoRootInput) {
}
const location = parseRepositoryRemote(repository.url, { authored: true });
if (!location) {
+ // A filesystem path is the common authoring mistake: the field carries the
+ // remote origin identity, which `git remote get-url origin` reports.
+ const filesystemPath = /^(?:\/|~|\.{1,2}(?:\/|$)|[A-Za-z]:[\\/])/.test(String(repository.url ?? ''));
evidenceFailure('repository-evidence/url-invalid', '/meta/repository/url must be a credential-free HTTP(S) or Git SSH repository address without query, fragment, or dot segments.', {
subject: { path: '/meta/repository/url' },
- supportedFixes: ['declare the matching repository address without credentials; use link_mode: local-only for internal repositories'],
+ evidence: filesystemPath ? { authoredValueLooksLike: 'local filesystem path; the expected value is the remote origin address' } : {},
+ supportedFixes: ['run `git remote get-url origin` inside --repo-root and declare that credential-free address', 'use link_mode: local-only for internal repositories'],
});
}
const linkMode = repository.link_mode ?? 'web';
diff --git a/archify/test/cli.test.mjs b/archify/test/cli.test.mjs
index cad1f912..d270b633 100644
--- a/archify/test/cli.test.mjs
+++ b/archify/test/cli.test.mjs
@@ -891,6 +891,20 @@ test('cli: a later successful delivery replaces stale provenance with an artifac
assert.equal(mismatch.diagnostics[0].code, 'delivery/provenance-mismatch');
});
+test('cli: check accepts --json and emits the receipt', () => {
+ const input = path.join(skillRoot, 'examples/agent-tool-call.workflow.json');
+ const out = path.join(tmp, 'check-json-flag.html');
+
+ const delivered = run(['deliver', 'workflow', input, out, '--json']);
+ assert.equal(delivered.status, 0, delivered.stderr);
+
+ const checked = run(['check', out, '--json']);
+ assert.equal(checked.status, 0, checked.stderr);
+ const receipt = JSON.parse(checked.stdout);
+ assert.equal(receipt.ok, true);
+ assert.equal(receipt.provenance, 'current');
+});
+
test('cli: delivery pair rollback restores the previous HTML and marks it stale', () => {
const input = path.join(skillRoot, 'examples/agent-tool-call.workflow.json');
const out = path.join(tmp, 'delivery-pair-rollback.html');
@@ -3906,9 +3920,9 @@ test('cli: check rejects unknown options and extra positionals', () => {
const input = path.join(skillRoot, 'examples/agent-tool-call.workflow.json');
assert.equal(run(['render', 'workflow', input, out]).status, 0);
- const unknown = run(['check', '--json', out]);
+ const unknown = run(['check', '--strict-json', out]);
assert.equal(unknown.status, 2);
- assert.match(unknown.stderr, /Unknown check option "--json"/);
+ assert.match(unknown.stderr, /Unknown check option "--strict-json"/);
const strict = run(['check', '--require-provenance', out]);
assert.equal(strict.status, 1);
diff --git a/archify/test/desktop-reader-browser.test.mjs b/archify/test/desktop-reader-browser.test.mjs
index 9b146e45..0fd2bb8a 100644
--- a/archify/test/desktop-reader-browser.test.mjs
+++ b/archify/test/desktop-reader-browser.test.mjs
@@ -35,6 +35,54 @@ test('all packaged HTML examples pass the real visual-check desktop gate', {
}
});
+test('default sequence and dataflow canvases fit the real desktop reader without changing explicit geometry', {
+ skip: chromePath ? false : 'Set ARCHIFY_CHROME to run the real browser regression.',
+}, async () => {
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-default-reader-'));
+ const cases = [
+ ['sequence', {
+ schema_version: 1, diagram_type: 'sequence',
+ meta: { title: 'Ping', output: 'seq.html' },
+ participants: [{ id: 'a', type: 'external', label: 'Client' }, { id: 'b', type: 'backend', label: 'Server' }],
+ messages: [{ from: 'a', to: 'b', y: 160, label: 'ping' }],
+ }, [920, 760]],
+ ['dataflow', {
+ schema_version: 1, diagram_type: 'dataflow',
+ meta: { title: 'Pipe', output: 'df.html' },
+ stages: [{ label: 'In' }, { label: 'Out' }],
+ nodes: [
+ { id: 'a', type: 'frontend', label: 'Client', stage: 0, row: 0 },
+ { id: 'b', type: 'database', label: 'Store', stage: 1, row: 0 },
+ ],
+ flows: [{ from: 'a', to: 'b', label: 'write' }],
+ }, [940, 720]],
+ ];
+ try {
+ for (const [type, doc, viewBox] of cases) {
+ for (const authored of [false, true]) {
+ const input = path.join(tmp, `${type}-${authored}.json`);
+ const artifact = path.join(tmp, `${type}-${authored}.html`);
+ const candidate = structuredClone(doc);
+ if (authored) candidate.meta.viewBox = viewBox;
+ fs.writeFileSync(input, JSON.stringify(candidate));
+ execFileSync(process.execPath, [path.join(skillRoot, 'bin/archify.mjs'), 'render', type, input, artifact]);
+ const result = await runVisualCheck({ artifactPath: artifact, chromePath });
+ if (authored) {
+ assert.equal(result.exitCode, 1, `${type}: explicit narrow canvas still requires repair`);
+ assert.ok(result.receipt.diagnostics.some(({ code }) => code === 'viewer/viewport-overflow'));
+ assert.ok(result.receipt.containment.viewports.every((v) => !v.verticalScrollAccepted));
+ } else {
+ assert.equal(result.exitCode, 0, `${type}: ${JSON.stringify(result.receipt.diagnostics)}`);
+ assert.equal(result.receipt.readability.status, 'pass');
+ assert.ok(result.receipt.containment.viewports.every((v) => v.ok && v.readerFit === 'intrinsic-height'));
+ }
+ }
+ }
+ } finally {
+ fs.rmSync(tmp, { recursive: true, force: true });
+ }
+});
+
test('visual-check collects nested ID-less semantic edge text for every renderer family', {
skip: chromePath ? false : 'Set ARCHIFY_CHROME to run the real browser regression.',
}, async () => {
diff --git a/archify/test/geometry.test.mjs b/archify/test/geometry.test.mjs
index cb2b5951..7d224019 100644
--- a/archify/test/geometry.test.mjs
+++ b/archify/test/geometry.test.mjs
@@ -397,6 +397,30 @@ test('cleanCrossingProblems reports one deterministic proper X in showcase', ()
assert.match(problems[0], /move a via point/);
});
+test('crossing repair advice distinguishes automatic routes from optional authored controls', () => {
+ const first = { from: 'a', to: 'b' };
+ const second = { from: 'c', to: 'd' };
+ const options = {
+ relations: [first, second],
+ endpointIds: new Set(['a', 'b', 'c', 'd']),
+ pathFor: (relation) => ({ points: relation === first
+ ? [[0, 50], [100, 50]] : [[50, 0], [50, 100]] }),
+ diagramType: 'architecture', relationCollection: 'connections', profile: 'showcase',
+ routeHint: 'move the nodes into separate corridors',
+ };
+ const automatic = cleanCrossingProblems(options);
+ assert.equal(automatic.length, 1);
+ assert.doesNotMatch(automatic[0], /remove|authored/);
+ second.via = [[50, 25]];
+ second.labelDx = 3;
+ const before = structuredClone(options.relations);
+ const authored = cleanCrossingProblems(options);
+ assert.equal(authored.length, 1);
+ assert.match(authored[0], /authored via\/labelDx are not required by the user/);
+ assert.match(authored[0], /otherwise preserve that intent and move the nodes/);
+ assert.deepEqual(options.relations, before, 'diagnostics must not change authored geometry');
+});
+
test('cleanCrossingProblems keeps proper X as non-blocking in standard', () => {
const relations = [{ from: 'a', to: 'b' }, { from: 'c', to: 'd' }];
const routes = [[[0, 50], [100, 50]], [[50, 0], [50, 100]]];
diff --git a/archify/test/layout-rules.test.mjs b/archify/test/layout-rules.test.mjs
index 38e3b8ba..f8c0e060 100644
--- a/archify/test/layout-rules.test.mjs
+++ b/archify/test/layout-rules.test.mjs
@@ -1321,6 +1321,44 @@ test('architecture: measured auto canvases opt into height-aware reader fitting'
assert.doesNotMatch(authoredSvg, /data-reader-min-text=/);
});
+// Sequence and dataflow share the lifecycle/architecture contract: the default
+// canvas is below the wide ratio, so omitting meta.viewBox must declare the
+// intrinsic-height fit or every default canvas certainly overflows 1440x900.
+for (const [mode, doc, authoredViewBox] of [
+ ['sequence', {
+ schema_version: 1, diagram_type: 'sequence',
+ meta: { title: 'Ping', output: 'seq.html' },
+ participants: [{ id: 'a', type: 'external', label: 'Client' }, { id: 'b', type: 'backend', label: 'Server' }],
+ messages: [{ from: 'a', to: 'b', y: 160, label: 'ping' }],
+ }, [1080, 560]],
+ ['dataflow', {
+ schema_version: 1, diagram_type: 'dataflow',
+ meta: { title: 'Pipe', output: 'df.html' },
+ stages: [{ label: 'In' }, { label: 'Out' }],
+ nodes: [
+ { id: 'a', type: 'frontend', label: 'Client', stage: 0, row: 0 },
+ { id: 'b', type: 'database', label: 'Store', stage: 1, row: 0 },
+ ],
+ flows: [{ from: 'a', to: 'b', label: 'write' }],
+ }, [1080, 520]],
+]) {
+ test(`${mode}: default canvas declares intrinsic-height fit, authored viewBox does not`, () => {
+ const automatic = render(mode, doc);
+ assert.equal(automatic.code, 0, automatic.stderr);
+ const automaticSvg = fs.readFileSync(automatic.outPath, 'utf8').match(/<svg\b[^>]*>/)?.[0];
+ assert.ok(automaticSvg, `expected an SVG root for the default ${mode} canvas`);
+ assert.match(automaticSvg, /data-reader-fit="intrinsic-height"/);
+
+ const authored = structuredClone(doc);
+ authored.meta.viewBox = authoredViewBox;
+ const pinned = render(mode, authored);
+ assert.equal(pinned.code, 0, pinned.stderr);
+ const authoredSvg = fs.readFileSync(pinned.outPath, 'utf8').match(/<svg\b[^>]*>/)?.[0];
+ assert.ok(authoredSvg, `expected an SVG root for the authored ${mode} canvas`);
+ assert.doesNotMatch(authoredSvg, /data-reader-fit=/);
+ });
+}
+
// Boundary-title fonts are resolved against the same width the canvas actually
// renders into. When a connection label alone widens the auto canvas past the
// desktop reader width, the title font must rise with it — otherwise validate
diff --git a/archify/test/repository-evidence.test.mjs b/archify/test/repository-evidence.test.mjs
index 5586dbb2..6e158c14 100644
--- a/archify/test/repository-evidence.test.mjs
+++ b/archify/test/repository-evidence.test.mjs
@@ -90,6 +90,33 @@ test('repository root rejects a different physical directory inside the reposito
);
});
+test('repository url carrying a local path names the origin-discovery fix', () => {
+ const data = fixture();
+ data.diagram.meta.repository.url = data.root;
+ assert.throws(
+ () => verifyRepositoryEvidence('architecture', data.diagram, data.root),
+ (error) => {
+ const diagnostic = error?.archifyDiagnostics?.find(({ code }) => code === 'repository-evidence/url-invalid');
+ assert.ok(diagnostic);
+ assert.equal(diagnostic.evidence.authoredValueLooksLike, 'local filesystem path; the expected value is the remote origin address');
+ assert.ok(diagnostic.supportedFixes.some((fix) => fix.includes('git remote get-url origin')));
+ assert.equal(JSON.stringify(diagnostic).includes(data.root), false, 'the authored value must not be echoed into diagnostics');
+ return true;
+ },
+ );
+
+ data.diagram.meta.repository.url = 'not a url at all';
+ assert.throws(
+ () => verifyRepositoryEvidence('architecture', data.diagram, data.root),
+ (error) => {
+ const diagnostic = error?.archifyDiagnostics?.find(({ code }) => code === 'repository-evidence/url-invalid');
+ assert.ok(diagnostic);
+ assert.equal(diagnostic.evidence.authoredValueLooksLike, undefined);
+ return true;
+ },
+ );
+});
+
test('repository root fails closed when physical identity is indeterminate', (t) => {
const data = fixture();
const inaccessible = Object.assign(new Error('synthetic identity failure'), { code: 'EACCES' });