Skip to content

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

fix: retain actionable waterfall numeric diagnostics

杨嘉伟a06c33bc1ab5
diff --git a/archify/renderers/waterfall/render-waterfall.mjs b/archify/renderers/waterfall/render-waterfall.mjs
index b7c32aff..bc2651f6 100644
--- a/archify/renderers/waterfall/render-waterfall.mjs
+++ b/archify/renderers/waterfall/render-waterfall.mjs
@@ -161,10 +161,9 @@ const axisX0 = layout.margin + labelW + layout.columnGap;
const axisX1 = axisX0 + layout.axisWidth;
const scale = wall > 0 ? layout.axisWidth / wall : 0;
if (!Number.isFinite(scale)) {
- throwDiagnosticProblems('Waterfall validation failed', ['The recorded range cannot form a finite axis scale.'], {
- code: 'waterfall/invalid-timing', subject: { diagramType: 'waterfall', path: '/spans' },
- evidence: { start: t0, end: t1, wall }, supportedFixes: ['Rescale the recorded timing and unit to a representable range.'],
- });
+ fail('waterfall/invalid-timing', 'The recorded range cannot form a finite axis scale.',
+ { path: '/spans' }, { start: t0, end: t1, wall }, ['Rescale the recorded timing and unit to a representable range.']);
+ throwDiagnosticProblems('Waterfall validation failed', problems, { diagnostics: details });
}
const xOf = (t) => Math.round((axisX0 + (t - t0) * scale) * 100) / 100;
const rowsTop = layout.top + layout.axisH;
diff --git a/test/waterfall-rendering.test.mjs b/test/waterfall-rendering.test.mjs
index f47366f1..946db252 100644
--- a/test/waterfall-rendering.test.mjs
+++ b/test/waterfall-rendering.test.mjs
@@ -19,7 +19,7 @@ function run(diagram, extra = []) {
const input = path.join(directory, 'candidate.waterfall.json');
const output = path.join(directory, 'candidate.html');
fs.writeFileSync(input, JSON.stringify(diagram));
- return { ...spawnSync(process.execPath, [renderer, input, output, ...extra], { cwd: directory, encoding: 'utf8', timeout: 10000 }), output };
+ return { ...spawnSync(process.execPath, [renderer, input, output, ...extra], { cwd: directory, encoding: 'utf8', timeout: 10000 }), input, output };
}
function layoutOf(diagram) {
const result = run(diagram, ['--layout-json']);
@@ -82,6 +82,12 @@ test('waterfall: unrepresentable derived timing is rejected without writing inva
assert.equal(result.status, 1, result.stderr || result.error?.message);
assert.match(result.stderr, /finite/);
assert.equal(fs.existsSync(result.output), false);
+ const cli = spawnSync(process.execPath, [path.join(skillRoot, 'bin/archify.mjs'), 'render', 'waterfall', result.input, result.output, '--json'], { encoding: 'utf8', timeout: 10000 });
+ assert.equal(cli.status, 1, cli.stderr || cli.stdout);
+ const receipt = JSON.parse(cli.stdout);
+ const diagnostic = receipt.diagnostics.find(({ code }) => code === 'waterfall/invalid-timing');
+ assert.ok(diagnostic, cli.stdout);
+ assert.ok(diagnostic.supportedFixes.length > 0, cli.stdout);
}
});