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.

fix: remove unsafe tests→tested_by alias that inverts edge direction

Lum1104fd0df15d1c50
diff --git a/understand-anything-plugin/packages/core/src/__tests__/schema.test.ts b/understand-anything-plugin/packages/core/src/__tests__/schema.test.ts
index 34df1133..5e9dd4a0 100644
--- a/understand-anything-plugin/packages/core/src/__tests__/schema.test.ts
+++ b/understand-anything-plugin/packages/core/src/__tests__/schema.test.ts
@@ -224,13 +224,12 @@ describe("schema validation", () => {
expect(result.data!.edges[0].type).toBe("depends_on");
});
- it('normalizes "tests" edge type to "tested_by"', () => {
+ it('rejects "tests" edge type — direction-inverting alias is unsafe', () => {
const graph = structuredClone(validGraph);
(graph.edges[0] as any).type = "tests";
const result = validateGraph(graph);
- expect(result.success).toBe(true);
- expect(result.data!.edges[0].type).toBe("tested_by");
+ expect(result.success).toBe(false);
});
it("still rejects truly invalid edge types after normalization", () => {
diff --git a/understand-anything-plugin/packages/core/src/schema.ts b/understand-anything-plugin/packages/core/src/schema.ts
index e6567b1e..c42af9ea 100644
--- a/understand-anything-plugin/packages/core/src/schema.ts
+++ b/understand-anything-plugin/packages/core/src/schema.ts
@@ -31,7 +31,6 @@ export const EDGE_TYPE_ALIASES: Record<string, string> = {
relates_to: "related",
related_to: "related",
similar: "similar_to",
- tests: "tested_by",
import: "imports",
export: "exports",
contain: "contains",