Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.
HTML agent-skillsai-agentsarchitecture-diagramclaude-codeclaude-skillscodexcoding-agentsdeepseek-harnessdeveloper-toolsdiagramsdiagrams-as-codedsh-pluginflowchartllmmermaidopencodesequence-diagramsoftware-architecturesystem-designvisualization
fix: enumerate the complete verified repoint set in unknown-endpoint fixes
momoyeyuedb2d3b75ef5
diff --git a/archify/renderers/workflow/workflow-compiler.mjs b/archify/renderers/workflow/workflow-compiler.mjsindex 8529e47d..b7161069 100644--- a/archify/renderers/workflow/workflow-compiler.mjs+++ b/archify/renderers/workflow/workflow-compiler.mjs@@ -1529,6 +1529,23 @@ const edgeIndexByEdge = new Map(asArray(workflow.edges).map((edge, index) => [ed}}+ // repointReferences verifies repointing every reference together; suggestions+ // must list that same complete edit set so applying them verbatim is what was+ // verified. Indexes follow the emitter conventions: edges use the+ // sourceIndexes space, mainPath the canonical workflow's.+ function unknownIdReferenceFixes(unknownId, nodeId) {+ const fixes = [];+ asArray(qualityResolvedWorkflow.edges).forEach((entry, index) => {+ for (const field of ['from', 'to']) {+ if (entry[field] === unknownId) fixes.push(`set /edges/${index}/${field} to verified node id "${nodeId}"`);+ }+ });+ asArray(workflow.mainPath).forEach((id, index) => {+ if (id === unknownId) fixes.push(`set /mainPath/${index} to verified node id "${nodeId}"`);+ });+ return fixes;+ }+const { enforceLegacyColumnCapacity } = createLegacyCapacityRepair({workflow,nodes,@@ -2786,11 +2803,11 @@ function validateWorkflow() {evidence: {unknownNodeId: id,availableNodeIds: candidates,- fixVerification: 'candidate compiles once every reference to the unknown id is repointed consistently',+ fixVerification: 'each candidate was verified by applying every listed repoint together and recompiling',},supportedFixes: candidates.flatMap((nodeId) => (acceptsFix((document) => repointReferences(document, id, nodeId))- ? [`set /mainPath/${stepIndex} to verified node id "${nodeId}"`]+ ? unknownIdReferenceFixes(id, nodeId): [])),});@@ -2947,7 +2964,7 @@ function validateReadableInputsBeforeRouting() {const message = `Workflow edge "${workflowEdgeName(edge)}" references unknown ${endpoint} "${edge[field]}".`;const supportedFixes = availableNodeIds.flatMap((nodeId) => (acceptsFix((document) => repointReferences(document, edge[field], nodeId))- ? [`set /edges/${edgeIndex}/${field} to verified node id "${nodeId}"`]+ ? unknownIdReferenceFixes(edge[field], nodeId): []));fail({@@ -2965,7 +2982,7 @@ function validateReadableInputsBeforeRouting() {endpoint,unknownNodeId: edge[field],availableNodeIds,- fixVerification: 'candidate compiles once every reference to the unknown id is repointed consistently',+ fixVerification: 'each candidate was verified by applying every listed repoint together and recompiling',},supportedFixes,});diff --git a/archify/test/workflow-compiler-hard-contract.test.mjs b/archify/test/workflow-compiler-hard-contract.test.mjsindex 7a8d03b2..f545c350 100644--- a/archify/test/workflow-compiler-hard-contract.test.mjs+++ b/archify/test/workflow-compiler-hard-contract.test.mjs@@ -1701,7 +1701,7 @@ test('readable-v2 reports unknown edge endpoints with a precise semantic diagnosendpoint: 'target',unknownNodeId: 'ghost',availableNodeIds: ['a', 'b'],- fixVerification: 'candidate compiles once every reference to the unknown id is repointed consistently',+ fixVerification: 'each candidate was verified by applying every listed repoint together and recompiling',});});@@ -1725,6 +1725,51 @@ test('unknown endpoint diagnostics retain the authored edge pointer after canoniassert.ok(diagnostic.supportedFixes.length > 0);});+test('unknown-endpoint supportedFixes list the complete verified edit set and recompile verbatim', () => {+ // "ghost" is referenced from an edge AND mainPath; the verified repair+ // repoints every reference to the same candidate.+ const document = workflow({+ lanes: [{ id: 'main', label: 'M' }],+ nodes: [+ { id: 'a', lane: 'main', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'main', col: 1, type: 'backend', label: 'B' },+ { id: 'c', lane: 'main', col: 2, type: 'backend', label: 'C' },+ ],+ edges: [+ { id: 'ab', from: 'a', to: 'ghost' },+ { id: 'bc', from: 'b', to: 'c' },+ { id: 'ac', from: 'a', to: 'c' },+ ],+ });+ document.mainPath = ['a', 'ghost', 'c'];+ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assert.equal(result.ok, false);+ const diagnostic = result.diagnostics.find((entry) => entry.code === 'workflow/unknown-edge-endpoint');+ assert.ok(diagnostic);+ const fixesByCandidate = new Map();+ for (const fix of diagnostic.supportedFixes) {+ const match = fix.match(/^set (\S+) to verified node id "([^"]+)"$/);+ assert.ok(match, `fix must be executable verbatim: ${fix}`);+ if (!fixesByCandidate.has(match[2])) fixesByCandidate.set(match[2], []);+ fixesByCandidate.get(match[2]).push(match[1]);+ }+ assert.ok(fixesByCandidate.size > 0, 'expected at least one verified candidate');+ for (const [nodeId, pointers] of fixesByCandidate) {+ assert.ok(pointers.includes('/edges/0/to'), `candidate "${nodeId}" must cover the edge reference`);+ assert.ok(pointers.includes('/mainPath/1'), `candidate "${nodeId}" must cover the mainPath reference`);+ assert.equal(pointers.length, 2);+ const repaired = clone(document);+ for (const pointer of pointers) {+ const segments = pointer.split('/').filter(Boolean);+ let target = repaired;+ for (const segment of segments.slice(0, -1)) target = target[segment];+ target[segments.at(-1)] = nodeId;+ }+ const verified = compileWorkflow({ workflow: repaired });+ assert.equal(verified.ok, true, `applying every suggested edit for "${nodeId}" must recompile: ${JSON.stringify(verified.diagnostics, null, 2)}`);+ }+});+test('unknown node lane diagnostics retain the authored node pointer after canonical sorting', () => {const document = oneLaneWorkflow([]);document.nodes[0].lane = 'ghost';