Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions agent-service/src/agent/util/auto-layout.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ describe("autoLayoutWorkflow", () => {
expect(b.x).toBeLessThan(c.x);
});

test("matches the frontend rank separation for linked operators", () => {
const state = new WorkflowState();
state.addOperator(makeOperator("a"), SENTINEL_POS);
state.addOperator(makeOperator("b"), SENTINEL_POS);
state.addLink(makeLink("l1", "a", "b"));

autoLayoutWorkflow(state);

const a = state.getOperatorPosition("a")!;
const b = state.getOperatorPosition("b")!;
// dagre stores node centers, so the gap is node width (200) + ranksep (80).
expect(b.x - a.x).toBe(280);
});

test("assigns positions to disconnected operators as well", () => {
const state = new WorkflowState();
// Seeding each disconnected node with the same sentinel forces the
Expand Down
2 changes: 1 addition & 1 deletion agent-service/src/agent/util/auto-layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import type { WorkflowState } from "../workflow-state";
const LAYOUT_CONFIG: dagre.GraphLabel = {
nodesep: 100,
edgesep: 150,
ranksep: 100,
ranksep: 80,
ranker: "tight-tree",
rankdir: "LR",
};
Expand Down
Loading