refactor: nuke dead exports, dead files, dead DB column, dead zero-value wrappers
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.
This commit is contained in:
1 parent
e0e43d6127
commit
f041336721
33 files changed
+143
-481
No files matched your search
@@ -286,9 +286,3 @@ export function findConnectorCatalogEntry(id: string): ConnectorCatalogEntry | u
|
||||
export function listFeaturedOnboardingConnectors(): ConnectorCatalogEntry[] {
|
||||
return CONNECTOR_CATALOG.filter((entry) => entry.onboardingFeatured === true);
|
||||
}
|
||||
|
||||
export function listConnectorsByAuthKind(
|
||||
kind: ConnectorAuthKind,
|
||||
): ConnectorCatalogEntry[] {
|
||||
return CONNECTOR_CATALOG.filter((entry) => entry.auth.type === kind);
|
||||
}
|
||||
@@ -17,5 +17,3 @@ export const agentEventPushSchema = z.object({
|
||||
type: z.string(),
|
||||
}).passthrough(),
|
||||
});
|
||||
|
||||
export type AgentEventPush = z.infer<typeof agentEventPushSchema>;
|
||||
@@ -81,7 +81,6 @@ export const credentialSummarySchema = z.object({
|
||||
});
|
||||
|
||||
export type CredentialSummary = z.infer<typeof credentialSummarySchema>;
|
||||
export type CredentialPayload = z.infer<typeof credentialPayloadSchema>;
|
||||
export type SaveCredentialInput = z.infer<typeof saveCredentialInputSchema>;
|
||||
export type AwsCredential = z.infer<typeof awsCredentialSchema>;
|
||||
export type AzureCredential = z.infer<typeof azureCredentialSchema>;
|
||||
|
||||
@@ -17,6 +17,4 @@ export const IMPORTANT_DOC_TYPES = [
|
||||
"sop",
|
||||
] as const;
|
||||
|
||||
export type ImportantDocType = (typeof IMPORTANT_DOC_TYPES)[number];
|
||||
|
||||
export const IMPORTANT_DOC_TYPE_SET: ReadonlySet<string> = new Set(IMPORTANT_DOC_TYPES);
|
||||
@@ -1,23 +0,0 @@
|
||||
import type { AppLocale } from "./locale";
|
||||
|
||||
/**
|
||||
* Returns a locale-appropriate system prompt instruction for AI agents.
|
||||
* When locale is "zh", the instruction tells the agent to respond entirely in Chinese.
|
||||
* When locale is "en", the instruction tells the agent to respond entirely in English.
|
||||
*/
|
||||
export function getLocalePromptInstruction(locale: AppLocale): string {
|
||||
if (locale === "zh") {
|
||||
return [
|
||||
"重要语言要求:你必须全程使用中文进行所有沟通。",
|
||||
"这包括:任务描述、评论、消息、报告、文档、审批、通知 — 所有输出必须是中文。",
|
||||
"即使系统提示和 API 文档是英文的,你的所有回复和创建的内容必须是中文。",
|
||||
"不要使用英文回复,除非是代码、变量名、API 端点等技术术语。",
|
||||
].join("\n");
|
||||
}
|
||||
return [
|
||||
"Important language requirement: You MUST communicate entirely in English.",
|
||||
"This includes: task descriptions, comments, messages, reports, documents, approvals, notifications — ALL output must be in English.",
|
||||
"Even if some existing content or context is in another language, all your responses and created content must be in English.",
|
||||
"Do not respond in other languages, except for code, variable names, API endpoints, and other technical terms.",
|
||||
].join("\n");
|
||||
}
|
||||
Reference in new issue
Block a user