refactor(connectors): drop dead CLI command field after pi-mono migration
The CLI-adapter era `connector.command` field became vestigial once every provider dispatch went through pi-ai. The schema still required a non-empty command, so onboarding saveConnector silently rejected every Pi Mono row (which carries an empty default). Remove the field from the payload chain (renderer → IPC schema → DB CRUD → run dispatch → worker job), narrow RunJob.taskId to match EnqueueRunPayload, and drop the dead helper plus its test. Schema column stays NOT NULL for DB compatibility; seedConnectors writes a literal empty string so no migration is needed.
This commit is contained in:
1 parent
dac59f56c2
commit
88a1f8b334
29 files changed
+17
-171
No files matched your search
@@ -38,7 +38,6 @@ function createTestCompany(db: AppDatabase): string {
|
||||
function createTestConnector(db: AppDatabase): void {
|
||||
db.saveConnector({
|
||||
id: "openai-codex",
|
||||
command: "codex",
|
||||
model: "gpt-5",
|
||||
envBindingText: "",
|
||||
notes: "Test connector",
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { normalizeCommandValue } from "@main/connector-helpers";
|
||||
|
||||
describe("command path normalization", () => {
|
||||
it("trims surrounding whitespace from command values", () => {
|
||||
expect(normalizeCommandValue(" claude ")).toBe("claude");
|
||||
expect(normalizeCommandValue("\tcodex\n")).toBe("codex");
|
||||
});
|
||||
|
||||
it("keeps bare commands unchanged", () => {
|
||||
expect(normalizeCommandValue("claude")).toBe("claude");
|
||||
expect(normalizeCommandValue("codex")).toBe("codex");
|
||||
});
|
||||
|
||||
it("normalizes null and undefined to empty string", () => {
|
||||
expect(normalizeCommandValue(null)).toBe("");
|
||||
expect(normalizeCommandValue(undefined)).toBe("");
|
||||
});
|
||||
});
|
||||
@@ -2,42 +2,10 @@ import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
inferTaskType,
|
||||
getConnectorStrengths,
|
||||
TASK_TYPE_PREFERENCE,
|
||||
ROLE_DEPARTMENT_HINTS as _ROLE_DEPARTMENT_HINTS,
|
||||
} from "../../src/main/connector-matching";
|
||||
|
||||
describe("connector-matching", () => {
|
||||
describe("TASK_TYPE_PREFERENCE", () => {
|
||||
it("maps code tasks to claude-pro first", () => {
|
||||
expect(TASK_TYPE_PREFERENCE.code[0]).toBe("claude-pro");
|
||||
});
|
||||
|
||||
it("maps research tasks to google first", () => {
|
||||
expect(TASK_TYPE_PREFERENCE.research[0]).toBe("google");
|
||||
});
|
||||
|
||||
it("maps content tasks to claude-pro first", () => {
|
||||
expect(TASK_TYPE_PREFERENCE.content[0]).toBe("claude-pro");
|
||||
});
|
||||
|
||||
it("maps management tasks to claude-pro first", () => {
|
||||
expect(TASK_TYPE_PREFERENCE.management[0]).toBe("claude-pro");
|
||||
});
|
||||
|
||||
it("maps general tasks to claude-pro first", () => {
|
||||
expect(TASK_TYPE_PREFERENCE.general[0]).toBe("claude-pro");
|
||||
});
|
||||
|
||||
it("includes all three core connectors for every task type", () => {
|
||||
for (const key of Object.keys(TASK_TYPE_PREFERENCE)) {
|
||||
const prefs = TASK_TYPE_PREFERENCE[key as keyof typeof TASK_TYPE_PREFERENCE];
|
||||
expect(prefs).toContain("claude-pro");
|
||||
expect(prefs).toContain("openai-codex");
|
||||
expect(prefs).toContain("gemini-cli");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("inferTaskType", () => {
|
||||
it("returns code for engineering department", () => {
|
||||
expect(inferTaskType("engineering")).toBe("code");
|
||||
|
||||
@@ -18,11 +18,10 @@ describe("parseEnvBindingText", () => {
|
||||
});
|
||||
|
||||
describe("buildDefaultConnectorRows", () => {
|
||||
it("preserves previously saved connector commands", () => {
|
||||
it("preserves previously saved connector overrides", () => {
|
||||
const rows = buildDefaultConnectorRows([
|
||||
{
|
||||
id: "openai-codex",
|
||||
command: "/usr/local/bin/codex",
|
||||
status: "ready",
|
||||
notes: "custom note",
|
||||
},
|
||||
@@ -33,7 +32,6 @@ describe("buildDefaultConnectorRows", () => {
|
||||
}
|
||||
|
||||
expect(codex.id).toBe("openai-codex");
|
||||
expect(codex.command).toBe("/usr/local/bin/codex");
|
||||
expect(codex.status).toBe("ready");
|
||||
expect(codex.notes).toBe("custom note");
|
||||
expect(codex.capabilityMatrix.structuredTranscript).toBe(true);
|
||||
|
||||
@@ -11,7 +11,6 @@ describe("shared contracts", () => {
|
||||
it("fills connector defaults for optional fields", () => {
|
||||
const parsed = connectorInputSchema.parse({
|
||||
id: "openai-codex",
|
||||
command: "codex",
|
||||
});
|
||||
|
||||
expect(parsed.model).toBeUndefined();
|
||||
|
||||
@@ -96,7 +96,6 @@ describe("AppDatabase", () => {
|
||||
});
|
||||
db.saveConnector({
|
||||
id: "openai-codex",
|
||||
command: "codex",
|
||||
model: "gpt-5",
|
||||
envBindingText: "OPENAI_API_KEY=vault-openai",
|
||||
notes: "Primary coding connector",
|
||||
@@ -197,7 +196,6 @@ describe("AppDatabase", () => {
|
||||
});
|
||||
db.saveConnector({
|
||||
id: "openai-codex",
|
||||
command: "codex",
|
||||
model: "gpt-5",
|
||||
envBindingText: "",
|
||||
notes: "Test connector",
|
||||
|
||||
@@ -27,7 +27,6 @@ function scaffold(db: AppDatabase) {
|
||||
});
|
||||
db.saveConnector({
|
||||
id: "gemini-cli",
|
||||
command: "gemini",
|
||||
model: "gemini-pro",
|
||||
envBindingText: "",
|
||||
notes: "Test connector",
|
||||
|
||||
@@ -38,7 +38,6 @@ function createTestCompany(db: AppDatabase): string {
|
||||
function createTestConnector(db: AppDatabase): void {
|
||||
db.saveConnector({
|
||||
id: "gemini-cli",
|
||||
command: "gemini",
|
||||
model: "gemini-pro",
|
||||
envBindingText: "",
|
||||
notes: "Test connector for concurrent checkout",
|
||||
|
||||
@@ -30,7 +30,6 @@ function scaffold(db: AppDatabase, connectorId: ConnectorId = "gemini-cli") {
|
||||
// Always save gemini-cli (needed for most tests)
|
||||
db.saveConnector({
|
||||
id: "gemini-cli",
|
||||
command: "gemini",
|
||||
model: "gemini-pro",
|
||||
envBindingText: "",
|
||||
notes: "Test connector - no native context management",
|
||||
|
||||
@@ -55,19 +55,8 @@ describe("ipc-core-admin-handlers connector saves", () => {
|
||||
throw new Error("saveConnector handler was not registered.");
|
||||
}
|
||||
|
||||
// Pi-mono connectors default to an empty command; the schema requires a
|
||||
// non-empty one, so seed it before hitting the IPC handler.
|
||||
db.saveConnector({
|
||||
id: "anthropic",
|
||||
command: "pi-mono",
|
||||
model: null,
|
||||
envBindingText: "",
|
||||
notes: "",
|
||||
});
|
||||
|
||||
const result = await saveConnector(null as unknown as IpcMainInvokeEvent, {
|
||||
id: "anthropic",
|
||||
command: "pi-mono",
|
||||
model: anthropicModel,
|
||||
envBindingText: "ANTHROPIC_BASE_URL=https://example.com/anthropic",
|
||||
notes: "Pi-mono connector",
|
||||
|
||||
@@ -52,7 +52,6 @@ function makeConnector(id: string): ConnectorRecord {
|
||||
label: id,
|
||||
description: "",
|
||||
status: "ready",
|
||||
command: "",
|
||||
version: null,
|
||||
authState: "ok",
|
||||
lastCheckedAt: null,
|
||||
|
||||
@@ -32,7 +32,6 @@ function seedCompany(db: AppDatabase) {
|
||||
});
|
||||
db.saveConnector({
|
||||
id: "openai-codex",
|
||||
command: "codex",
|
||||
model: "gpt-5",
|
||||
envBindingText: "",
|
||||
notes: "fixture",
|
||||
|
||||
@@ -29,7 +29,6 @@ function createTestCompany(db: AppDatabase): string {
|
||||
function createTestConnector(db: AppDatabase): void {
|
||||
db.saveConnector({
|
||||
id: "openai-codex",
|
||||
command: "codex",
|
||||
model: "gpt-5",
|
||||
envBindingText: "",
|
||||
notes: "Test connector",
|
||||
|
||||
Reference in new issue
Block a user