Skip to content

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

fix: attribute repeated diagnostic messages per occurrence

momoyeyu87003b8630b6
diff --git a/archify/renderers/shared/diagnostics.mjs b/archify/renderers/shared/diagnostics.mjs
index c725c62e..09dc03cb 100644
Binary files a/archify/renderers/shared/diagnostics.mjs and b/archify/renderers/shared/diagnostics.mjs differ
diff --git a/archify/test/render-failure-diagnostics.test.mjs b/archify/test/render-failure-diagnostics.test.mjs
index 9c9a58d3..46dfb4b0 100644
--- a/archify/test/render-failure-diagnostics.test.mjs
+++ b/archify/test/render-failure-diagnostics.test.mjs
@@ -161,6 +161,24 @@ test('a recorded layout diagnostic cannot hide a later unclassified exception',
assert.deepEqual(JSON.parse(classified.stderr).diagnostics.map(d => d.message), ['earlier layout problem', 'final layout problem']);
});
+test('repeated problem messages keep their own subject and evidence', t => {
+ const cwd = workspace(t);
+ const message = 'Connection "ghost" references unknown target "ghost".';
+ const script = `${installBoundary} import { throwDiagnosticProblems } from ${JSON.stringify(diagnosticModule)};
+ throwDiagnosticProblems('architecture rejected', [${JSON.stringify(message)}, ${JSON.stringify(message)}], {
+ diagnostics: [
+ { code: 'architecture/unknown-endpoint', message: ${JSON.stringify(message)}, subject: { path: '/connections/0/to' }, evidence: { connection: 0 }, supportedFixes: ['set /connections/0/to to verified node id "a"'] },
+ { code: 'architecture/unknown-endpoint', message: ${JSON.stringify(message)}, subject: { path: '/connections/1/to' }, evidence: { connection: 1 }, supportedFixes: ['set /connections/1/to to verified node id "b"'] },
+ ],
+ });`;
+ const machine = run(['--input-type=module', '-e', script], cwd, true);
+ assert.equal(machine.status, 1, machine.stderr);
+ const failure = JSON.parse(machine.stderr);
+ assert.equal(failure.diagnostics.length, 2);
+ assert.deepEqual(failure.diagnostics.map((entry) => entry.subject.path), ['/connections/0/to', '/connections/1/to']);
+ assert.deepEqual(failure.diagnostics.map((entry) => entry.evidence.connection), [0, 1]);
+});
+
test('invalid output arguments keep their implementation error instead of a filesystem repair', t => {
const cwd = workspace(t);
const helper = new URL('../renderers/shared/cli.mjs', import.meta.url).href;