Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

chore: remove dead code (#5997)

Myles Scolnickc6d9a24e567c
diff --git a/frontend/src/core/ai/context/__tests__/registry.test.ts b/frontend/src/core/ai/context/__tests__/registry.test.ts
index c681dac706..a29b648e42 100644
--- a/frontend/src/core/ai/context/__tests__/registry.test.ts
+++ b/frontend/src/core/ai/context/__tests__/registry.test.ts
@@ -57,10 +57,6 @@ class MockContextProvider extends AIContextProvider<MockContextItem> {
return this.createBasicCompletion(item);
}
- getCompletions(): Completion[] {
- return [];
- }
-
// Method to add items for testing
addItem(item: MockContextItem): void {
this.items.push(item);
@@ -111,10 +107,6 @@ class FileContextProvider extends AIContextProvider<FileContextItem> {
formatContext(item: FileContextItem): string {
return `File: ${item.uri}\nDescription: ${item.description}`;
}
-
- getCompletions(): Completion[] {
- return [];
- }
}
describe("AIContextProvider", () => {
@@ -228,19 +220,6 @@ describe("AIContextProvider", () => {
});
});
- describe("getCompletions", () => {
- it("should return empty array (refactored to use formatCompletion)", () => {
- const completions = provider.getCompletions();
- expect(completions).toEqual([]);
- });
-
- it("should return empty array when no items", () => {
- provider.clearItems();
- const completions = provider.getCompletions();
- expect(completions).toEqual([]);
- });
- });
-
describe("formatCompletion", () => {
it("should format completions correctly", () => {
const items = provider.getItems();
@@ -331,27 +310,6 @@ describe("AIContextRegistry", () => {
});
});
- describe("getAllCompletions", () => {
- it("should return empty array when no providers", () => {
- const completions = registry.getAllCompletions();
- expect(completions).toEqual([]);
- });
-
- it("should return empty array from providers (refactored to use formatCompletion)", () => {
- registry.register(mockProvider);
- const completions = registry.getAllCompletions();
- expect(completions).toEqual([]);
- });
-
- it("should return empty arrays from multiple providers", () => {
- registry.register(mockProvider);
- registry.register(fileProvider);
-
- const completions = registry.getAllCompletions();
- expect(completions).toEqual([]);
- });
- });
-
describe("parseAllContextIds", () => {
beforeEach(() => {
registry.register(mockProvider);
@@ -514,7 +472,6 @@ describe("AIContextRegistry", () => {
emptyProvider.clearItems();
registry.register(emptyProvider);
- expect(registry.getAllCompletions()).toEqual([]);
expect(registry.parseAllContextIds("@anything")).toEqual([]);
expect(
registry.getContextInfo(["mock://anything"] as ContextLocatorId[]),
diff --git a/frontend/src/core/ai/context/providers/__tests__/tables.test.ts b/frontend/src/core/ai/context/providers/__tests__/tables.test.ts
index a2e4399da3..5c7935091d 100644
--- a/frontend/src/core/ai/context/providers/__tests__/tables.test.ts
+++ b/frontend/src/core/ai/context/providers/__tests__/tables.test.ts
@@ -203,65 +203,6 @@ describe("TableContextProvider", () => {
});
});
- describe("getCompletions", () => {
- it("should return empty completions when no tables", () => {
- const tablesMap: DatasetTablesMap = new Map();
- const provider = new TableContextProvider(tablesMap);
-
- const completions = provider.getCompletions();
- expect(completions).toMatchSnapshot("empty-completions");
- });
-
- it("should return completions for memory tables", () => {
- const table = createMockTable("users");
- const tablesMap: DatasetTablesMap = new Map([["users", table]]);
- const provider = new TableContextProvider(tablesMap);
-
- const completions = provider.getCompletions();
- expect(completions).toMatchSnapshot("memory-table-completions");
- });
-
- it("should return completions for remote tables", () => {
- const remoteTable = createMockTable("analytics", {
- source: "bigquery://project/dataset",
- source_type: "connection",
- });
- const tablesMap: DatasetTablesMap = new Map([["analytics", remoteTable]]);
- const provider = new TableContextProvider(tablesMap);
-
- const completions = provider.getCompletions();
- expect(completions).toMatchSnapshot("remote-table-completions");
- });
-
- it("should return completions for dataframes vs tables", () => {
- const regularTable = createMockTable("regular_table");
- const dataframeTable = createMockTable("df", {
- variable_name: "df",
- source: "pandas",
- });
-
- const tablesMap: DatasetTablesMap = new Map([
- ["regular_table", regularTable],
- ["df", dataframeTable],
- ]);
- const provider = new TableContextProvider(tablesMap);
-
- const completions = provider.getCompletions();
- expect(completions).toMatchSnapshot("mixed-table-dataframe-completions");
- });
-
- it("should handle tables with special characters in names", () => {
- const specialTable = createMockTable("my-table_with.special@chars");
- const tablesMap: DatasetTablesMap = new Map([
- ["my-table_with.special@chars", specialTable],
- ]);
- const provider = new TableContextProvider(tablesMap);
-
- const completions = provider.getCompletions();
- expect(completions).toMatchSnapshot("special-chars-table-completions");
- });
- });
-
describe("provider properties", () => {
it("should have correct provider properties", () => {
const tablesMap: DatasetTablesMap = new Map();
diff --git a/frontend/src/core/ai/context/providers/__tests__/variable.test.ts b/frontend/src/core/ai/context/providers/__tests__/variable.test.ts
index c891489e18..067ecf35c0 100644
--- a/frontend/src/core/ai/context/providers/__tests__/variable.test.ts
+++ b/frontend/src/core/ai/context/providers/__tests__/variable.test.ts
@@ -269,50 +269,6 @@ describe("VariableContextProvider", () => {
});
});
- describe("getCompletions", () => {
- it("should return empty completions when no variables", () => {
- const variables: Variables = {};
- const tablesMap: DatasetTablesMap = new Map();
- const provider = new VariableContextProvider(variables, tablesMap);
-
- const completions = provider.getCompletions();
- expect(completions).toMatchSnapshot("empty-variable-completions");
- });
-
- it("should return completions for variables", () => {
- const variables: Variables = {
- ["data" as VariableName]: createMockVariable("data", {
- dataType: "pandas.DataFrame",
- }),
- ["config" as VariableName]: createMockVariable("config", {
- dataType: "dict",
- }),
- ["results" as VariableName]: createMockVariable("results", {
- dataType: "list",
- }),
- };
- const tablesMap: DatasetTablesMap = new Map();
- const provider = new VariableContextProvider(variables, tablesMap);
-
- const completions = provider.getCompletions();
- expect(completions).toMatchSnapshot("variable-completions");
- });
-
- it("should pass table names to completion function", () => {
- const variables: Variables = {
- ["var1" as VariableName]: createMockVariable("var1"),
- };
- const tablesMap: DatasetTablesMap = new Map([
- ["users", {} as any],
- ["orders", {} as any],
- ]);
- const provider = new VariableContextProvider(variables, tablesMap);
-
- const completions = provider.getCompletions();
- expect(completions).toMatchSnapshot("variable-completions-with-tables");
- });
- });
-
describe("provider properties", () => {
it("should have correct provider properties", () => {
const variables: Variables = {};
@@ -349,10 +305,8 @@ describe("VariableContextProvider", () => {
const provider = new VariableContextProvider(variables, tablesMap);
const items = provider.getItems();
- const completions = provider.getCompletions();
expect(items).toMatchSnapshot("variables-with-tables-items");
- expect(completions).toMatchSnapshot("variables-with-tables-completions");
});
});
});
diff --git a/frontend/src/core/ai/context/providers/tables.ts b/frontend/src/core/ai/context/providers/tables.ts
index 2d8fb8f1cf..4c81fdb77d 100644
--- a/frontend/src/core/ai/context/providers/tables.ts
+++ b/frontend/src/core/ai/context/providers/tables.ts
@@ -53,10 +53,6 @@ export class TableContextProvider extends AIContextProvider<TableContextItem> {
return context;
}
- getCompletions(): Completion[] {
- return [];
- }
-
formatCompletion(item: TableContextItem): Completion {
const tableName = item.data.name;
const table = item.data;
diff --git a/frontend/src/core/ai/context/providers/variable.ts b/frontend/src/core/ai/context/providers/variable.ts
index 2013ddf0c8..caa3f44be0 100644
--- a/frontend/src/core/ai/context/providers/variable.ts
+++ b/frontend/src/core/ai/context/providers/variable.ts
@@ -69,8 +69,4 @@ export class VariableContextProvider extends AIContextProvider<VariableContextIt
const { variable } = data;
return `Variable: ${id}\nType: ${variable.dataType || "unknown"}\nPreview: ${JSON.stringify(variable.value)}`;
}
-
- getCompletions(): Completion[] {
- return [];
- }
}
diff --git a/frontend/src/core/ai/context/registry.ts b/frontend/src/core/ai/context/registry.ts
index 165ce7c0e9..05b20f7307 100644
--- a/frontend/src/core/ai/context/registry.ts
+++ b/frontend/src/core/ai/context/registry.ts
@@ -38,9 +38,6 @@ export abstract class AIContextProvider<
/** Format the context for inclusion in AI prompt */
abstract formatContext(item: T): string;
- /** Generate CodeMirror completions for autocomplete - can be overridden for custom behavior */
- abstract getCompletions(): Completion[];
-
/** Format completion */
abstract formatCompletion(item: T): Completion;
@@ -121,13 +118,6 @@ export class AIContextRegistry<T extends AIContextItem> {
);
}
- /**
- * Get all completions from all providers
- */
- getAllCompletions(): Completion[] {
- return [...this.providers].flatMap((provider) => provider.getCompletions());
- }
-
getAllItems(): T[] {
return [...this.providers].flatMap((provider) => provider.getItems());
}