Skip to content

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

fix: preserve fixed workflow canvases and complete tuning receipts

tt-a1i79fe964f2061
diff --git a/.agents/skills/archify-tuning/scripts/collect.mjs b/.agents/skills/archify-tuning/scripts/collect.mjs
index a717a478..fa1f50b5 100644
--- a/.agents/skills/archify-tuning/scripts/collect.mjs
+++ b/.agents/skills/archify-tuning/scripts/collect.mjs
@@ -13,11 +13,24 @@ import path from 'node:path';
import { DIAGRAM_TYPES, authoredControls, benchmarkDocument, contentLost, finalizeStatus, tuningHome } from './lib.mjs';
const args = process.argv.slice(2);
-const option = (name, fallback) => {
- const index = args.indexOf(name);
- return index === -1 ? fallback : args[index + 1];
-};
-const target = args.find((arg, index) => !arg.startsWith('--') && !args[index - 1]?.startsWith('--')) || '';
+const valueOptions = new Set(['--round', '--trace-export']);
+const booleanOptions = new Set(['--dump', '--no-bench']);
+const values = new Map();
+const positional = [];
+let invalidArgs = false;
+for (let index = 0; index < args.length; index += 1) {
+ const arg = args[index];
+ if (valueOptions.has(arg)) {
+ const value = args[++index];
+ if (!value || value.startsWith('--')) invalidArgs = true;
+ else values.set(arg, value);
+ } else if (booleanOptions.has(arg)) {
+ // Boolean options never consume the following round path.
+ } else if (arg.startsWith('--')) invalidArgs = true;
+ else positional.push(arg);
+}
+const option = (name, fallback) => values.has(name) ? values.get(name) : fallback;
+const target = !invalidArgs && positional.length === 1 ? positional[0] : '';
const root = fs.existsSync(path.resolve(target)) ? path.resolve(target) : path.join(tuningHome(), 'rounds', target);
if (!target || !fs.existsSync(root)) {
console.error('Usage: node collect.mjs <round-name-or-path> [--round <name>] [--no-bench] [--dump] [--trace-export <file>]');
diff --git a/.agents/skills/archify-tuning/scripts/replay.mjs b/.agents/skills/archify-tuning/scripts/replay.mjs
index 902758b3..07d0ad5e 100644
--- a/.agents/skills/archify-tuning/scripts/replay.mjs
+++ b/.agents/skills/archify-tuning/scripts/replay.mjs
@@ -66,14 +66,22 @@ function render(tree, side, entry) {
child.stdout.on('data', (chunk) => { log += chunk; });
child.stderr.on('data', (chunk) => { log += chunk; });
child.on('close', (code) => {
- const ok = code === 0 && fs.existsSync(output);
+ let ok = code === 0 && fs.existsSync(output);
+ let geometry = null;
const problems = log.split('\n').filter((line) => line.startsWith('- '));
+ if (ok) {
+ try { geometry = renderedSvgFingerprint(fs.readFileSync(output, 'utf8')); }
+ catch (error) {
+ ok = false;
+ problems.push(`- [artifact/rendered-svg-invalid] ${error.message}`);
+ }
+ }
resolve({
ok,
problems: problems.length,
codes: [...new Set(problems.map((line) => (line.match(/^- \[([^\]]+)\]/) || [])[1] || 'other'))],
first: ok ? '' : (problems[0] || log.trim().split('\n')[0] || '').slice(0, 160),
- geometry: ok ? renderedSvgFingerprint(fs.readFileSync(output, 'utf8')) : null,
+ geometry,
});
});
});
diff --git a/.agents/skills/archify-tuning/scripts/shots.mjs b/.agents/skills/archify-tuning/scripts/shots.mjs
index 83b30683..dcf987ff 100644
--- a/.agents/skills/archify-tuning/scripts/shots.mjs
+++ b/.agents/skills/archify-tuning/scripts/shots.mjs
@@ -5,12 +5,9 @@
// at a 1440px desktop width and writes shots/index.html, which shows each
// pair side by side. Without --all only FIXED, REGRESSED and changed entries
// are captured: those are the ones a reviewer must look at.
-import { spawnSync } from 'node:child_process';
import fs from 'node:fs';
-import os from 'node:os';
import path from 'node:path';
-import { pathToFileURL } from 'node:url';
-import { findChrome } from '../../../../archify/bin/visual-check.mjs';
+import { ChromeVisualBrowser, findChrome } from '../../../../archify/bin/visual-check.mjs';
import { tuningHome } from './lib.mjs';
const args = process.argv.slice(2);
@@ -32,12 +29,13 @@ const { results } = JSON.parse(fs.readFileSync(path.join(target, 'replay.json'),
const picked = results.filter((result) => (args.includes('--all') || result.note) && (!option('--type') || result.type === option('--type')));
const shots = path.join(target, 'shots');
fs.mkdirSync(shots, { recursive: true });
-const profile = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-shots-'));
+let browser;
+let cleanupFailure;
const staging = fs.mkdtempSync(path.join(shots, '.pending-'));
const captures = [];
const escape = (value) => String(value).replace(/[&<>"']/g, (char) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[char]);
-function capture(side, result) {
+async function capture(side, result) {
const html = path.join(target, side, result.type, `${result.name}.html`);
const png = path.join(shots, `${result.type}-${result.name}-${side}.png`);
// A failed retry must never display evidence left by an earlier invocation.
@@ -49,9 +47,16 @@ function capture(side, result) {
return entry;
}
const pending = path.join(staging, `${result.type}-${result.name}-${side}.png`);
- const run = spawnSync(chrome, ['--headless=new', '--disable-gpu', '--hide-scrollbars', `--user-data-dir=${profile}`,
- `--window-size=1440,${height}`, `--screenshot=${pending}`, pathToFileURL(html).href], { encoding: 'utf8', timeout: 60_000 });
- let reason = run.error?.message || (run.status !== 0 ? `Chrome exited ${run.status ?? run.signal}` : '');
+ let reason = '';
+ let metrics;
+ try {
+ // The CLI screenshot command may render while Chrome keeps running.
+ // Reuse the delivery browser's settled CDP capture and owned shutdown.
+ browser ||= new ChromeVisualBrowser(chrome, { startupTimeoutMs: 20_000 });
+ metrics = await browser.inspect({ artifactPath: html, width: 1440, height, theme: 'light', screenshotPath: pending });
+ } catch (error) {
+ reason = error.message;
+ }
if (!reason) {
const bytes = fs.existsSync(pending) ? fs.readFileSync(pending) : Buffer.alloc(0);
const valid = bytes.length >= 45 && bytes.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]))
@@ -60,7 +65,7 @@ function capture(side, result) {
if (!valid) reason = 'Chrome did not produce a PNG screenshot';
}
const entry = { type: result.type, name: result.name, side, status: reason ? 'fail' : 'pass',
- ...(reason ? { reason, exitCode: run.status, stderr: (run.stderr || '').slice(-2000) } : { file: path.basename(png) }) };
+ ...(reason ? { reason, stderr: (browser?.stderr || '').slice(-2000) } : { file: path.basename(png), resolvedTheme: metrics?.resolvedTheme }) };
if (!reason) fs.renameSync(pending, png);
captures.push(entry);
return entry;
@@ -68,21 +73,23 @@ function capture(side, result) {
let rows;
try {
- rows = picked.map((result) => {
- const [base, head] = [capture('base', result), capture('head', result)];
+ rows = [];
+ for (const result of picked) {
+ const [base, head] = [await capture('base', result), await capture('head', result)];
const cell = (entry) => entry.status === 'pass' ? `<img src="${escape(entry.file)}" alt="${entry.side}">`
: `<p>${entry.side}: ${escape(entry.status)} (${escape(entry.reason)})</p>`;
- return `<h2>${escape(result.type)}/${escape(result.name)} ${escape(result.note || '')}</h2><div class="pair">${cell(base)}${cell(head)}</div>`;
- });
+ rows.push(`<h2>${escape(result.type)}/${escape(result.name)} ${escape(result.note || '')}</h2><div class="pair">${cell(base)}${cell(head)}</div>`);
+ }
} finally {
- fs.rmSync(profile, { recursive: true, force: true });
+ try { await browser?.close(); } catch (error) { cleanupFailure = error.message; }
fs.rmSync(staging, { recursive: true, force: true });
}
const failed = captures.filter((entry) => entry.status === 'fail');
const passed = captures.filter((entry) => entry.status === 'pass');
-fs.writeFileSync(path.join(shots, 'capture.json'), `${JSON.stringify({ schemaVersion: 1, replay: path.join(target, 'replay.json'), viewport: { width: 1440, height }, captures }, null, 2)}\n`);
+fs.writeFileSync(path.join(shots, 'capture.json'), `${JSON.stringify({ schemaVersion: 1, replay: path.join(target, 'replay.json'), viewport: { width: 1440, height }, theme: 'light', ...(cleanupFailure ? { cleanupFailure } : {}), captures }, null, 2)}\n`);
fs.writeFileSync(path.join(shots, 'index.html'), `<!doctype html><meta charset="utf-8"><title>Replay shots</title>
<style>body{font:14px system-ui;margin:16px;background:#111;color:#ddd}.pair{display:grid;grid-template-columns:1fr 1fr;gap:8px}img{width:100%;border:1px solid #333}</style>
<p>Left: base. Right: head. ${picked.length} entries, ${passed.length} screenshots captured, ${failed.length} capture failures, from ${escape(target)}</p>${rows.join('\n')}\n`);
console.log(`${picked.length} entries; ${passed.length} screenshots captured; ${failed.length} capture failures: ${path.join(shots, 'index.html')}`);
-process.exitCode = failed.length ? 1 : 0;
+if (cleanupFailure) console.error(`Chrome cleanup failed: ${cleanupFailure}`);
+process.exitCode = failed.length || cleanupFailure ? 1 : 0;
diff --git a/archify/references/authoring-defaults.md b/archify/references/authoring-defaults.md
index f96456d1..1e0e7338 100644
--- a/archify/references/authoring-defaults.md
+++ b/archify/references/authoring-defaults.md
@@ -36,7 +36,7 @@ Use one primary authored language from the user's choice or the request/conversa
Omit `meta.visual_preset` for classic, `meta.subtitle` for a title-only header, `meta.legend` for truthful auto, and `meta.engineering_profile` for an ordinary system overview. Explicit styles and a subtitle require a user request. Use legend or deployment ownership under the [legend](authoring-contract.md#legend-contract) or [engineering profile](authoring-contract.md#engineering-profile-default) contracts. Branding is optional and explicit when a node names a real product; [Brand marks](brand-marks.md) gives lookup and capture rules for that branch. Never let a badge replace semantic type, label, or relationship facts. Set required `meta.output` to a portable POSIX-relative `.html` path within the working directory; see [Output path contracts](delivery-contract.md#output-path-contracts) for native path exceptions.
-For a fresh Workflow use schema v2 and omit `meta.viewBox` so the compiler measures the real footprint; do not add empty canvas just to satisfy a viewport ratio. Preserve supplied fixed geometry and v1 sources. In an unpinned draft, omit node `width`: a node starts at 92px and grows to fit its label, sublabel and tag up to 200px. Absolute route or label pins retain the previous geometry contract. Use its [layout contracts](../renderers/workflow/README.md#layout-contracts) when lane or group geometry needs detail.
+For a fresh Workflow use schema v2 and omit `meta.viewBox` so the compiler measures the real footprint; do not add empty canvas just to satisfy a viewport ratio. Preserve supplied fixed geometry and v1 sources. In an unpinned draft, omit node `width`: a node starts at 92px and grows to fit its label, sublabel and tag up to 200px. Explicit canvases and absolute route or label pins retain the previous geometry contract. Use its [layout contracts](../renderers/workflow/README.md#layout-contracts) when lane or group geometry needs detail.
For a fresh Sequence omit `meta.viewBox` and `meta.column_fit`: the canvas widens for participant labels up to its readable width; preserve an authored `meta.viewBox`. Set `meta.column_fit: "fixed"` explicitly when historical fixed coordinates are required; use `spread` when a wide viewBox leaves unused horizontal space or meaningful labels need width. Describe a participant's internal action in a note on its surrounding real cross-participant message, preserving its meaning and order; Sequence self-message loops are not supported.
diff --git a/archify/renderers/workflow/README.md b/archify/renderers/workflow/README.md
index c5786ffa..38bc9393 100644
--- a/archify/renderers/workflow/README.md
+++ b/archify/renderers/workflow/README.md
@@ -149,9 +149,10 @@ a verified migration-to-v2 repair; v1 never falls through to adaptive layout.
Unpinned v2 drafts reserve 32px between overlapping same-lane nodes for routes,
and omitted node widths may grow from 92px to 200px to fit their text. Documents
-with absolute `via`, `labelAt`, `channelX`, or `channelY` pins retain the existing
-width defaults and 8px rank-clearance constraint, in both compilation and
-migration planning. Authored widths remain authoritative.
+with an explicit `meta.viewBox` or absolute `via`, `labelAt`, `channelX`, or
+`channelY` pins retain the existing width defaults and 8px rank-clearance
+constraint, in both compilation and migration planning. Authored widths remain
+authoritative.
Automatic showcase canvases check sublabels against the desktop reading floor
without enlarging text beyond its existing 8px slot. If the canvas cannot keep
diff --git a/archify/renderers/workflow/workflow-migration-geometry.mjs b/archify/renderers/workflow/workflow-migration-geometry.mjs
index 86aa84fa..0c9a263f 100644
--- a/archify/renderers/workflow/workflow-migration-geometry.mjs
+++ b/archify/renderers/workflow/workflow-migration-geometry.mjs
@@ -2,12 +2,14 @@ const TARGET_SCHEMA_VERSION = 2;
// Planning removes absolute route assertions, but must keep the same rank
// policy as the document whose coordinates will be mapped into that plan.
+// An authored canvas likewise keeps its established plan: draft-only optional
+// corridor growth must not consume space that a valid fixed canvas lacks.
const absoluteGeometryPolicy = Symbol('workflow absolute geometry policy');
export function preservesWorkflowAbsoluteGeometry(workflow) {
- return workflow[absoluteGeometryPolicy] ?? (workflow.edges || []).some((edge) => (
+ return workflow[absoluteGeometryPolicy] ?? (Array.isArray(workflow.meta?.viewBox) || (workflow.edges || []).some((edge) => (
Array.isArray(edge.via) || Array.isArray(edge.labelAt)
|| edge.channelX !== undefined || edge.channelY !== undefined
- ));
+ )));
}
function clone(value) {
diff --git a/test/archify-tuning.test.mjs b/test/archify-tuning.test.mjs
index 8be212af..cb4c1fb3 100644
--- a/test/archify-tuning.test.mjs
+++ b/test/archify-tuning.test.mjs
@@ -194,22 +194,22 @@ test('tuning: replay pins revisions and benchmark bytes and flags node-only visu
assert.match(result.stdout, /render pass rate.*browser gate not run/);
});
-test('tuning: fresh PNG captures are published while a failed render stays explicitly absent', { skip: process.platform === 'win32' ? 'Executable fixture uses a POSIX shebang' : false }, (t) => {
+test('tuning: fresh real-browser captures publish PNGs and record fixed comparison conditions', { skip: !process.env.ARCHIFY_CHROME ? 'Set ARCHIFY_CHROME for real screenshot capture' : false }, (t) => {
const root = temporary(t);
fs.mkdirSync(path.join(root, 'head/tree'), { recursive: true });
- fs.writeFileSync(path.join(root, 'head/tree/demo.html'), '<html>fresh content</html>');
+ fs.writeFileSync(path.join(root, 'head/tree/demo.html'), '<!doctype html><html data-theme="light"><body><svg role="img" viewBox="0 0 100 100"><text x="10" y="30">Fresh</text></svg></body></html>');
fs.writeFileSync(path.join(root, 'replay.json'), JSON.stringify({ results: [{ type: 'tree', name: 'demo', note: 'FIXED', base: { ok: false }, head: { ok: true } }] }));
- const png = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+aS1sAAAAASUVORK5CYII=';
- const chrome = path.join(root, 'chrome-fixture');
- fs.writeFileSync(chrome, `#!${process.execPath}\nimport fs from 'node:fs';\nconst file=process.argv.find(arg=>arg.startsWith('--screenshot=')).slice(13);\nfs.writeFileSync(file,Buffer.from('${png}','base64'));\n`, { mode: 0o755 });
- // Use .mjs so the executable fixture is independent of temporary-directory package settings.
- fs.renameSync(chrome, `${chrome}.mjs`);
- const result = run('shots.mjs', [root], { ARCHIFY_CHROME: `${chrome}.mjs` });
+ const result = run('shots.mjs', [root]);
assert.equal(result.status, 0, result.stderr);
assert.match(result.stdout, /1 screenshots captured; 0 capture failures/);
- const captures = JSON.parse(fs.readFileSync(path.join(root, 'shots/capture.json'), 'utf8')).captures;
- assert.deepEqual(captures.map(({ status }) => status), ['not-rendered', 'pass']);
- assert.deepEqual(fs.readFileSync(path.join(root, 'shots/tree-demo-head.png')), Buffer.from(png, 'base64'));
+ const receipt = JSON.parse(fs.readFileSync(path.join(root, 'shots/capture.json'), 'utf8'));
+ assert.deepEqual(receipt.captures.map(({ status }) => status), ['not-rendered', 'pass']);
+ assert.equal(receipt.theme, 'light');
+ assert.equal(receipt.captures[1].resolvedTheme, 'light');
+ const captured = fs.readFileSync(path.join(root, 'shots/tree-demo-head.png'));
+ assert.deepEqual(captured.subarray(0, 8), Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]));
+ assert.equal(captured.readUInt32BE(16), receipt.viewport.width);
+ assert.equal(captured.readUInt32BE(20), receipt.viewport.height);
assert.ok(!fs.readdirSync(path.join(root, 'shots')).some(name => name.startsWith('.pending-')));
});
@@ -246,3 +246,57 @@ test('tuning: portable exports match native separators and quoted finalize paths
assert.deepEqual(JSON.parse(fs.readFileSync(path.join(round, 'workflow/first-draft.json'), 'utf8')), draft);
}
});
+
+test('tuning: collect accepts boolean flags before its round and consumes only value options', (t) => {
+ const root = temporary(t);
+ const round = path.join(root, 'round');
+ const candidate = path.join(round, 'tree/.archify/demo/candidate.json');
+ const draft = { nodes: [{ id: 'root', label: 'Root' }] };
+ fs.mkdirSync(path.dirname(candidate), { recursive: true });
+ fs.writeFileSync(candidate, JSON.stringify(draft));
+ const trace = path.join(root, 'trace.json');
+ fs.writeFileSync(trace, JSON.stringify({ schemaVersion: 1, sessions: [{ id: 'flag-first', messages: [
+ { role: 'user', content: `Create in ${round}/tree` },
+ { role: 'assistant', content: '', tool_calls: [{ id: 'write', name: 'write', arguments: { file_path: candidate, content: JSON.stringify(draft) } }] },
+ { role: 'tool', tool_call_id: 'write', content: 'Written' },
+ ] }] }));
+ const invocations = [
+ ['--dump', round, '--no-bench', '--trace-export', trace],
+ ['--no-bench', round, '--dump', '--trace-export', trace],
+ ['--trace-export', trace, '--round', 'custom-name', '--dump', round, '--no-bench'],
+ ];
+ for (const args of invocations) {
+ const result = run('collect.mjs', args, { ARCHIFY_TUNING_HOME: root });
+ assert.equal(result.status, 0, result.stderr);
+ assert.equal(JSON.parse(fs.readFileSync(path.join(round, 'tuning-summary.json'), 'utf8')).tree.tools, 1);
+ assert.ok(fs.existsSync(path.join(round, 'tree.trace.txt')));
+ }
+});
+
+test('tuning: replay records missing and incomplete SVG failures and continues its receipt', (t) => {
+ const root = temporary(t);
+ const bench = path.join(root, 'bench');
+ fs.mkdirSync(path.join(bench, 'tree'), { recursive: true });
+ for (const name of ['missing', 'incomplete', 'good']) fs.writeFileSync(path.join(bench, 'tree', `${name}.json`), JSON.stringify({ meta: {}, name }));
+ for (const side of ['base', 'head']) {
+ const tree = path.join(root, side);
+ fs.mkdirSync(path.join(tree, 'bin'), { recursive: true });
+ const renderer = `import fs from 'node:fs';\nconst document=JSON.parse(fs.readFileSync(process.argv[4],'utf8'));\nconst good='<svg role="img" viewBox="0 0 20 20"><text x="1">Good</text></svg>';\nconst invalid=${JSON.stringify(side)}==='head'&&document.name!=='good';\nfs.writeFileSync(process.argv[5],invalid?(document.name==='missing'?'<html>No diagram</html>':'<svg role="img"><text>Partial</text>'):good);\n`;
+ fs.writeFileSync(path.join(tree, 'bin/archify.mjs'), renderer);
+ }
+ const out = path.join(root, 'out');
+ const result = run('replay.mjs', ['--base', path.join(root, 'base'), '--head', path.join(root, 'head'), '--bench', bench, '--out', out]);
+ assert.equal(result.status, 1, result.stderr);
+ const receipt = JSON.parse(fs.readFileSync(path.join(out, 'replay.json'), 'utf8'));
+ assert.equal(receipt.results.length, 3);
+ for (const name of ['missing', 'incomplete']) {
+ const item = receipt.results.find((item) => item.name === name);
+ assert.equal(item.note, 'REGRESSED');
+ assert.equal(item.head.ok, false);
+ assert.equal(item.head.geometry, null);
+ assert.equal(item.head.problems, 1);
+ assert.ok(item.head.codes.includes('artifact/rendered-svg-invalid'));
+ assert.match(item.head.first, /SVG.*(?:missing|incomplete)/);
+ }
+ assert.equal(receipt.results.find((item) => item.name === 'good').head.ok, true);
+});
diff --git a/test/workflow-compiler.test.mjs b/test/workflow-compiler.test.mjs
index 58b3c1de..67c67687 100644
--- a/test/workflow-compiler.test.mjs
+++ b/test/workflow-compiler.test.mjs
@@ -926,12 +926,26 @@ test('readable-v2 shifts top-side routes beyond lane header text deterministical
);
});
-test('explicit viewBox width is containment capacity and never stretches readable-v2 geometry', () => {
+test('an authored historical workflow canvas retains its valid rank plan', () => {
+ const document = readJson(path.join(__dirname, 'fixtures/workflow-viewport/order-overflow.workflow.json'));
+ document.meta.viewBox = [860, 786];
+ const before = JSON.stringify(document);
+ const result = compileSuccessfully(document, 'showcase');
+ assert.deepEqual(result.receipt.viewBox, [860, 786]);
+ assert.deepEqual(result.receipt.requiredViewBox, [860, 786]);
+ assert.equal(JSON.stringify(document), before);
+ assert.doesNotMatch(result.svg.match(/<svg[^>]*>/)[0], /data-reader-fit=/);
+});
+
+test('explicit viewBox width is containment capacity and never stretches its historical readable-v2 geometry', () => {
for (const qualityProfile of ['standard', 'showcase']) {
for (let fromCol = 0; fromCol < 5; fromCol += 1) {
+ // Compare authored capacities against the same historical rank plan.
+ // Unpinned drafts may reserve larger optional routing corridors.
const intrinsic = compileSuccessfully(adjacentWorkflow({
fromCol,
label: 'liga',
+ viewBox: [1600, 420],
}), qualityProfile);
const expectedGeometry = {
columns: intrinsic.receipt.columns,
@@ -959,7 +973,7 @@ test('explicit viewBox width is containment capacity and never stretches readabl
}
});
-test('capacity-only viewBox failures preserve the intrinsic routes, labels, and requirement', () => {
+test('capacity-only viewBox failures preserve historical routes, labels, and requirement', () => {
const document = {
schema_version: 2,
diagram_type: 'workflow',
@@ -981,7 +995,10 @@ test('capacity-only viewBox failures preserve the intrinsic routes, labels, and
},
],
};
- const intrinsic = compileSuccessfully(clone(document), 'showcase');
+ const referenceDocument = clone(document);
+ referenceDocument.meta.viewBox = [1600, 1000];
+ const intrinsic = compileSuccessfully(referenceDocument, 'showcase');
+ assert.deepEqual(intrinsic.receipt.requiredViewBox, [1034, 404]);
const insufficientDocument = clone(document);
insufficientDocument.meta.viewBox = [900, 1000];
@@ -1311,13 +1328,17 @@ test('readable-v2 measures multi-row legends into intrinsic and explicit viewBox
const sufficient = compileSuccessfully(sufficientDocument, 'showcase');
assert.deepEqual(sufficient.receipt.viewBox, intrinsic.receipt.requiredViewBox);
+ const referenceDocument = clone(workflow);
+ referenceDocument.meta.viewBox = [1600, 1000];
+ const reference = compileSuccessfully(referenceDocument, 'showcase');
+ assert.deepEqual(reference.receipt.requiredViewBox, [768, 302]);
const expectedGeometry = {
- requiredViewBox: intrinsic.receipt.requiredViewBox,
- columns: intrinsic.receipt.columns,
- nodes: intrinsic.receipt.nodes,
- edges: intrinsic.receipt.edges,
- labels: intrinsic.receipt.labels,
- legend: legendGeometry(intrinsic.svg),
+ requiredViewBox: reference.receipt.requiredViewBox,
+ columns: reference.receipt.columns,
+ nodes: reference.receipt.nodes,
+ edges: reference.receipt.edges,
+ labels: reference.receipt.labels,
+ legend: legendGeometry(reference.svg),
};
for (const width of [900, 1400]) {
const explicitDocument = clone(workflow);