Skip to content

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

test(benchmarks): cover advertised fix sets spanning multiple references

momoyeyu885306b87bab
diff --git a/benchmarks/repair-rounds/defects.mjs b/benchmarks/repair-rounds/defects.mjs
index 76a7f857..e63a42ff 100644
--- a/benchmarks/repair-rounds/defects.mjs
+++ b/benchmarks/repair-rounds/defects.mjs
@@ -114,6 +114,19 @@ export const DEFECTS = {
return { restores };
},
},
+ // Same unknown id referenced from an edge endpoint and mainPath: a fix is
+ // only complete when it repoints every reference, and the advertised edits
+ // must match the set verification applied.
+ 'endpoint-shared-ghost': {
+ appliesTo: ['workflow'],
+ expectedCodes: { default: ['workflow/unknown-edge-endpoint'] },
+ inject(doc) {
+ const restores = [capture(doc, '/edges/0/from'), capture(doc, '/mainPath/0')];
+ doc.edges[0].from = 'benchmark-ghost-node';
+ doc.mainPath[0] = 'benchmark-ghost-node';
+ return { restores };
+ },
+ },
'viewbox-oversized': {
appliesTo: ['architecture'],
expectedCodes: { default: ['composition/desktop-readability'] },
diff --git a/test/repair-rounds.test.mjs b/test/repair-rounds.test.mjs
index 993b9f9c..07682a2d 100644
--- a/test/repair-rounds.test.mjs
+++ b/test/repair-rounds.test.mjs
@@ -184,6 +184,31 @@ test('a staged second defect surfaces only after the first is repaired', () => {
assert.equal(label.firstSeenRound, 2);
});
+test('advertised fixes repoint every reference verification rewrote', () => {
+ const file = miniManifest('workflow-shared-ghost', 'workflow', [{ class: 'endpoint-shared-ghost' }]);
+ const result = run(['run', '--manifest', file, '--command', 'validate']);
+ assert.equal(result.status, 0, result.stderr || result.stdout);
+ const receipt = JSON.parse(result.stdout.split('\n')[0]);
+ assert.equal(receipt.passed, true);
+ assert.equal(receipt.totals.rounds, 2);
+ const diagnostic = receipt.rounds[0].diagnostics
+ .find((d) => d.code === 'workflow/unknown-edge-endpoint');
+ assert.ok(diagnostic, 'expected an unknown-edge-endpoint diagnostic');
+ const fixes = diagnostic.supportedFixes
+ .map((entry) => entry.match(/set (\S+) to verified node id "([^"]+)"/))
+ .filter(Boolean);
+ assert.ok(fixes.length > 0, 'expected advertised repoint fixes');
+ const byTarget = new Map();
+ for (const [, pointer, target] of fixes) {
+ byTarget.set(target, [...(byTarget.get(target) || []), pointer]);
+ }
+ for (const [target, pointers] of byTarget) {
+ assert.deepEqual([...pointers].sort(), ['/edges/0/from', '/mainPath/0'],
+ `candidate "${target}" must advertise every reference to the unknown id`);
+ }
+ assert.equal(receipt.rounds[0].repairs.applied[0].detail.includes('/mainPath/0'), true);
+});
+
test('diagnostics the rules cannot map are counted as unactionable and stall the loop', () => {
const file = miniManifest('arch-duplicate-id', 'architecture', [{ class: 'node-duplicate-id' }]);
const result = run(['run', '--manifest', file, '--command', 'validate']);