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
docs(workflow): reserve clear straight automatic routes before bends
tt-a1i76421a4d6b95
diff --git a/archify/renderers/workflow/workflow-compiler.mjs b/archify/renderers/workflow/workflow-compiler.mjsindex d116f982..98973ec5 100644--- a/archify/renderers/workflow/workflow-compiler.mjs+++ b/archify/renderers/workflow/workflow-compiler.mjs@@ -2274,6 +2274,16 @@ function routeContainsChannelPin(points, field, value) {});}+function hasClearStraightAutomaticRoute(edge) {+ if (!independentAutomaticRoute(edge) || edge.from === edge.to) return false;+ const from = nodes.get(edge.from);+ const to = nodes.get(edge.to);+ const start = anchor(from, defaultFromSide(from, to));+ const end = anchor(to, defaultToSide(from, to));+ const aligned = Math.abs(start[0] - end[0]) < 0.0001 || Math.abs(start[1] - end[1]) < 0.0001;+ return aligned && routeClearsUnrelatedNodes(edge, [start, end]);+}+function validateReadablePinnedGeometry() {if (workflow.schema_version !== 2) return;// Reserve absolute geometry at contested nodes before automatic routing,@@ -2285,6 +2295,18 @@ function validateReadablePinnedGeometry() {validateReadableRouteControls(edge);pathFor(edge);}+ // Reserve clear straight automatic routes before ID-ordered bending edges so+ // a later edge cannot steal a corridor that already has one good straight path.+ // Skip during discoverFixes probes (discoverFixes === false): those probes+ // strip labelAt/via and would otherwise look "automatic", recreating the pin+ // geometry and shrinking causal pin sets (round-23 regression).+ if (discoverFixes) {+ for (const edge of workflow.edges) {+ if (!nodes.has(edge.from) || !nodes.has(edge.to) || !hasClearStraightAutomaticRoute(edge)) continue;+ validateReadableRouteControls(edge);+ pathFor(edge);+ }+ }// Routing order feedback: an automatic edge that an earlier automatic edge// forced into a shared corridor or crossing is planned first on a retry.for (const index of asArray(layoutFeedback.routeFirst)) {diff --git a/test/workflow-compiler-hard-contract.test.mjs b/test/workflow-compiler-hard-contract.test.mjsindex 7a6daead..1587a381 100644--- a/test/workflow-compiler-hard-contract.test.mjs+++ b/test/workflow-compiler-hard-contract.test.mjs@@ -339,13 +339,21 @@ test('readable-v2 may expand an unlabeled edge around already placed labels', ()const route = first.receipt.edges.find(({ id }) => id === 'e04')?.points;assert.ok(route);assertOrthogonal(route);- assert.ok(Math.max(...route.map(([x]) => x)) > 764, JSON.stringify(route));+ // Straight-first reservation may push the unlabeled edge left (return-left)+ // or right (outside-right); either escape clears the labeled fan-out region.+ assert.ok(+ Math.max(...route.map(([x]) => x)) > 764+ || Math.min(...route.map(([x]) => x)) < 40,+ JSON.stringify(route),+ );+ // An authored canvas at least as large as the intrinsic requirement still+ // compiles; the exact width may grow when straight-first reorders fan-out.const boundedDocument = clone(document);- boundedDocument.meta.viewBox = [1378, 692];+ boundedDocument.meta.viewBox = [...first.receipt.requiredViewBox];const bounded = compileWorkflow({ workflow: boundedDocument, qualityProfile: 'standard' });assert.equal(bounded.ok, true, JSON.stringify(bounded.diagnostics, null, 2));- assert.deepEqual(bounded.receipt.viewBox, [1378, 692]);+ assert.deepEqual(bounded.receipt.viewBox, first.receipt.requiredViewBox);});test('readable-v2 feeds a measured outside-channel constraint back into layout', () => {diff --git a/test/workflow-compiler.test.mjs b/test/workflow-compiler.test.mjsindex 92a8ab17..d306fd86 100644--- a/test/workflow-compiler.test.mjs+++ b/test/workflow-compiler.test.mjs@@ -998,10 +998,10 @@ test('capacity-only viewBox failures preserve historical routes, labels, and reqconst referenceDocument = clone(document);referenceDocument.meta.viewBox = [1600, 1000];const intrinsic = compileSuccessfully(referenceDocument, 'showcase');- assert.deepEqual(intrinsic.receipt.requiredViewBox, [1034, 404]);+ assert.deepEqual(intrinsic.receipt.requiredViewBox, [768, 404]);const insufficientDocument = clone(document);- insufficientDocument.meta.viewBox = [900, 1000];+ insufficientDocument.meta.viewBox = [700, 1000];const insufficient = compileWorkflow({workflow: insufficientDocument,qualityProfile: 'showcase',@@ -1011,7 +1011,7 @@ test('capacity-only viewBox failures preserve historical routes, labels, and reqassert.equal(insufficient.diagnostics.length, 1, JSON.stringify(insufficient.diagnostics, null, 2));const [capacity] = insufficient.diagnostics;assert.equal(capacity.code, 'workflow/viewbox-capacity');- assert.deepEqual(capacity.evidence.actualViewBox, [900, 1000]);+ assert.deepEqual(capacity.evidence.actualViewBox, [700, 1000]);assert.deepEqual(capacity.evidence.requiredViewBox, intrinsic.receipt.requiredViewBox);const sufficientDocument = clone(document);