Full-codebase ts-prune + manual audit sweep. Every change below is a pure
deletion (or a 2-line re-wire where a dead function was supposed to be
alive). No scope additions.
Dead wrappers / phantom features
- shouldAutoApproveApproval: zero-value wrapper over shouldAutoApprove.
Four call sites now import shouldAutoApprove from execution-policy
directly.
- evaluateRotation(session, connectorId, thresholdsOverride): the
connectorId arg was never read (underscored), and thresholdsOverride
was only exercised by the test suite — no production caller. Signature
collapses to evaluateRotation(session). DEFAULT_THRESHOLDS /
RotationThresholds exports and their tests go with it.
- installLogRedactor: defensive console wrapper that was never wired
from worker-entry. buildRedactor handles the known threat (env-value
leaks); the pattern-based redactTokens stays for tests and future
composition.
Dead files
- resume-interrupted-tasks.ts: helper function never imported.
- service-graph-orchestration-deps.ts: three factory closures
superseded by the inline closures in create-orchestration-service.
Dead exports
- listConnectorsByAuthKind (shared/connector-catalog)
- getLocalePromptInstruction + whole localization.ts file
- ImportantDocType
- main-side ConnectorAuthKind (duplicated the shared one; not referenced)
- CheckpointEngineService, RunHousekeepingService types
- WorkspaceResolution type
- cmdOrCtrlSymbol
- AgentEventPush, CredentialPayload type aliases
- parseApprovalPayloadJson, parseEnvValue, ProviderCard
- getSOP — buildSOPSection reads the SOPS map directly; the individual
getter had no callers. Deduped to a flat array.
- renderWakeReason in wake-reasons/en.ts: byte-for-byte duplicate of the
one in wake-reasons/index.ts.
Forgotten wiring (not cleanup, but adjacent)
- registerAgentStandupRoute: the GET /api/agents/me/standup endpoint is
advertised in every system prompt and wake-reason doc, but the route
handler was never registered in api-server/index.ts. Agents have been
hitting 404 since Pi Mono. Registered.
Dead DB column
- v44 migration drops runs.context_snapshot_json. Column was added by
v16-v25, never written or read, and v43's deliberate preservation
was an interim measure. Same idempotent table-rebuild pattern as
v41/v43.
Test tree
- Phantom-feature threshold override tests removed (3). The rest of
the rotation suite re-expressed against the real maxRuns=20 floor.
495/495 unit tests pass. typecheck + build clean.
93 lines
2.8 KiB
TypeScript
93 lines
2.8 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
inferTaskType,
|
|
getConnectorStrengths,
|
|
} from "../../src/main/connector-matching";
|
|
|
|
describe("connector-matching", () => {
|
|
describe("inferTaskType", () => {
|
|
it("returns code for engineering department", () => {
|
|
expect(inferTaskType("engineering")).toBe("code");
|
|
});
|
|
|
|
it("returns research for research department", () => {
|
|
expect(inferTaskType("research")).toBe("research");
|
|
});
|
|
|
|
it("returns content for marketing department", () => {
|
|
expect(inferTaskType("marketing")).toBe("content");
|
|
});
|
|
|
|
it("returns content for product department", () => {
|
|
expect(inferTaskType("product")).toBe("content");
|
|
});
|
|
|
|
it("returns management for hr department", () => {
|
|
expect(inferTaskType("hr")).toBe("management");
|
|
});
|
|
|
|
it("returns management for finance department", () => {
|
|
expect(inferTaskType("finance")).toBe("management");
|
|
});
|
|
|
|
it("returns management for executive department", () => {
|
|
expect(inferTaskType("executive")).toBe("management");
|
|
});
|
|
|
|
it("returns content for design department", () => {
|
|
expect(inferTaskType("design")).toBe("content");
|
|
});
|
|
|
|
it("returns content for customer_support department", () => {
|
|
expect(inferTaskType("customer_support")).toBe("content");
|
|
});
|
|
|
|
it("returns management for operations department", () => {
|
|
expect(inferTaskType("operations")).toBe("management");
|
|
});
|
|
|
|
it("returns content for sales department", () => {
|
|
expect(inferTaskType("sales")).toBe("content");
|
|
});
|
|
|
|
it("returns management for legal department", () => {
|
|
expect(inferTaskType("legal")).toBe("management");
|
|
});
|
|
|
|
it("returns general for null department", () => {
|
|
expect(inferTaskType(null)).toBe("general");
|
|
});
|
|
|
|
it("returns general for undefined department", () => {
|
|
expect(inferTaskType(undefined)).toBe("general");
|
|
});
|
|
|
|
it("returns general for unknown department", () => {
|
|
expect(inferTaskType("unknown_dept")).toBe("general");
|
|
});
|
|
});
|
|
|
|
describe("getConnectorStrengths", () => {
|
|
it("returns non-empty string for claude-pro", () => {
|
|
const result = getConnectorStrengths("claude-pro");
|
|
expect(result).toBeTruthy();
|
|
expect(typeof result).toBe("string");
|
|
expect(result.length).toBeGreaterThan(10);
|
|
});
|
|
|
|
it("returns non-empty string for openai-codex", () => {
|
|
const result = getConnectorStrengths("openai-codex");
|
|
expect(result).toBeTruthy();
|
|
expect(typeof result).toBe("string");
|
|
expect(result.length).toBeGreaterThan(10);
|
|
});
|
|
|
|
it("returns non-empty string for gemini-cli", () => {
|
|
const result = getConnectorStrengths("gemini-cli");
|
|
expect(result).toBeTruthy();
|
|
expect(typeof result).toBe("string");
|
|
expect(result.length).toBeGreaterThan(10);
|
|
});
|
|
});
|
|
});
|