Skip to content

Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.

chore(dashboard): address Task 4 review minors

Lum11049da085018e8e
diff --git a/understand-anything-plugin/packages/dashboard/src/utils/__tests__/edgeAggregation.test.ts b/understand-anything-plugin/packages/dashboard/src/utils/__tests__/edgeAggregation.test.ts
index 54b63230..3b41edcf 100644
--- a/understand-anything-plugin/packages/dashboard/src/utils/__tests__/edgeAggregation.test.ts
+++ b/understand-anything-plugin/packages/dashboard/src/utils/__tests__/edgeAggregation.test.ts
@@ -1,9 +1,12 @@
import { describe, it, expect } from "vitest";
import { aggregateContainerEdges } from "../edgeAggregation";
-import type { GraphEdge } from "@understand-anything/core/types";
+import type { GraphEdge, EdgeType } from "@understand-anything/core/types";
-const ce = (source: string, target: string, type: string = "calls"): GraphEdge =>
- ({ source, target, type }) as GraphEdge;
+const ce = (source: string, target: string, type: EdgeType = "calls"): GraphEdge => ({
+ source,
+ target,
+ type,
+});
describe("aggregateContainerEdges", () => {
it("returns empty arrays for empty input", () => {
@@ -36,7 +39,7 @@ describe("aggregateContainerEdges", () => {
expect(agg.sourceContainerId).toBe("auth");
expect(agg.targetContainerId).toBe("cart");
expect(agg.count).toBe(3);
- expect(agg.types.sort()).toEqual(["calls", "imports"]);
+ expect(agg.edgeTypes.sort()).toEqual(["calls", "imports"]);
});
it("treats opposite directions as separate aggregated edges", () => {
@@ -58,4 +61,17 @@ describe("aggregateContainerEdges", () => {
expect(r.intraContainer).toEqual([]);
expect(r.interContainerAggregated).toEqual([]);
});
+
+ it("does not collide when container ids contain the separator character", () => {
+ // Pre-fix: key was `${sc} ${tc}` so `("x y", "z")` and `("x", "y z")`
+ // would both map to `"x y z"`. Length-prefix on source prevents this.
+ const m = new Map([
+ ["a", "x y"],
+ ["b", "z"],
+ ["c", "x"],
+ ["d", "y z"],
+ ]);
+ const r = aggregateContainerEdges([ce("a", "b"), ce("c", "d")], m);
+ expect(r.interContainerAggregated).toHaveLength(2);
+ });
});
diff --git a/understand-anything-plugin/packages/dashboard/src/utils/edgeAggregation.ts b/understand-anything-plugin/packages/dashboard/src/utils/edgeAggregation.ts
index 5bbeee89..3e47a7e6 100644
Binary files a/understand-anything-plugin/packages/dashboard/src/utils/edgeAggregation.ts and b/understand-anything-plugin/packages/dashboard/src/utils/edgeAggregation.ts differ